Skip to content

test: extend processor schema-vs-factory parity checks to all processors - #1867

Merged
dyoshikawa merged 1 commit into
mainfrom
resolve-scrap-issue-1866-processor-parity
Jun 15, 2026
Merged

test: extend processor schema-vs-factory parity checks to all processors#1867
dyoshikawa merged 1 commit into
mainfrom
resolve-scrap-issue-1866-processor-parity

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Background

Follow-ups from PR #1859, which added consistency checks for processor tool target schemas. That PR applied the strong schema-vs-factory parity check to RulesProcessor only and left low-severity clarity/coverage items for later. This PR addresses them.

Changes

  • Extend parity check to every processor (item 2). Export the seven remaining tool*Factories maps (commands, hooks, ignore, mcp, permissions, skills, subagents) — matching the visibility already given to toolRuleFactories — and assert that each processor's schema enum set-equals its factory Map keys. This catches drift in either direction (a target in the schema with no factory, or a factory for a target the schema rejects) uniformly across all 8 processors, not just rules.
  • Clarify the subset guarantee (item 1). Document in comments that the subset check intentionally guards only the "a target declared by a processor must exist in ALL_TOOL_TARGETS" direction; the reverse is deliberately not asserted because not every tool supports every feature.
  • Note the hand-maintained list footgun (item 4). Add a comment that the processors list must be kept in sync until a central processor registry exists.

Item 3 (.toSorted() requiring ES2023) needs no action: .toSorted() is already the dominant sorting idiom across src (45 occurrences), so this is consistent with the codebase.

The only production change is widening the visibility of existing const factory maps to export; there is no behavioral change. All checks pass via pnpm cicheck.

Closes #1866

Follow-ups from PR #1859.

- Export the seven remaining `tool*Factories` maps (commands, hooks, ignore,
  mcp, permissions, skills, subagents) so tests can assert their keys, matching
  the visibility already given to `toolRuleFactories`.
- Apply the strong bidirectional schema-vs-factory parity check (schema enum
  set-equals factory Map keys) to every processor, not just RulesProcessor, so
  drift in either direction is caught uniformly.
- Clarify in comments that the subset check intentionally guards only the
  "target declared by a processor must exist in ALL_TOOL_TARGETS" direction, and
  that the reverse is not asserted because not every tool supports every feature.
- Note that the hand-maintained `processors` list must be kept in sync as a known
  footgun until a central processor registry exists.

Closes #1866
@dyoshikawa
dyoshikawa merged commit 6970a3d into main Jun 15, 2026
9 checks passed
@dyoshikawa

Copy link
Copy Markdown
Owner Author

@dyoshikawa Thank you!

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.

Follow-ups from PR #1859: extend processor schema parity checks and clarify subset guarantee

2 participants