GitNexus/gitnexus/test
Abhigyan Patwari 136003377a
feat(eval): add opt-in baseline_cli arm to measure MCP catalog cost (#3762)
* feat(eval): add opt-in baseline_cli arm to measure MCP catalog cost

The MCP arm costs ~22-43% more than baseline_nomcp in every release
evaluation, with no solve-rate gain. Almost all of the extra is re-read
input context, not output. baseline_cli separates the tool catalog's
share of that from tool-output size and extra turns.

- cli_shim: a standard-library `gitnexus` command, mounted at the CLI
  path, forwards one call per invocation to the same per-cell isolated
  MCP endpoint the baseline arm uses, restricted to the same read-only
  tools. Help is on demand (`gitnexus help [command]`); no tool schema
  enters the model context, and the runtime stays in the sibling sandbox.
- runner/proposer_sandbox: wire the arm (Bubblewrap only) with a short
  prompt note and an empty MCP config.
- cli_arm_report: descriptive comparison with the paired arms, counting
  `gitnexus` shell calls from transcripts.
- release-evaluation: `cli_arm` dispatch input runs the arm on the
  candidate into its own output and uploads release-cli-arm-<sha>. The
  paired evidence, release report and gate are unchanged.
- tests: shim argument mapping, a fake-MCP round trip, the sandbox
  mount, the report, and a real-Bubblewrap canary (added to the ubuntu
  containment job and the pre-paid canary step).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(eval): forward explicit empty shim options; drop unused reuse entry

- cli_shim: `--flag=` now forwards an empty string instead of treating
  the option as valueless (test added).
- comparator_reuse: remove baseline_cli from REUSABLE_COMPARATOR_ARMS.
  The skill-digest gate rejects every non-CE arm without a digest, so
  listing it implied reuse that cannot happen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(eval): keep boolean shim switches from consuming positionals

`gitnexus impact --include-tests foo` took `foo` as the switch value and
left the required target unset. Boolean-only options now consume the
next token only when it is an explicit true/false (tests added).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(eval): let the baseline_cli shim open its MCP socket from Bash

The first paid baseline_cli cell showed every `gitnexus` call failing
with EPERM on socket(AF_UNIX): Claude Code's Bash sandbox blocks Unix
sockets (allowAllUnixSockets: false). The MCP arm never hit this because
Claude's MCP client runs socat outside the Bash sandbox. Shim sessions now
set allowAllUnixSockets; the bwrap mounts still expose only the cell's MCP
endpoint, and every other arm keeps the block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(eval): keep PR previews valid alongside opt-in descriptive arms

measurement_protocol required exactly one `-m workflow_bench.runner` step,
so the cli_arm step made it raise on the checked-in workflow; any later
workflow change would then break PR cost previews. It now still requires
exactly one ungated paid step, and allows extra runner steps only with an
exact opt-in gate (env.CLI_ARM / env.CODE_ARM) placed after the paid step,
outside the fingerprint. Tests cover the allowed case, misplaced and
unlisted extra arms, and the checked-in workflow itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(eval): let the shim's first value name the tool's subject

The first paid baseline_cli cell's opening call, `gitnexus impact
statusCommand --direction upstream`, failed with "too many values":
impact requires only `direction` (target is optional beside target_uid),
so no positional slot was left for the symbol. Positional values now fill
the first string property (target, name, search_query, from) before the
required ones (test added with the real impact requirement).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: expect the opt-in CLI_ARM key in the release evaluate env

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(eval): explicit report text join; count only command-position CLI calls

- cli_arm_report: join the summary sentence with `+` (CodeQL implicit
  string concatenation in a list).
- Count `gitnexus <command>` only in command position. In this repo
  `npm --prefix gitnexus test` names the package directory and was being
  counted as a CLI call (test added).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(eval): run the shim canary against the real impact contract

The real-Bubblewrap canary used a fixture where impact requires `target`,
and its fake server answered any call. It now serves REAL_IMPACT
(direction required, as in gitnexus/src/mcp/tools.ts), rejects calls
missing a required argument, and checks both the flag and positional
forms plus a rejected call without a direction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(eval): pin test_cli_shim.py in the containment job expectations

The ubuntu containment job now runs tests/test_cli_shim.py (its real-
Bubblewrap shim canary is skipped everywhere else), so the pinned
pytest selection and the bwrap-canary file list include it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(eval): compare CLI-arm deltas on matched task/run pairs

The CLI arm report averaged each arm separately, so an interrupted sweep
(or a cell with no billing) skewed the deltas with no warning. Deltas now
use only task/run pairs present once in both arms with the metric
measured in both, and are labelled with the pair count ("partial" when
fewer than expected). A metric missing on any cell leaves that arm's mean
unknown and is listed as a problem; duplicate pairs are flagged and
excluded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(eval): read CLI-arm transcripts from the persisted artifact records

Result rows store transcript_artifacts as the {"path", "sha256", "bytes",
"source"} records runner_sessions persists, not bare paths, so joining
results_dir with an entry raised TypeError on real output. Read the
record's path, and skip anything that resolves outside the results dir.
The report test now uses the real record shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
2026-10-29 11:46:52 +00:00
..
fixtures feat: add the test scenario map and a Vitest 5 mutation runner (#3686) 2026-10-27 16:46:58 +00:00
helpers feat(ci): rebalance test shards from recorded timings (#3748) 2026-10-28 11:58:29 +00:00
integration feat(ingestion): opt-in indexing of named dot directories (GITNEXUS_INCLUDE_DOT_DIRS) (#3745) 2026-10-29 07:02:45 +00:00
unit feat(eval): add opt-in baseline_cli arm to measure MCP catalog cost (#3762) 2026-10-29 11:46:52 +00:00
utils feat(storage): add configurable index storage and content retention tiers (#3060) 2026-09-12 20:31:55 +00:00