Skip to content

feat: validate suppressedResolvers against the resolver registry - #1936

Closed
katlun-lgtm wants to merge 1 commit into
garrytan:mainfrom
katlun-lgtm:fix/validate-suppressed-resolvers
Closed

katlun-lgtm wants to merge 1 commit into
garrytan:mainfrom
katlun-lgtm:fix/validate-suppressed-resolvers

Conversation

@katlun-lgtm

Copy link
Copy Markdown
Contributor

Problem

A typo in any host's suppressedResolvers silently no-ops. gen-skill-docs short-circuits suppressed resolver names (returns '') before the Unknown placeholder {{...}} throw, and validateHostConfig never cross-checked the entries — so an unknown id fails neither at config validation nor at doc generation. A typo would therefore either silently leave a resolver un-suppressed (its content leaks into generated docs) or make a suppression a no-op, with zero error anywhere.

Fix

validateHostConfig / validateAllConfigs now accept an optional set of valid resolver names and flag any suppressedResolvers entry that isn't one.

The names are injected rather than imported to avoid a circular import: resolvers/index → resolvers/types (buildHostPaths() iterates ALL_HOST_CONFIGS) → hosts/index → host-config. Pulling RESOLVERS into host-config.ts directly would close that loop.

Wired at both validation entry points:

  • the validate CLI subcommand (host-config-export.ts) passes Object.keys(RESOLVERS)
  • the host-config test suite's "real configs all pass" guard passes the same

So a future typo fails bun test instead of silently leaking content into generated docs. Backward compatible: callers that don't pass resolver names (existing per-field validation tests) skip the new check.

Verification

  • bun run scripts/host-config-export.ts validate → All 10 configs valid (the strengthened guard confirms there are no existing typos)
  • a bogus entry → suppressedResolvers entry 'TYPO_RESOLVER' is not a known resolver
  • omitting resolver names → check skipped (backward-compatible)

Test plan

  • bun test test/host-config.test.ts → 77 pass, 0 fail (4 new suppressedResolvers cases: valid pass, unknown caught, host-prefixed in validateAllConfigs, unchecked when names omitted)
  • bun test test/host-config.test.ts test/gen-skill-docs.test.ts → 437 pass, 0 fail
  • (maintainer) VERSION bump + CHANGELOG entry — left to your /ship flow

Independent of #1935 (different files; this branch is based on main).

A typo in a host's suppressedResolvers silently no-ops: gen-skill-docs
short-circuits suppressed names before the "unknown placeholder" throw, and
validateHostConfig never cross-checked the entries, so an unknown id failed
neither at config validation nor at doc generation.

validateHostConfig / validateAllConfigs now take an optional set of valid
resolver names and flag any suppressedResolvers entry that isn't one. The names
are injected rather than imported to avoid a circular import (resolvers/index ->
resolvers/types -> hosts/index -> host-config). The `validate` CLI subcommand
and the host-config test suite pass Object.keys(RESOLVERS), so a future typo now
fails `bun test` instead of silently leaking content into generated docs.
@trunk-io

trunk-io Bot commented Jun 9, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

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.

1 participant