feat(vscode): resolve the Rslint core per document and run one Lint runtime per core - #18
Conversation
…untime per core Sync the lint stack to upstream rslint's per-document core resolution (`CoreResolver` + `RuntimeManager`, rslint #1617; `configPath` from #1630 was already in). `WorkspaceRslintCoordinator` — one server per workspace folder — is replaced by one Lint runtime per physical `@rslint/core` (realpath) inside a folder, resolved from each open document's directory and refcounted by the documents using it: the first document to need a core starts its worker + Go process, the last one to close releases it, and a detected folder with nothing open reports `running` / idle. A bridged folder (root `rstack.config.*`) is unchanged: one runtime on rstack's core, document directory ignored, and the shim is part of the runtime key so a native ↔ bridged flip replaces the runtime. Adaptations kept from ADR 0003: the extension host only walks to the core directory (no `@rslint/core` loaded, hence no installation cache), the lint worker takes `--core` per runtime, and resolution failures report through the folder status (last-good runtime kept, no toast). Folder status is the worst of its runtimes plus failed documents, with `disabled` ranked above `running` as in the fmt stack. `rstack.rslint.corePath` stays a full-restart setting; the lint stack watches `node_modules/@rslint/core/package.json` and relies on the shell's detection pass for lockfiles. Tests: upstream's core-resolver (9) and runtime-manager (20) E2E suites replace workspace-coordinator; the monorepo suite gains "root and nested physical core copies run concurrently" (asserting two live runtimes) and the basic suite the incremental UTF-16 emoji case; unit tests cover identity, runtime keys and the status fold. Docs: ADR 0003 consequences, AGENTS.md adaptation 7 and tracked upstream commits, CONTEXT.md terms "Rslint core" / "Lint runtime". Closes #13
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c162cc62c2
ℹ️ 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".
With several runtimes in one folder, a crash reported as "the Rslint language server stopped" did not say which core to look at. The controller now appends the core directory to crashed / version-mismatch states before folding them (the resolver's own messages already carry it).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 459e04c9a2
ℹ️ 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".
A runtime that fails during start is closed before its document's durable failure state is stored, which dropped the core-attributed runtime state. RuntimeManager now hands the resolved core to onDocumentFailure and the controller attributes the stored status to it.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e291900432
ℹ️ 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".
On Windows the resolver reports the temp directory's 8.3 alias while fs.promises.realpath returns the long spelling, so the version-floor test compared the two as text and failed. Compare them as physical identities.
Summary
Sync
stacks/lintto upstream rslint's per-document core resolution (CoreResolver+RuntimeManager, rslint #1617;configPathfrom #1630 was already in).What changes for a user
@rslint/coreinside a workspace folder, resolved from each open document's directory (realpath identity: two same-version copies stay separate, a symlink is the copy it points at). A monorepo folder whose packages carry their own@rslint/corenow runs one worker + Go process per copy instead of linting everything with the folder root's.running/ idle in the status bar.rstack.config.*) are unchanged: one runtime on rstack's core, document directory ignored; the shim is part of the runtime key so a native ↔ bridged flip replaces the runtime.disabled(missingrstack) ranks aboverunningas in the fmt stack.rstack.rslint.corePathkeeps overriding the core hop in both modes and stays a full-restart setting.@rslint/core >= 0.8.0(existing floor) the Go server syncs documents incrementally in UTF-16 — the client had nothing to change; the emoji regression test is ported.Adaptations kept (ADR 0003 /
packages/vscode/AGENTS.md): the extension host only walks to the core directory (no@rslint/coreloaded, so upstream's installation cache is dropped), the lint worker takes--coreper runtime, detection stays the gate, and the lint stack watchesnode_modules/@rslint/core/package.jsonwhile relying on the shell's detection pass for lockfiles.Tests: upstream's core-resolver (9) and runtime-manager (20) E2E suites replace
workspace-coordinator; the monorepo suite gains "root and nested physical core copies run concurrently" (asserting two live runtimes through the exports channel); unit tests cover identity, runtime keys and the status fold. Every intentional deviation from an upstream test is commented in the test.Docs: ADR 0003 consequences, AGENTS.md adaptation 7 + tracked upstream commits (
39536fd6,892482e0), CONTEXT.md terms Rslint core / Lint runtime.Verified locally:
pnpm lint,pnpm test:unit(206),pnpm run fmt:check, and the full lint E2E slice (VSCODE_CLI=1 pnpm --filter ./packages/vscode test:e2e lint: 166 passing, 3 pending by design).Related Links
Closes #13
Checklist