Skip to content

fix(vscode): let the deepest root own an overlapping test file - #60

Open
fi3ework wants to merge 11 commits into
mainfrom
worktree-inherited-orbiting-book
Open

fi3ework wants to merge 11 commits into
mainfrom
worktree-inherited-orbiting-book

Conversation

@fi3ework

Copy link
Copy Markdown
Member

Summary

A root rstack.config.* without define.test() still becomes a bridged Rstest project (rstack's shim returns {}, which matches what rs test does), and its default include also matches every nested native project's tests. The same test file was published under both projects, VS Code merged the two items into one gutter button, and one click ran both copies: the root copy failed (no nested plugins or aliases) and the nested copy passed.

This PR makes the project with the deepest normalized root own an overlapping test file:

  • Among active projects whose include/exclude match a file, the one with the deepest normalized root publishes and runs it. Equal roots keep all contenders. Explicit projects aggregation (projectCoverage) still runs first.
  • The rule is a pure computeFileOwnership in projectCoverage.ts, computed once per refresh in WorkspaceManager, and applied at publication (buildTree) plus the per-file resolve gate in updateOrCreateFile. An ownership change re-publishes without re-globbing or restarting the watcher.
  • A non-owner keeps a cheap map entry for the file and stays a live project even with zero files.
  • The watcher's create/change handlers are merged into one path shared with the ownership re-publish.

Behavior that does not change: rs test / CLI semantics, project-level Run All (still uses each project's own config), the lint and fmt stacks.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

A root `rstack.config.*` without `define.test()` still becomes a bridged
Rstest project (rstack's shim returns `{}`, matching `rs test`), and its
default `include` also matches every nested native project's tests. The
same test file was published twice, VS Code merged both items into one
gutter button, and one click ran both copies: the root copy failed
(no nested plugins/aliases), the nested copy passed.

Among active projects that include a file, the one with the deepest
normalized root now owns it; equal roots keep all, explicit `projects`
aggregation still runs first. The rule is a pure function computed once
per refresh in `WorkspaceManager` and applied at publication, so an
ownership change re-publishes without re-globbing or restarting the
watcher. Non-owners keep a cheap map entry and stay live projects.

Covered by pure unit tests for the rule, two integration tests for the
late-load and config-removal transitions, and an E2E fixture that mirrors
the reported layout.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 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
📝 Code Review Completed 2026-09-16T10:04:28.493876Z c5c62e5 New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4725bd88e

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/project.ts
Project-level Run All keeps the CLI scope: the worker runs every file its
own config collects, including files another project publishes. Results
for such a hidden file used to be dropped because the project holds no
TestItem for it, so a failing file left the project green.

The reporter now attaches a hidden file's failure to the project's own
TestItem, naming the file and its errors; hidden passes stay silent.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d94254b692

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/projectCoverage.ts
On Windows `normalizePath` lowercases the whole path, so the relative path
handed to the include/exclude matchers no longer matched a mixed-case
pattern such as `Tests/**`. Containment and depth keep using the
normalized paths; the glob-relative path now comes from the original
casing.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 12282cb1a2

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/testRunReporter.ts Outdated
Comment thread packages/vscode/AGENTS.md Outdated
…ation 10

Hidden non-owner failures reported on the project node now also go into
the error store, so "Copy Test Item Errors" on that node finds them; the
store is cleared when the project's next run starts.

AGENTS.md lists test file ownership as the tenth upstream divergence so a
future sync keeps it, and the gotcha keeps only the rationale.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b579ff5bc7

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/project.ts Outdated
A file this project had already resolved kept its case tree and
`didResolve` after losing ownership, so the non-owner entry was a full
duplicate and would never re-resolve if ownership came back. Demotion now
clears the cached cases and resets the flag.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65b2f29b0d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/project.ts
An AST read started before a file lost ownership could finish afterwards
and repopulate the hidden entry. `updateFromDisk` now resolves only after
the contents are applied, and the AST resolver re-runs the non-owner
demotion when the read settles, matching what the runtime path already
did through `updateOrCreateFile`.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 592af0952f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/project.ts
Comment thread packages/vscode/src/stacks/test/project.ts Outdated
…emotion

`TestFile` now carries a resolve generation: every resolve start,
runtime list and demotion bumps it, and an older in-flight read or
listTests result is discarded when it settles after a newer one. This
replaces the post-read ownership re-check and also covers the
lose-then-regain case where the old predicate check let a stale read
overwrite a fresh one.

Demotion also clears the project's stored diagnostics for that file, so
an error recorded while the project still owned the file does not linger
in the Problems panel after ownership moves.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ff0cd55ebf

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/project.ts Outdated
Bridged projects in one folder share the shim path used as `-c`, so
`configFilePath` was not a unique diagnostics key and one project's
run-start or demotion clear could wipe a sibling's diagnostics. The key
is now the project's own source config URI, derived in one getter.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f0970fcdda

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/project.ts Outdated
Comment thread packages/vscode/src/stacks/test/testRunReporter.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8fb323b4b2

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/testRunReporter.ts Outdated
Comment thread packages/vscode/src/stacks/test/diagnostics.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 805db0a366

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/vscode/src/stacks/test/testRunReporter.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5c62e5aa6

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// only update test file result when explicit run itself or parent
if (this.path.length) return;

if (this.isHiddenFile(test.testPath)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recover hidden failures produced by folder runs

When a shallow project has a visible TestFolder spanning a directory that also contains a deeper project's hidden file, index.ts:463-467 passes the directory as fileFilter, so the shallow CLI run can still execute that hidden file. This branch stores a failure on the project item, but rerunning the same folder after the file passes returns without clearing the stored error or marking the project passed because recovery is gated on projectWide; the project remains red and “Copy Test Errors” stays stale until a full-project run. Fresh evidence beyond the earlier projectWide-gating thread is that the partial folder run can itself create the hidden failure, so that same scope must be able to recover its result.

AGENTS.md reference: packages/vscode/AGENTS.md:L26-L26

Useful? React with 👍 / 👎.

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