test(core): add native watcher command reload test - #39216
Merged
Conversation
kitlangton
force-pushed
the
command-watch-test
branch
from
July 28, 2026 00:57
5cfa3ce to
078e4a4
Compare
5 tasks
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.
What
Adds the end-to-end native watcher integration test for command reload — the last unmet acceptance criterion on #37429. A real markdown file write must reach the live command registry through the full production chain: parcel native watcher → Config's watch topology →
config.changes()→isCommandSourcefilter → debounced reload →Command.Event.Updated.The merged reload work (#39160, #39171, #39174, and the agent equivalent) is covered by deterministic tests that drive a mocked change feed (
Config.testLayer+emitChange); none of them prove Config's real watch reconciliation actually observes command directories. The issue's original repro was a real Vim:saveas, so the end-to-end proof is the point.Closes #37429.
How
packages/core/test/config/command.test.ts: newdescribeNativeblock (gated onWatcher.hasNativeBinding() && !process.env.CI, matching the existing live watcher suites) building the realCommand + Config + Bus + FSUtilnode graph with the default nativeWatcher— no watcher replacement. Covers create and edit, each awaited through aCommand.Event.Updatedbus barrier.watchReadyhelper: native directory watches start asynchronously, so the test probes the global config root with unrelated files untilconfig.changes()delivers, guaranteeing later command edits cannot be missed. Probe files don't matchisCommandSourceand don't change the discovered config, so they cause no spurious reloads.packages/core/test/fixture/config-nodes.ts:emptyCredentialNode/emptyWellknownNodestubs extracted fromconfig.test.ts(now shared by both test files).Scope
Testing
From
packages/core:bun run test test/config/command.test.ts— 8/8, including the new native test; the native test passed 5/5 consecutive runs.bun run test test/config/config.test.ts— 27/27 (fixture extraction).bun typecheck— clean.Flow
sequenceDiagram participant T as Test participant FS as Real filesystem participant W as Parcel watcher participant C as Config participant P as ConfigCommandPlugin participant R as Command registry T->>FS: probe writes until watch is live W-->>C: probe event → changes() delivers (ready) T->>FS: write commands/review.md W-->>C: native event C-->>P: changes() → isCommandSource → debounce P->>R: reload R-->>T: Command.Event.Updated (read barrier) T->>R: get("review") → "Review native"