ADR 0060: The triad_count API review and freeze (0.3)#
Status: Accepted under delegation (2026-10-21; GOVERNANCE.md, “Delegation of technical ADRs”) for the review, its amendments and the freeze mechanism. It carries out the author’s default D4 at the end of M9b (
triad_count,dyng.triad_countanddyng triad_countfrozen andstable;experimental::count_local_patternsexperimental), by the method of ADRs 0023, 0035 and 0047 and the checklistdocs/developer/api_review_checklist.md, on the precedent of mosp (GOVERNANCE.md, 2026-10-07: the maturity after an API review, with the full gate record in the release certificate). Pending the author: the maturitystablefrom 0.3.0 (D4) and every new public name of M9 (D9, section “The new public names” below) await the author’s confirmation at the 0.3.0 release; until then a change is still possible as an api-change with a CHANGELOG entry. It changes no rule the author approved: the stability policy of PLAN 5.9, the gates and their protocol, the parity rules and the frozen headers (core/*,graph/*,hypergraph/*,update.hpp) are untouched.Decided: the author confirmed on 2026-10-22 (GOVERNANCE.md, approvals log, 2026-10-22) the maturity
stablefrom 0.3.0 (D4) and accepted every new public name of M9 (D9); the reservation above is closed.Date: 2026-10-21
Deciders: the AI assistant, on the author’s behalf (M9b, step docs-freeze-release); the maturity and the names: S M Shovan (2026-10-22)
Builds on: ADR 0023 (the method, the snapshot), ADR 0035 (the freeze enforced against the base branch, the maturity decides the freeze), ADR 0047 (the freeze’s Doxygen rules), ADRs 0048-0059 (triad_count, its engine, its gates, the experimental extension point, Python and the command line).
Context#
triad_count arrived in M9a (ADRs 0052-0057) at maturity experimental, its header tracked by
the API baseline; M9b added experimental::count_local_patterns over its driver (ADR 0058),
dyng.triad_count, dyng.update() over hypergraphs and dyng triad_count (ADR 0059). The
plan’s default D4 freezes the C++ header, the Python module and the command line at the end of
M9b and makes the algorithm stable in 0.3.0, as mosp became stable in 0.2.0. From then on a
change of them is a SemVer matter, so the API is reviewed first, the way ADRs 0023, 0035 and 0047
reviewed the earlier APIs: against the checklist (naming and the verb vocabulary, the uniform
contract of ADR 0006, Doxygen, exception guarantees and dyng::error, host-compilability,
ownership and ABI, the bindings), against its aggregate-delta sibling cycle_count, and against
what the coming work could force to break (0.4: the coarse triangles, the OpenMP tuning, int64
hypergraph offsets, hyper_sssp on the same container).
Reviewed: every public entity of cpp/include/dyng/triad_count.hpp (pattern, to_string,
max_bins, options, stats, result, compute(), update(), and the detail contract the
baseline lists: triad_count_supported_v, update_traits<triad_count::result>, the two
DYNG_TRIAD_COUNT_* messages); the Python module dyng.triad_count (python/dyng/triad_count.py,
python/bindings/triad_count.cpp) with dyng.update() over hypergraphs; the command line
dyng triad_count compute|update (python/dyng/cli/_triad_count.py, docs/api/cli.md); and
docs/algorithms/triad_count.md. Out of scope, as tracked or experimental: <dyng/testing/ triad_reference.hpp>, the triad bins of <dyng/io/result_io.hpp>, generators::legacy:: escher_host_model and the experimental headers dyng/experimental/*.
Findings and what was done#
# |
Area |
Finding |
Resolution |
|---|---|---|---|
1 |
Naming |
The names follow ADR 0004 (clang-tidy’s naming rules pass): |
none needed |
2 |
The verb vocabulary |
|
none needed |
3 |
Contract uniformity with |
The same skeleton: an aggregate |
Accepted |
4 |
Fixed inputs |
|
Accepted (ADR 0035 finding 4) |
5 |
|
The inherited counters are documented in the header ( |
Reworded: for the types 1-3, whose one bin is a sum of contributions (C(|e|, 3), C(a, 2) b c, x y z), the contributions the batch removed / added ( |
6 |
Doxygen |
|
|
7 |
Exceptions leaving the library |
The header documents |
Fixed ( |
8 |
A container defect found by the same test |
Failing a host allocation inside |
Not changed here: the code is |
9 |
Exception guarantees |
|
none needed |
10 |
Host-compilability |
|
none needed |
11 |
Ownership and ABI |
|
Documented on |
12 |
Limits |
Exact 64-bit counts on every backend, |
Accepted: a later release may relax a limit (an api-change with a CHANGELOG entry), never tighten it |
13 |
Composition |
|
Accepted |
14 |
0.4 |
Coarse triangles: new enumerators appended to |
No API change needed |
15 |
Python |
|
|
16 |
Command line |
`dyng triad_count compute |
update |
17 |
Tracked and experimental neighbours |
|
Unchanged; not frozen by this ADR |
Decision#
The triad_count API is frozen as reviewed, with the documentation amendments of findings 5, 6, 11 and 15 and the fix of finding 7: every declaration of
<dyng/triad_count.hpp>(its baseline section, thedetailcontract included), the Python names ofdyng.triad_count(anddyng.update()over adyng.Hypergraph), and the flags and output formats ofdyng triad_count. No signature changed in the review, so the freeze needs no migration note.Maturity. The manifest says
maturity = "stable"(with itsoriginof ESCHER-GPU@abcf9b2 unchanged), soci/api_snapshot.pylistsdyng/triad_count.hppas frozen (ADR 0035 decision 2) andscripts/regen.pywritesstableinto the algorithm tables and the registry. This is the plan’s default D4 and awaits the author’s confirmation at the 0.3.0 release (GOVERNANCE.md, open decisions, next to M8b’s hypergraph item); the 0.3.0 certificate carries triad_count’s full gate record (both ESCHER suites, read again on M9b’s library), as mosp’s did for 0.2.0.The baselines. The C++ baseline
cpp/tests/api/api_snapshot/public_api.txtlists the section[dyng/triad_count.hpp] frozen(ci/docs.sh --update-api); from the merge of M9b, a removed or changed declaration of it failsci/docs.sh(against the baseline) andci/api_check.sh(against the base branch) without theapi-changelabel and a CHANGELOG entry. The Python half has no file of its own:ci/api_check.shruns griffe against the base branch, sodyng.triad_countis checked from the commit that merges it intomain; the tests below pin the same rule now.Both checks fail on a deliberate change (shown on 2026-10-21 in a throwaway clone of this branch, reverted; logs in
$DYNG_SCRATCH/runs/m9b-step3/demo-*.log), and the tests keep it:ci/tests/test_api_snapshot.py::test_the_triad_count_header_is_frozen_and_a_change_is_breaking: the section is frozen, the oracle andresult_io.hpptracked,local_patterns.cuhexperimental; a changed default ofoptions::kind, a removedstats::triads_addedand a changedmax_binsare breaking changes of[dyng/triad_count.hpp];ci/tests/test_api_check.py: a renamed parameter ofdyng.triad_count.update, a changed default ofOptions.kindand a removedResult.totalare breaking changes for griffe;the demonstration itself is recorded under “Outcome” below.
The experimental tier stays unfrozen: a change of
dyng/experimental/local_patterns.cuhis reported byci/api_snapshot.py, never failed (ADR 0058,ci/tests/test_api_snapshot.py:: test_an_experimental_change_is_reported_not_failed).
Outcome#
The deliberate changes (2026-10-21, a throwaway clone of this branch at 155f4ef, the commit
after the freeze, reverted and deleted; logs $DYNG_SCRATCH/runs/m9b-step3/demo-*.log):
C++: the default of
triad_count::compute(..., const options& opt = {})removed:ci/docs.sh --doxygen-onlyexits 1 withapi-snapshot: the public C++ API differs from the baseline (above: - baseline, + headers). - template <typename vertex_t, typename weight_t> [[nodiscard]] result dyng::triad_count::compute(const resources &res, const hypergraph< vertex_t, weight_t > &h, const options &opt={}) + template <typename vertex_t, typename weight_t> [[nodiscard]] result dyng::triad_count::compute(const resources &res, const hypergraph< vertex_t, weight_t > &h, const options &opt)and, with the baseline regenerated (
ci/docs.sh --update-api, as a pull request would),ci/api_check.sh 155f4efexits 1: `breaking change of the frozen API: [dyng/triad_count.hpp]template <…> [[nodiscard]] result dyng::triad_count::compute(…)`.
Python:
dyng.triad_count.update(hypergraph, ...)withhypergraphrenamedhg:ci/api_check.sh 155f4efexits 1 (Parameter was removed,Parameter was added as required).Experimental:
experimental::max_pattern_binschanged from 1024 to 2048:ci/docs.sh --doxygen-onlypasses and reports the changed line of the experimental section, andci/api_check.sh 155f4ef(baseline regenerated) passes: “no breaking change of the frozen C++ API”.Reverted:
ci/api_check.sh 155f4efpasses for both halves, andci/docs.sh --doxygen-onlyreports1244 declarations match public_api.txt.
The gates on the reviewed library. Finding 7 changed the library (b732aa9), so M9a’s gate
records no longer had the release’s library sources (certify.py’s library scope). Every M9a
timing and memory gate was read again on b732aa9 with M9a step 5’s protocol, both suites
passed (45 / 45 and 11 / 11), and the dry 0.3 certificate passes over them
(parity/results/M9b.md section 3).
Consequences#
From 0.3.0 (on the author’s confirmation),
triad_countis covered likesssp,cycle_countandmosp: the algorithm tables, the registry (dyng::algorithms(),dyng.algorithms()) anddocs/algorithms/triad_count.mdsaystable.The pull request of M9b needs the
api-changelabel (a header changes from tracked to frozen) and has its CHANGELOG entry.Open for the author: the container’s OpenMP allocation-failure defect of finding 8, a change of
cpp/src/hypergraphwith its ADR 0024 reading.