Skip to content

fix(inputs): refuse a bad repos list and misplaced filters when the inputs are parsed - #552

Merged
Vivswan merged 1 commit into
mainfrom
fix/refuse-target-inputs-at-parse
Oct 12, 2026
Merged

Vivswan merged 1 commit into
mainfrom
fix/refuse-target-inputs-at-parse

Conversation

@Vivswan

@Vivswan Vivswan commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Before

$ gsac apply --repos 'o/r,not-a-slug' --repos-dir /unreadable
repos-dir /unreadable cannot be read ...            # the input error never surfaces
result: failed

After

$ gsac apply --repos 'o/r,not-a-slug' --repos-dir /unreadable
the "repos" input has 1 invalid entry: "not-a-slug" ...   # before any file is read
result: failed

How

  • One helper, two arms. refuseTargetInputs parses the repos list and checks the discovery filters; the multi arm and the snapshot-dir arm of parseConfig call it after the input-conflict refusals and before the config is built.
  • Same codes, same payloads as resolveTargets produced, so every rendered line is unchanged.
  • The runtime refusal stays in resolveTargets for a library caller that builds MultiConfig by hand, since the config types are public.

Proof

  • Tests: four cases through both arms, failing with the two calls commented out and passing restored; flows, cli, action, discovery, and problem suites pass at 611.
  • Gate: typecheck, biome, knip, and the architecture lint green.

…nputs are parsed

A repos list mixing "*" with names, a bad entry in it, and discovery filters set where no "*" discovery runs were refused inside resolveTargets, after the repos directory was read, so an unreadable directory reported itself and hid the input error. parseConfig now refuses them in the multi and snapshot-dir arms, before any file is read; resolveTargets keeps the same refusals for a library caller that builds the config by hand.
Copilot AI balanced review requested due to automatic review settings October 12, 2026 03:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The validation ordering is correct, existing error payloads are preserved, and both affected parsing paths are covered.

0 open findings

What changed in this PR

Moves target-input validation into config parsing so invalid repositories and misplaced filters fail before filesystem access.

Changes:

  • Adds early validation for multi-repository and snapshot-directory inputs.
  • Preserves runtime validation for manually constructed library configurations.
  • Adds coverage for both parsing paths.
File Description
src/​flows/​run-config.ts Validates target inputs during config parsing.
src/​flows/​multi.ts Documents retained runtime validation.
test/​flows/​inputs.test.ts Tests early refusal across both config arms.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Vivswan
Vivswan marked this pull request as ready for review October 12, 2026 03:44
@Vivswan
Vivswan merged commit 8c2ac7e into main Oct 12, 2026
31 checks passed
@Vivswan
Vivswan deleted the fix/refuse-target-inputs-at-parse branch October 12, 2026 04:13
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.

2 participants