Carry option_skip, and make test item ids stable - #255
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).derived_testitemsused 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>":derived_package_for_file), normalized to/separators so Windows and Linux agree.--filterand 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:
#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).testerrorschannel, so the editor shows a squiggle and the extension can render an error node.@testmodule/@testsnippetnames get the same definition error (they collide by name insetup=[...]). 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_skipTestItemDetailgainsoption_skip::Union{Bool,String}— a literaltrue/false, or the source text of an expression, sliced out oftext_file.content.contentexactly likecodeis. 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")yieldsVERSION < 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:
src/json_protocol.jlin TestItemControllers — ids cross the JSONRPC boundary; the wire schema also needs the newoption_skipfield once execution lands (stream S2).julia_run_testitemsandjulia_get_testitem_detailtake 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
--filterexpressions and rerun flows, which get better with readable ids.Testing
Via the MCP
julia_run_testitemstools against a worktree with the TestItemDetection PRPkg.developed in:test/test_testitems.jl: 34/34 passing (26 existing + 8 new)New test items cover:
skipdefault / literal / expression, ids being package-relative and label-based, ids being invariant under inserting an item above, duplicate labels producing#Nids plus definition errors, and duplicate setup names producing definition errors.🤖 Generated with Claude Code