Repository navigation
Config: reject unknown keys, bad widths, non-http origins, blank selectors - #120
Merged
Merged
Conversation
…ctors Unknown top-level and masks[i] keys exit 2 with the valid keys listed, so a `urlpath` typo no longer turns a scoped mask global. The key lists are type-checked against RenderdiffConfig and Mask. widths must be a non-empty array of positive integers. The resolved left/right (config or flags) must be http(s) URLs, and probe uses the same check. hideSelectors entries and mask selectors must be non-blank. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 2, 2026
Merged
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.
Config mistakes that used to slip through, or fail later with a misleading error, now exit 2 with the bad key named.
What's validated now
masks[i]keys do the same. Before, aurlpathtypo silently turned a mask scoped to one route into a global one. Both key lists are type-checked againstRenderdiffConfigandMask(satisfies Record<…>), so they can't drift from the types.widthsmust be a non-empty array of positive integers. Before,widths: []crashed with exit 3, and a fractional width failed every shot.left/right, from the config or from--left/--right, must be http(s) URLs. Before,localhost:3000gave a misleading "not responding".renderdiff probeuses the same check.hideSelectorsentries andmasks[].selectormust be non-empty after trim. The--hide/--maskflags already reject blanks.Breaking
These configs and flags now exit 2:
masks[i]widths--left/--righthideSelectorsentries or mask selectorsA fractional
--widthflag is not rejected here; the companion flag-parsing PR handles that.Testing
New
--dry-runcases intests/unit/config-load.test.tsandtests/unit/cli-args.test.ts, one per new error, plus updated message checks for widths and mask selectors.npm run typecheck,lint,format:checkandnpm test(381/381) all pass.🤖 Generated with Claude Code