fix(git-tools): reject unknown parameters in every git tool #42

Merged
lucas merged 2 commits from 39-git-tools-silently-ignore-unknown-parameters into main 2026-10-20 11:03:39 +02:00
Collaborator

The harness passes unknown root keys through to a tool's execute, and every git tool ignored keys it didn't read — so git_log {rev: "a..b"} silently returned HEAD's history. This adds a shared assertKnownParams guard in validate.ts and calls it first in every git tool, with each tool's schema keys hoisted into a shape object so the key list lives in one place. An unknown key now fails with an error naming the valid parameters.

Decisions

  • Also guarded git_rebase, which landed on main after the plan was written (9 tools instead of the planned 8). (comment)

Verification

  • bun test src/bridge/git-tools (apps/server): 156 pass, 0 fail, including the new assertKnownParams tests.
  • bun run typecheck (apps/server): clean.
  • End-to-end through validateToolArguments + buildLogTool(".").execute: {rev:"a..b",max_count:20} → isError: true, unknown parameter(s): rev. Valid parameters: ref, max_count, skip, author, grep, since, until, paths, first_parent, include_body; {ref:"HEAD~1",max_count:1} → one commit, no error.

Closes #39

The harness passes unknown root keys through to a tool's `execute`, and every git tool ignored keys it didn't read — so `git_log {rev: "a..b"}` silently returned HEAD's history. This adds a shared `assertKnownParams` guard in `validate.ts` and calls it first in every git tool, with each tool's schema keys hoisted into a `shape` object so the key list lives in one place. An unknown key now fails with an error naming the valid parameters. ## Decisions - Also guarded `git_rebase`, which landed on `main` after the plan was written (9 tools instead of the planned 8). ([comment](https://git.sclu1034.dev/lucas/omp-deck/issues/39#issuecomment-16326)) ## Verification - `bun test src/bridge/git-tools` (apps/server): 156 pass, 0 fail, including the new `assertKnownParams` tests. - `bun run typecheck` (apps/server): clean. - End-to-end through `validateToolArguments` + `buildLogTool(".").execute`: `{rev:"a..b",max_count:20}` → `isError: true`, `unknown parameter(s): rev. Valid parameters: ref, max_count, skip, author, grep, since, until, paths, first_parent, include_body`; `{ref:"HEAD~1",max_count:1}` → one commit, no error. Closes #39
The harness passes unknown root keys through to a tool's execute, and a
.strict() schema doesn't help because its coercion pass drops the key and
retries. Tools therefore have to reject unknown parameters themselves.

Refs #39

Co-Authored-By: Claude Opus 5.5 via omp-deck
A misnamed key (e.g. git_log {rev: "a..b"}) used to be dropped silently,
so the tool answered a different question (HEAD's history) with no error.
Each tool now keeps its schema keys in a `shape` object and calls
assertKnownParams before doing anything else.

Closes #39

Co-Authored-By: Claude Opus 5.5 via omp-deck
lucas approved these changes 2026-10-20 11:03:35 +02:00
lucas merged commit aa77d06a62 into main 2026-10-20 11:03:39 +02:00
lucas deleted branch 39-git-tools-silently-ignore-unknown-parameters 2026-10-20 11:03:40 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lucas/omp-deck!42
No description provided.