[Bug] A subscribe entry with a mistyped key is accepted and silently becomes "every file"
Description
subscribe: entries ignore keys they do not know. If someone writes path: instead of paths:, the entry becomes {kind: "file.changed"} with no filter, so the daemon starts a run on every file change in the project.
Environment
- OS: Windows 11 Home 10.0.26300
- Node version: v22.22.3
- Nanocoder version: 1.32.0 (built from main at 5df35b3a)
- Provider: Not provider-specific
- Model: Not model-specific
Steps to Reproduce
-
Create a command file:
--- description: d subscribe: - kind: file.changed path: "docs/**" --- Body -
Run
parseCommandFile(file)and look atresult.subscribe.
Expected Behavior
The entry is rejected with a message such as subscribe[0]: unknown key "path" (did you mean "paths"?), and the file loads without triggers, like other invalid blocks.
Actual Behavior
subscribe: [{"kind":"file.changed"}]
No message is shown.
Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate
- [x] I can reproduce this issue consistently
- [x] This issue occurs with the latest version of nanocoder (main)
Suggested fix:
source/skills/parse-subscribe.ts:79(parseTrigger) and the per-kind functions (parseFileChangedat line 137, and the others): list the allowed keys per kind and throwSubscribeParseErrorfor any other key. The caller already logs it and loads the file without triggers.- Check
source/skills/manifest-parser.tsfor the bundlesubscribe:block. - Add tests for each kind with an unknown key.
Root cause: parseTrigger in source/skills/parse-subscribe.ts only reads the keys it knows, so a typo such as path: instead of paths: is dropped without a message. The entry then becomes {kind: "file.changed"}, which the event router treats as "every file".
Proposal: add an allowed-keys list per trigger kind (the common fields plus each kind's own) and throw SubscribeParseError on any other key, with a "did you mean" hint when it is close to a known one. The caller already logs that error and loads the file without triggers. I would also check the bundle subscribe: block in manifest-parser.ts, and add one test per kind with an unknown key.
I'd like to take this one. Could you assign it to me or confirm, per CONTRIBUTING, before I open a PR?
This comment was drafted with the help of an AI assistant (Claude).
Assigned @pcbeingused333, go ahead.