Repository navigation
feat: validate suppressedResolvers against the resolver registry - #1936
Closed
katlun-lgtm wants to merge 1 commit into
Closed
katlun-lgtm wants to merge 1 commit into
katlun-lgtm wants to merge 1 commit into
Conversation
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.
|
Merging to
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 |
2 tasks done
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.
Problem
A typo in any host's
suppressedResolverssilently no-ops.gen-skill-docsshort-circuits suppressed resolver names (returns'') before theUnknown placeholder {{...}}throw, andvalidateHostConfignever 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/validateAllConfigsnow accept an optional set of valid resolver names and flag anysuppressedResolversentry that isn't one.The names are injected rather than imported to avoid a circular import:
resolvers/index → resolvers/types(buildHostPaths()iteratesALL_HOST_CONFIGS)→ hosts/index → host-config. PullingRESOLVERSintohost-config.tsdirectly would close that loop.Wired at both validation entry points:
validateCLI subcommand (host-config-export.ts) passesObject.keys(RESOLVERS)So a future typo fails
bun testinstead 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)suppressedResolvers entry 'TYPO_RESOLVER' is not a known resolverTest plan
bun test test/host-config.test.ts→ 77 pass, 0 fail (4 newsuppressedResolverscases: valid pass, unknown caught, host-prefixed invalidateAllConfigs, unchecked when names omitted)bun test test/host-config.test.ts test/gen-skill-docs.test.ts→ 437 pass, 0 fail/shipflowIndependent of #1935 (different files; this branch is based on
main).