Repository navigation
feat(tests): journey catalog (intent only) + generated JOURNEYS.md (#2338) - #2407
Conversation
Rail R4. The durable record of what Trinity promises, in the words of whoever it is promised to — so coverage debt is QUERYABLE rather than rediscovered in an exploratory sweep six months later. All ten journeys declared, all `built: false`, which is the point of declaring them before any harness exists. TWO RULES, BOTH ENFORCED RATHER THAN DOCUMENTED 1. No status is committed. A `last_green` in git has two futures: a human owns it and it rots, or a bot owns it and every CI run writes a commit — history spam plus merge conflicts on a file everyone edits. Git holds intent, CI holds state. A status-shaped key at ANY depth fails the test. 2. One invariant namespace. Records REFERENCE ids in the orchestration invariant catalog and never restate them, and every id is checked to resolve. A journey whose invariants do not exist yet carries an EMPTY list rather than an invented id — the gap is the information, and #2337 (R3) is what fills it. An id that resolves nowhere reads as coverage that does not exist, which is worse than a blank. Coverage is computed at REPORT time: `generate_journeys_md.py --junit <dir>` reads CI artifacts and joins them to the catalog. Verified against a real downloaded artifact set, not a fixture. A harness with no artifact counts as "no evidence", never as green. The catalog LINKS to tests/registry.json rather than merging with it — the registry indexes tests, the catalog indexes promises. Merging would make every new test file a catalog edit and bury ten promises in a 240 KB index; the generator joins them at report time instead. Both rules are mutation-checked: injecting a `last_green` and an invented `Z-99` invariant fails exactly the three tests that should fail. The validator earned its keep on its first run — it caught the catalog naming J03's harness at a path that only exists on the unmerged #2403 branch. Fixed by correcting the catalog rather than relaxing the check; the field gains the path in the commit that merges it. No workflow change needed: the staleness check rides the unit suite, which already runs on every PR. R3 dependency, handled rather than blocked on: only ids that resolve TODAY are referenced (11 exist), so the catalog is correct now and gains references as R3 adds journey-level invariants. Related to #2338 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Review sweep —
|
obasilakis
left a comment
There was a problem hiding this comment.
Requesting changes on two findings, both in the enforcement layer rather than in the catalog itself.
The catalog is the right artefact and the two hard rules are the right two. What I am flagging is that the code enforcing them has a false-positive landmine, and the registry link the PR advertises does not actually work against the registry's real shape.
Blocking
1. tests/unit/test_2338_journey_catalog.py — _STATUS_KEY_RE matches ordinary words
_STATUS_KEY_RE = re.compile(
r"(last_green|last_run|green|red|passing|failing|status|result|"
r"coverage|pass_rate|last_seen|flaky)",
re.IGNORECASE,
)Unanchored alternation, applied with .search() to every key at every depth. red is a substring of credential and of required.
J06 is "I can give an agent a credential and it can use the tools that credential unlocks." The moment any record gains a credentials: key — or anyone adds a required: field to the schema — test_no_status_field_is_committed fails with a message accusing the author of committing run status. That is a confusing failure on a rule whose whole value is that it fails clearly, and it will land on someone who did nothing wrong.
green has the same shape (evergreen, greenfield), result matches results/resultant. Fix is word boundaries — \b(...)\b — or, better for a fixed vocabulary, match against an explicit key allowlist and drop the substring search entirely.
2. scripts/ci/generate_journeys_md.py:harness_is_indexed — the registry join cannot match
files = data.get("test_files")
if isinstance(files, list):
return any(harness in str(f) or Path(harness).name == Path(str(f)).name
for f in files)tests/registry.json has test_files as a list of dicts, not of strings:
{"file": "unit/test_157_a2a_inbound_server.py", "feature": "ent#157", ...}So str(f) is the repr of a dict and Path(str(f)).name is nonsense. The harness in str(f) arm cannot match either, because of the second half of the problem: registry paths are tests/-relative (unit/test_x.py) while catalog harnesses are repo-relative (tests/journeys/test_first_turn_journey.py).
Consequence: as soon as any journey names a harness, the generated doc will carry the footer "Harnesses not present in tests/registry.json" for every one of them, permanently and wrongly. AC #6 — link to the registry rather than merge with it — is the AC this implements, and the link is currently inert. It is invisible today only because all ten harnesses are null.
Fix is f.get("file") on the dict shape plus one normalisation of the tests/ prefix.
Non-blocking, same function family
3. green_harnesses() — the same prefix mismatch, and it is the one that was never exercised
JUnit file attributes are rootdir-relative, so they will read journeys/test_x.py while render() compares against the catalog's tests/journeys/test_x.py. Every journey would report no evidence forever.
Worth being explicit about why this survived verification: the PR says the generator was verified against a real downloaded artifact set from a green backend-unit-test run. That artifact set contains no journey harness at all, so the run exercised the parse path and never the match path. The verification was real; it just could not reach the code the finding is in.
4. green_harnesses() — an all-skipped harness reports green
bad = any(case.find(t) is not None for t in ("failure", "error"))
seen[f] = seen.get(f, True) and not badskipped is neither, so a file whose every test skipped is recorded as green. J03's harness is precisely the credential-bound one that skips on every PR-triggered run — so the first journey to carry a path is also the first to be misreported. That contradicts the docstring directly above it ("Absence of evidence is not green"), which is right about the missing-artifact case and silent about this one.
5. Nothing wires --junit
No workflow in the diff calls the report form, so the coverage line and everything findings 3 and 4 touch is unreachable today. Fine as staging, but worth saying in the PR body so the next reader does not assume a summary exists somewhere.
What I checked and found fine
- The no-status rule is genuinely enforced at every depth via
_walk_keys, not just at the top level, and both hard rules are mutation-checked as claimed. test_every_invariant_id_resolvesparses the invariant table by row anchor and asserts the parse itself is non-empty first, so a format change fails loudly instead of vacuously passing. That is the right shape and it is the check that would otherwise rot silently.- The empty-list-rather-than-invented-id decision is correct and is the more useful half of the one-namespace rule. Same for keeping the J03 harness
nullwhile #2403 is unmerged — that is the validator doing its job on its own author, which is the best evidence it works. --checkcompares the full rendered body and writes nothing, so the staleness gate cannot mask a drift by fixing it.- Not minting a J11 for "an agent can be restarted" is the right call, and recording the reasoning in the file so it is not re-litigated is worth more than the decision itself.
Verdict
Requesting changes on 1 and 2. Finding 1 is a false positive waiting for J06's own vocabulary; finding 2 makes an advertised AC inert. Both are small, and neither implies anything about the catalog's content, which I have no objection to.
…egistry link could never match (#2338) ## 1. `_STATUS_KEY_RE` matched ordinary words One unanchored alternation, `.search()`ed against every key at every depth — and `red` is a substring of **`credential`** and of **`required`**. J06 is literally *"I can give an agent a credential and it can use the tools that credential unlocks"*, so a `credentials:` key was coming, and the moment it arrived this rule would have failed accusing the author of committing run status. `green` had the same shape (`evergreen`, `greenfield`), `result` matched `results`/`resultant`. Measured on the shipped regex: `credential`, `credentials`, `required`, `evergreen`, `greenfield`, `resultant` and even `hundred` all matched. A rule whose entire value is that it fails CLEARLY cannot afford a false positive landing on someone who did nothing wrong. Word boundaries alone were not the fix: `_` is a word character, so `\bstatus\b` does not match `journey_status` — that spelling would have gone quiet on exactly the keys the rule exists to catch. The key is now split into tokens and matched against a fixed vocabulary, plus an exact-match set for multi-token names whose parts are individually innocent (`last_run`, `pass_rate`). Both directions are now pinned by parametrized cases. ## 2. The registry join could not match (AC #6 was inert) `tests/registry.json` stores `test_files` as a list of **dicts**, so `str(f)` was a dict repr and `Path(str(f)).name` was nonsense. Compounding it, registry paths are tests-relative (`unit/test_x.py`) while catalog harnesses are repo-relative (`tests/journeys/test_x.py`), so even the substring arm could not hit. The generated doc would have carried "Harnesses not present in tests/registry.json" for every journey, permanently and wrongly — invisible today only because all ten harnesses are still `null`. Now reads `test_files[].file` and compares through one shared `_norm_test_path`. ## 3 + 4. `green_harnesses` had the same prefix bug, and called all-skipped green JUnit `file` attributes are rootdir-relative, so they read `journeys/test_x.py` against a catalog holding `tests/journeys/test_x.py` — every journey would have reported `no evidence` forever. Same normalisation fixes it. And `skipped` is neither `failure` nor `error`, so a file whose every case skipped was recorded green. J03's harness is precisely the credential-bound one that skips on every PR-triggered run, so the first journey to carry a path would also have been the first misreported — while the docstring above it said "absence of evidence is not green". It was right about the missing-artifact case and silent about this one; it now states both, and green requires at least one real pass. ## Why these were invisible The review named it exactly: the generator was verified against a real downloaded artifact set, and that set contains no journey harness at all — so the run exercised the PARSE path and never the MATCH path. The verification was real, it just could not reach the code the findings were in. Three tests now drive the match path directly, including the registry join against a genuine `registry.json` entry. Each was mutation-checked: reverting `f.get("file")` and reverting the all-skipped rule each turn the corresponding test red. The committed `docs/testing/JOURNEYS.md` is byte-identical after these changes (every harness is still `null`), and `--check` passes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
All five addressed —
|
Ready for re-review — the requested changes are pushedFlagging state rather than adding findings: the What landed: the status regex now matches by token (the shipped one flagged The fuller response is in the comment above this one. Nothing further is pending from my side. (Disclosure: I wrote the fix commit on this PR, so this note is a status flag — not a self-review and not an approval.) |
obasilakis
left a comment
There was a problem hiding this comment.
/validate-pr re-review — approving. Clearing my earlier CHANGES_REQUESTED.
I re-derived all four findings against the current branch source rather than reading the commit subjects. All four are fixed, and the first one is fixed better than the word-boundary patch I suggested.
1. The status-key rule false-firing on credential — fixed by tokenising
I suggested \b(...)\b. What landed is a token split plus an explicit multi-token key set:
_STATUS_TOKENS = frozenset({"green", "red", "passing", "failing", "status",
"result", "results", "coverage", "flaky"})
_STATUS_KEYS = frozenset({"last_green", "last_run", "last_seen", "pass_rate", "passrate"})with the comment noting that \bstatus\b would not have matched journey_status — so the word-boundary fix I proposed would have gone quiet on the exact keys the rule exists to catch, while fixing the false positive. That is a genuine correction to my finding, not just a compliance with it. credential and required are single tokens and no longer match; journey_status and last_green still do.
2. The registry join — fixed on both halves
harness_is_indexed now reads f.get("file") off the dict shape and compares through _norm_test_path, so the tests/-relative-vs-repo-relative mismatch is gone too. The dict-vs-list branch also tolerates a mapping shape. AC #6's link is live rather than inert, and the generated doc will stop claiming every harness is missing from the registry the moment one carries a path.
3. The JUnit prefix mismatch — fixed
green_harnesses normalises through the same _norm_test_path, so rootdir-relative JUnit file attributes match repo-relative catalog harnesses. This is the one that had never been exercised — the verification artifact set contained no journey harness, so the run reached the parse path and not the match path — and it is now correct by construction rather than by luck.
4. All-skipped reporting green — fixed, and the docstring now says both shapes
skipped = case.find("skipped") is not None
seen[f] = seen.get(f, True) and not bad
if not bad and not skipped:
passed.add(f)
return {f for f, ok in seen.items() if ok and f in passed}Requiring at least one genuinely passing case is the right rule, and the docstring now states both shapes of "absence of evidence is not green" instead of the one. J03's credential-bound harness — the first journey to carry a path and the one that skips on every PR-triggered run — would have been the first misreported, so this mattered more than its size suggests.
The catalog itself I had no findings on and still don't. The two hard rules are the right two, and enforcing them rather than documenting them is what makes the file worth committing. Declaring all ten journeys built: false is the point rather than an embarrassment — coverage debt you can query beats coverage debt you rediscover in a sweep six months later. Carrying an empty invariants list rather than an invented id is the same discipline: an id that resolves nowhere reads as coverage that does not exist, which is worse than a blank.
Checklist: base dev, #2338 resolves with correct labels, security scan clean, no packaging, schema or backend surface, generated JOURNEYS.md committed alongside its generator. CI green.
One process note, non-blocking: the PR references #2338 without a closing keyword, so issue-status-on-merge.yml will not promote it to status-in-dev on merge. Rephrasing to Closes #2338 before merge would save /groom a cleanup pass.
Summary
Rail R4.
tests/journeys/catalog.yaml— the durable record of what Trinity promises, in the words of whoever it is promised to — plus a generateddocs/testing/JOURNEYS.md.All ten journeys (J01–J10, #2340–#2349) declared, all
built: false. That is the point: the list exists so coverage debt is queryable rather than rediscovered in an exploratory sweep six months later.The two hard rules are enforced, not documented
1. No status is committed. A
last_greenin git has exactly two futures — a human owns it and it rots, or a bot owns it and every CI run writes a commit (history spam plus merge conflicts on a file everybody edits). Git holds intent; CI holds state. A status-shaped key at any depth fails the test.2. One invariant namespace. Records reference ids in
docs/testing/orchestration-invariant-catalog.mdand never restate them, and every id is checked to resolve. A journey whose invariants don't exist yet carries an empty list rather than an invented id — the gap is the information, and #2337 (R3) is what fills it. An id that resolves nowhere reads as coverage that does not exist, which is worse than a blank.Both are mutation-checked: injecting a
last_greenand an inventedZ-99fails exactly the three tests that should fail, and restoring returns 11/11.Coverage is computed at report time
Verified against a real downloaded artifact set from a green
backend-unit-testrun, not a fixture. A harness with no artifact counts as "no evidence", never as green — absence of evidence isn't a pass.The catalog links to
tests/registry.jsonrather than merging with it: the registry indexes tests, the catalog indexes promises. Merging would make every new test file a catalog edit and bury ten promises in a 240 KB index; the generator joins them at report time instead.The validator earned its keep on its first run
It caught the catalog naming J03's harness at
tests/journeys/test_first_turn_journey.py— a path that only exists on the unmerged #2403 branch. Fixed by correcting the catalog, not by relaxing the check; the field gains the path in the commit that merges it. That is the same failure mode as an invented invariant id, one field over.On the R3 dependency — handled, not blocked
R4 declares a dependency on R3 for invariant ids. Rather than stall, the catalog references only the 11 ids that resolve today and leaves the rest empty. So it is correct as of this commit and gains references as R3 lands — which is exactly the
built: falsephilosophy applied one level down.One judgement recorded
The agent-lifecycle journey #2403 ships is not a journey of its own; it is J03's first half. Minting a "J11: an agent can be restarted" would turn the catalog from a list of promises into a list of steps — nobody asks for a restart, they ask for a useful answer. Noted in the file so the next person doesn't re-litigate it.
Test Plan
tests/unit/test_2338_journey_catalog.py— 11 tests: no committed status (any depth), J01–J10 present and ordered, required fields, promises phrased in the actor's voice, lanes defined, every invariant id resolves, harness paths exist in both built and unbuilt states, registry linked not merged,JOURNEYS.mdnot stale, committed doc carries no statusRelated to #2338
Staging note —
--junitis not wired anywhere yet (review finding 5)Nothing in this PR, or in any workflow, calls the generator's report form. So
the coverage line and the whole
green_harnessespath — including the twofindings fixed in it — are unreachable in CI today. That is deliberate
staging, not an oversight: the catalog and the staleness gate stand on their
own, and the report form activates when a workflow starts passing
--junitata directory of downloaded artifacts. Said out loud so the next reader does not
go looking for a summary that does not exist yet.