Skip to content

Check, code-block and page ids move between runs, so agent.json ids and gallery deep links are not stable #123

Description

@sotashimozono

CLAUDE.md declares agent.json a contract. Three id schemes in the test-report path are order- or line-dependent, so the contract identifiers are not stable across runs.

Check ids are a global emission counter. src/testset.jl:1283-1284:

counter[] += 1
chk.id = Symbol("t", counter[])

Assigned in document-walk order across the whole report. Add one @test to the first test file and every subsequent check in every subsequent file is renumbered. _benchmark_verdict (src/document.jl:236) emits failed:["t47"] into agent.json. Under shards the order additionally depends on the merge order at :1494 (reduce(vcat, r.children for r in roots)), i.e. on the order readdir returned the dump files.

Code-block ids are keyed on line numbers. src/testset.jl:366-368:

Symbol("code_", slug(basename(file)), "_", lo, "_", hi)

Inserting a blank line at the top of a test file changes every code artifact id and anchor in that file, changes every Check.code_anchor referencing them, and invalidates the render cache for the whole file. Gallery deep links break on any commit that shifts lines.

Page-id disambiguation is first-seen order. _unique_id! (src/testset.jl:1149) resolves a collision as base-2, base-3. _slug is flat (:167), so a/util.jl and b/util.jl collide; which one becomes util_jl and which util_jl-2 depends on shard and merge order, so the generated HTML filenames swap between CI runs.

Fix

Derive check ids from something stable -- the file, the enclosing testset path and an index within it -- rather than a global counter; key code blocks on content or a declared name rather than a line span; and make page-id disambiguation deterministic in the source path, not in arrival order.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtest-reportThe Test -> Pinax bridge (experimental)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions