Skip to content

fix(vscode): decide lint ownership per document - #90

Merged
fi3ework merged 3 commits into
mainfrom
fix/lint-document-ownership
Oct 9, 2026
Merged

fi3ework merged 3 commits into
mainfrom
fix/lint-document-ownership

Conversation

@fi3ework

@fi3ework fi3ework commented Oct 9, 2026

Copy link
Copy Markdown
Member

Summary

A workspace folder's lint mode was decided once for the whole folder: any rslint.config.* anywhere in it made every document native, so a root rstack.config.* with define.lint() stopped linting as soon as one subdirectory added its own config. Files outside that subdirectory were handed to the native Go server, fell outside every config boundary, and silently got zero diagnostics while the status bar still said running.

The constraint behind the old rule is per process (Rslint locks its config choice for a server's lifetime), not per folder, and since the per-core runtime split one folder already hosts several runtimes keyed on folder + core + shim. This PR moves ownership to the document's ancestor chain:

  1. Nearest rslint.config.* between the document and the folder root → native
  2. Otherwise a root rstack.config.* → bridged (unchanged resolution: rstack → @rslint/core, shim pinned)
  3. Otherwise the nearest rslint.config.* above the folder (fix(vscode): detect rslint configs above the workspace folder #89 rule) → native
  4. Otherwise the document is not served — matching the rslint CLI, which lints no file outside every config boundary

Sibling and descendant configs never count. A root rslint.config.* beside a root rstack.config.* still makes every document native.

Changes:

  • resolution.ts: decideDocumentMode (pure, unit-tested) replaces decideRslintMode; StackDetection.mode removed, detection only collects signals
  • RuntimeManager: folderMode(folder) → documentMode(document); CoreResolver, worker, Rslint.ts, router untouched (comment-only edit in CoreResolver.ts)
  • ADR 0006 supersedes ADR 0003's "ownership is per folder, native wins"; CONTEXT.md, packages/vscode/AGENTS.md, README updated
  • New E2E suite suite-document-ownership: root document reports the Rstack rule, nested document the native rule, two runtimes in one folder; creating a second nested rslint.config.ts while both are open migrates only the documents under it and the bridged runtime stays running throughout

Known divergence, recorded in the ADR: rs lint run at the folder root lints nested files with the root config; the editor lints them with the nearest rslint.config.*. The editor cannot match both CLIs; the nearest config matches the one a user would run in that directory.

Verified: pnpm lint && pnpm test:unit green; VSCODE_CLI=1 pnpm test:e2e lint and the vscode slice exit 0.

Related Links

Closes #85

Checklist

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

A workspace folder's lint mode was decided once for the whole folder: any
`rslint.config.*` anywhere in it made every document native, so a root
`rstack.config.*` with `define.lint()` stopped linting as soon as one
subdirectory added its own config, and the files outside that subdirectory
silently lost all diagnostics while the status bar still said `running`.

Rslint locks the config choice per process, not per folder, and since the
per-core runtime split one folder can already host several runtimes. Ownership
now follows each document's ancestor chain: the nearest `rslint.config.*`
between the document and the folder root wins, otherwise a root
`rstack.config.*` bridges the document, otherwise the nearest config above the
folder, otherwise the document is not served — matching the `rslint` CLI, which
lints no file outside every config boundary. Sibling and descendant configs
never count. `StackDetection.mode` is gone; `RuntimeManager` asks
`documentMode(document)` instead of `folderMode(folder)`.

ADR 0006 supersedes ADR 0003's "ownership is per folder, native wins"; the new
`document-ownership` E2E suite covers two runtimes of both modes in one folder
and a nested config created while both are serving.

Closes #85
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 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-10-09T11:20:58.038177Z 5867675 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: bb5e0b91c1

ℹ️ 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/e2e/lint/fixtures/document-ownership/package.json Outdated
`decideDocumentMode` treated the folder's native configs, the root Rstack
config and the config above the folder as three inputs with three stops. They
are all directories on the document's ancestor chain, so the walk now visits
each directory once and the nearest config wins, with a native config beating
the Rstack config in the same directory. `folderRoot` and `ancestorConfigPath`
disappear from the signals; the caller merges the ancestor config into
`nativeConfigPaths`.

ADR 0006 now states that ADR 0003's "folder" was the workspace folder, a
narrower unit than the rule it meant to express.
@fi3ework
fi3ework enabled auto-merge (squash) October 9, 2026 11:21
@fi3ework
fi3ework merged commit e5f4ffd into main Oct 9, 2026
3 checks passed
@fi3ework
fi3ework deleted the fix/lint-document-ownership branch October 9, 2026 11:28
@fi3ework fi3ework mentioned this pull request Oct 9, 2026
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.

Nested Rslint config disables the root Rstack lint configuration

1 participant