Bind the preflight scope to pm-github's declared command set
Problem
PR #36 scoped registerPreflight to a fixed six-entry commands array. That array, isMutatingGithubCommand, and the commands the package declares are maintained by hand, with nothing binding them. If a command is added or reclassified as mutating on one side only, the override silently stops running for it — the runtime matches by exact normalized path — and the command executes with no early credential warning. (The runtime swallows preflight throws, and the authoritative handler gate only fires once the command actually runs and fails.) This is the same drift risk CodeRabbit flagged on pm-linear #67, where the deprecated linear-sync import alias silently lost its gate.
Manifest-vs-scope audit
Commands pm-github declares (registerCommand + the github importer/exporter aliases):
| command | mutating? | in scope? |
|---|---|---|
github sync | yes (unless --dry-run) | ✅ |
github export | with --apply/--push | ✅ |
github import | yes (unless --dry-run) | ✅ |
gh-issues import (legacy alias) | yes (unless --dry-run) | ✅ |
github project import | yes (unless --dry-run) | ✅ |
github project sync | with --apply | ✅ |
github validate | read-only | — never gated |
github project list | read-only | — never gated |
github project fields | read-only | — never gated |
Diff: every scoped path is a declared command; the three omitted commands are read-only diagnostics that isMutatingGithubCommand returned false for under the old global registration too — no gate was lost, none had to be restored. Notably the legacy gh-issues import alias was already in scope, so the specific gap caught in pm-linear/pm-jira does not exist here.
Fix
Extend the scoping smoke test into a drift guard:
- every scoped path must be one
isMutatingGithubCommandtreats as mutating — the apply-gatedgithub exportandgithub project syncare checked under their apply configuration rather than skipped; - every declared-but-omitted path must be read-only — a justified exclusion, not an accidental gap.
Fails if either list drifts (verified by temporarily breaking the classifier).
Verified
npm test: 251/251 pass- coverage: 92.04 lines / 81.34 branches / 91.49 functions (thresholds 88/79/89 met)
npm run release:checkexits 0npx pm health --strict-exit:ok: true, zero collision warningsdist/unchanged after rebuild
pm item
Summary by Sourcery
Guard pm-github’s preflight override scope against drift from its declared mutating command set to prevent commands silently losing credential gating.
Bug Fixes:
- Ensure every command in the preflight scope is classified as mutating and every declared-but-unscoped command is verified read-only to avoid missing credential gates.
Enhancements:
- Extend the smoke test into a drift check that binds the preflight override scope to the mutating command classifier.
Documentation:
- Document the fix and its impact in the changelog and pm agent issue history.
Summary by cubic
Bind the preflight credential gate’s scope to pm-github’s declared mutating commands and harden the test so drift cannot hide. Previously the guard compared against a hand-maintained list and could miss newly mutating commands; the test now derives the declared set from real activation and asserts the scope equals its mutating class. No runtime behavior changes.
Review focus
- In
test/smoke.test.ts, derive declared command paths from activation registrations (registerCommand,registerImporter,registerExporter) and verify they equal dispatch handler paths. - Partition that set with
isMutatingGithubCommandunder maximally mutating options and assert the mutating + read-only classes reconstruct the declared set exactly. - Assert the override’s
commandsequals the mutating class; fail with the command name if a declared mutating path is missing or a read-only/undeclared path is scoped. - Minor housekeeping:
.gitattributes, changelog entry, and PM issue artifacts (pm-github-4ga9).