Skip to content

Carry option_skip, and make test item ids stable - #255

Merged
davidanthoff merged 2 commits into
mainfrom
s1-discovery
Aug 14, 2026
Merged

Carry option_skip, and make test item ids stable#255
davidanthoff merged 2 commits into
mainfrom
s1-discovery

Conversation

@davidanthoff

Copy link
Copy Markdown
Member

Part of stream S1 (Discovery) of the ReTestItems feature-delta plan — A.2 and A.10 items 2 and 5.

Depends on julia-testitems/TestItemDetection.jl#35 (which produces option_skip) and julia-testitems/TestItems.jl#40 (docstring).

⚠️ Breaking: the test item id format changes

derived_testitems used to generate "$uri:$i" — an absolute URI plus a positional index. Inserting a test item renumbered every item below it, and the absolute path meant a dev checkout and a CI runner disagreed on the id for the same test.

Ids are now "<relpath>::<label>":

  • relpath is the file's path relative to its package root (already resolved via derived_package_for_file), normalized to / separators so Windows and Linux agree.
  • label is the test item name.
  • Readable rather than hashed, per A.2: it surfaces in JUnit output where a human reads it, and it makes --filter and rerun-by-id usable by hand.

Per the plan's "one id, not two" decision, this replaces the positional id rather than adding a second field. Stable ids are strictly better for VS Code too: they preserve expansion and selection state across re-parses, which positional ids lose whenever an item is inserted above.

Error-detail ids ("$uri:error$i") are unchanged — they are not persisted or addressed from outside.

Duplicate labels get a counter and an error

Both, not either:

  • Every occurrence of a duplicated label is suffixed #1, #2, … — including the first, so the error state is visible in the id itself and each item stays individually addressable (which is what lets VS Code show all of them).
  • A definition error goes out through the existing testerrors channel, so the editor shows a squiggle and the extension can render an error node.
  • Duplicate @testmodule / @testsnippet names get the same definition error (they collide by name in setup=[...]). This was cheap, so it is included.

Resolving a duplicate renumbers its siblings. Duplicate labels are a transient error state; perfect stability there is not worth hashing the body.

option_skip

TestItemDetail gains option_skip::Union{Bool,String} — a literal true/false, or the source text of an expression, sliced out of text_file.content.content exactly like code is. The expression is evaluated in the test process just before the item would run, which is why it travels as text rather than being resolved here.

Parentheses are trivia to JuliaSyntax, so skip=(VERSION < v"1.11") yields VERSION < v"1.11". Whoever splices this into generated code should parenthesize it.

Downstream consumers needing a lockstep update

The id format change is breaking. These must be updated before the new stack ships:

  1. The VS Code extension — test item ids, and any state persisted keyed by them (expansion/selection state, last-run results). Ids are now stable across edits, so state that used to be lost on every insertion now survives.
  2. src/json_protocol.jl in TestItemControllers — ids cross the JSONRPC boundary; the wire schema also needs the new option_skip field once execution lands (stream S2).
  3. JuliaMCPjulia_run_testitems and julia_get_testitem_detail take test item ids as parameters (src/mcp_tools.jl). No schema change, but every cached/quoted id changes shape, and agent-facing docs that show example ids should be refreshed. Readable ids make these tools materially nicer to drive by hand.

Ids also appear in --filter expressions and rerun flows, which get better with readable ids.

Testing

Via the MCP julia_run_testitems tools against a worktree with the TestItemDetection PR Pkg.developed in:

  • test/test_testitems.jl: 34/34 passing (26 existing + 8 new)
  • full JuliaWorkspaces suite: 1060/1060 passing

New test items cover: skip default / literal / expression, ids being package-relative and label-based, ids being invariant under inserting an item above, duplicate labels producing #N ids plus definition errors, and duplicate setup names producing definition errors.

🤖 Generated with Claude Code

davidanthoff and others added 2 commits August 13, 2026 16:09
Two changes to the test item discovery layer.

`TestItemDetail` gains `option_skip::Union{Bool,String}`: a literal
`true`/`false`, or the source text of an expression that the test process
evaluates just before the item would run. The expression text is sliced out of
the file content the same way `code` is.

Test item ids change from the positional `"$uri:$i"` to
`"<relpath>::<label>"`, where relpath is the file's path relative to its
package root, normalized to `/` separators so Windows and Linux agree on the
same id. Positional ids renumber every item below an insertion, which is
invisible today but breaks the moment ids are persisted (JUnit output, flake
history, failures-first ordering) — and readable ids are also nicer in
`--filter` expressions and rerun-by-id flows.

A label used more than once in one file now gets both a `#N` suffix on
*every* occurrence — so ids stay unique, each item stays individually
addressable, and the error state is visible in the id itself — and a
definition error through the existing `testerrors` channel, so the editor
shows a squiggle and the extension can render an error node. Duplicate
`@testmodule`/`@testsnippet` names get the same definition error.

This is a breaking change to the id format. Downstream consumers needing a
lockstep update are listed in the PR body.

Part of stream S1 (Discovery) of the ReTestItems feature-delta plan
(A.2, A.10 items 2 and 5).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`derived_testitems` reads `option_skip`, which TestItemDetection only
returns from v1.2.0 onwards.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@davidanthoff
davidanthoff marked this pull request as ready for review August 14, 2026 00:00
@davidanthoff
davidanthoff merged commit 4134f04 into main Aug 14, 2026
9 of 23 checks passed
@davidanthoff
davidanthoff deleted the s1-discovery branch August 14, 2026 00:00
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