Skip to content

Prove the root query surface on selections that return rows - #5170

Merged
Sinity merged 1 commit into
masterfrom
cli-golden-nonempty
Sep 14, 2026
Merged

Sinity merged 1 commit into
masterfrom
cli-golden-nonempty

Conversation

@Sinity

@Sinity Sinity commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Summary

Commits the non-empty golden harness I built for the CLI unification migration and cited as evidence in #5156, #5157 and #5158, so the next steps can re-run it instead of re-deriving it. Adds a TESTING.md pointer to both harnesses.

What gap this closes

scripts/golden_find_bytes.py replays every documented polylogue find invocation in docs/cli-reference.md. That is the right acceptance evidence for "the documented surface did not change", and it is weaker than it looks on its own.

On the seeded cli-mixed corpus, the documented examples that exercise the interesting code paths land on empty selections. The aggregate examples (analyze count, analyze by ...) and the id:-scoped examples all match nothing. A change can therefore pass 37/37 documented goldens without a single aggregate row, ranked hit, page boundary or attached-unit projection ever being rendered — so aggregates, projections, --sample and --latest need non-empty coverage before the documented set proves anything about them.

That is not a hypothesis. Measured on this branch, by perturbing the list envelope to report "total": 0 on every page:

harness invocations differing
golden_find_bytes.py (documented) 37 0
golden_nonempty_bytes.py (this PR) 22 2

A regression that zeroes the total on every list page is completely invisible to the documented set.

Solution

scripts/golden_nonempty_bytes.py, a companion built on the same machinery — same immutable seeded workload, same frozen clock, same in-process Runner, same recorded shape (exit code + exact stdout/stderr bytes). The two are one pair.

Its 22 cases are hand-picked, not extracted, and that is the point: the documentation does not contain invocations that return rows, which is the gap itself. Each case names one thing the documented set leaves unproven:

  • list pages in all five output formats (markdown/json/ndjson/csv/yaml) — the row renderer's per-format branches
  • --limit and --limit+--offset — page boundary, total, next_offset
  • --fields — row projection
  • analyze count, analyze by origin, analyze by day — aggregate envelopes with rows in them, text and JSON
  • a ranked search in text, JSON and CSV — hit rows, ranks, snippets
  • --origin — a filter that actually narrows
  • --sort / --sort --reverse — ordering
  • messages where role:assistant — the unit-row renderer
  • --sample — the sampling window
  • with messages — the attached-unit projection fold

17 of the 22 return rows; the rest exercise formats or filters that legitimately come back empty and still pin their bytes.

The CASES tuple is documented as append-only where possible: removing a case removes coverage, and the keys are the comparison identity.

Usage

Deliberately the same shape as S3's harness, so a migration step runs both:

uv run python scripts/golden_find_bytes.py BEFORE.json
uv run python scripts/golden_nonempty_bytes.py BEFORE-NONEMPTY.json
# ... make the change ...
uv run python scripts/golden_find_bytes.py AFTER.json
uv run python scripts/golden_nonempty_bytes.py AFTER-NONEMPTY.json --compare BEFORE-NONEMPTY.json

--compare is the one thing the documented harness does not provide, and it exists because I needed it three times: it exits nonzero when any case changed and normalizes the three authority fields that vary per run on an unmodified checkout — run_id (a fresh UUID), generation_id (carries the archive clone's inode) and archive_epoch (derived from it). Everything else is compared byte-for-byte. Without that normalization one case (find messages where role:assistant --format json) reports a false difference on every run.

Verification

uv run python scripts/golden_nonempty_bytes.py A.json
  wrote 22 cases (17 exit 0 with output)

uv run python scripts/golden_nonempty_bytes.py B.json --compare A.json
  22 compared, 0 differing, 0 changed overall        exit=0

Anti-vacuity, run as described above: with "total": 0 forced into the list envelope, --compare reports 22 compared, 2 differing and exits 1, while the documented harness reports 0 differing across all 37. The perturbation was reverted and the clean compare re-confirmed at exit=0 before committing.

devtools verify --quick     → exit 0, all 17 gates ok
devtools gate layering      → exit 0, 0 violations, 273 baseline entries (unchanged)
devtools render all --check → exit 0, grep "out of sync": 0 hits
devtools schema closure scripts/golden_nonempty_bytes.py → out

No product code is touched: the diff is one new script plus a TESTING.md section. Nothing from #5156/#5157/#5158 is folded in — this branch is cut from master at 890a2921e.

Note on discoverability

Neither harness was referenced in any tracked document before this PR. That is the actual reason the companion was re-derived by hand rather than re-run: there was nowhere to find it. The new TESTING.md section documents both, states that the pair is not optional, and gives the "total": 0 example as the concrete reason.

Residuals

  • The cases are pinned to the cli-mixed workload. A workload change re-bases every golden; that is inherited from the documented harness and is why both record the workload name in their output.
  • golden_find_bytes.py still records only — it has no --compare, so its consumers diff by hand. I did not add one here to keep this PR to the gap the coordinator named; lifting --compare into a shared helper is a reasonable follow-up.
  • The companion covers the root query surface only. read views, continue and the mutation ceremony have no golden-bytes coverage in either harness.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK

`scripts/golden_find_bytes.py` replays every documented `polylogue find`
invocation and is the right acceptance evidence for "the documented surface did
not change". On its own it is weaker than it looks: on the seeded `cli-mixed`
corpus the documented aggregate examples (`analyze count`, `analyze by ...`)
and the `id:`-scoped examples all match nothing, so a change can pass 37/37
without one aggregate row, ranked hit, page boundary or attached-unit
projection ever being rendered.

Measured, not asserted: zeroing `total` on every list page leaves all 37
documented goldens byte-identical, and is caught by 2 of the 22 cases here.

`scripts/golden_nonempty_bytes.py` is the companion, built for the CLI
unification migration (S4/S6/S7) and committed so S5 and S8-S12 can re-run the
same evidence. Its cases are hand-picked rather than extracted, because the
documentation does not contain them -- that absence is the gap. Each names one
thing the documented set leaves unproven: list pages in all five output
formats, `--limit`/`--offset` boundaries, `--fields` projection, aggregates
with rows in them, ranked search in three formats, a narrowing `--origin`,
`--sort`/`--reverse`, a `messages where` unit query, `--sample`, and the
`with messages` attached-unit fold. 17 of the 22 return rows.

It reuses the documented harness's seeded workload, frozen clock and runner, so
the two are one pair. `--compare` exits nonzero when any case changed and
normalizes the three authority fields (`run_id`, `generation_id`,
`archive_epoch`) that vary per run on an unmodified checkout.

TESTING.md now points at both. Neither was referenced in any document before,
which is why the companion was re-derived by hand rather than re-run.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 52 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 3be61f7f-7b5c-4c84-a570-b246df3d3e00

📥 Commits

Reviewing files that changed from the base of the PR and between 4363ea7 and 9579280.

📒 Files selected for processing (2)
  • TESTING.md
  • scripts/golden_nonempty_bytes.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-14T23:21:54.936193Z 9579280 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Sinity
Sinity merged commit 4692295 into master Sep 14, 2026
3 checks passed
@Sinity
Sinity deleted the cli-golden-nonempty branch September 14, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant