Skip to content

test(scope): differential regression suite proves agent-scope-hardening holds (Spec 105 PR H1) - #1332

Merged
Dumbris merged 1 commit into
mainfrom
105-h1-regression-suite
Sep 21, 2026
Merged

Dumbris merged 1 commit into
mainfrom
105-h1-regression-suite

Conversation

@Dumbris

@Dumbris Dumbris commented Sep 20, 2026

Copy link
Copy Markdown
Member

Summary

Spec 105 PR H1 — scope-regression-suite part 2 (FR-011/013/014, SC-007, gaps FR01x-G4..G7). Closes tasks T107-T116. This is the FINAL phase of the nine-PR agent-scope-hardening epic (spec 105), started with PR A (#1279) and completed through B, D, E, H0, C (#1325), F (#1326) and G (#1328) — all already merged to main.

Its job is to prove, with a genuine two-fixture differential oracle, that every acceptance scenario in specs/105-agent-scope-hardening/spec.md (User Stories 1-3) actually holds against the already-shipped code, and that none of the pre-105 insecure test assertions the prior PRs inverted has crept back to its original form. This PR is test-only except for one small, genuine bug fix it found along the way (see below) — it does not change any production authorization logic.

Changes

  • Two-fixture differential oracle (internal/server/scope_differential_test.go, new): newScopeFixture/runScopeScenario/normalizeScopeResponse per contracts/differential-oracle.md, plus TestScopeCoverage_EveryUserStoryScenario registering every US1.1-1.8/US2.1-2.6/US3.1-3.4 scenario by id — some directly via the general three-server harness, most by re-running each prior PR's own dedicated differential fixture (plan.md: "H1 re-registers them by User Story id").
  • Pinned-reversal grep guard (internal/server/scope_pinned_reversal_guard_test.go, new): TestScopePinnedReversalsStayInverted proves none of the four pre-105 insecure assertions gap-map.md's FR01x-G7 entry names have crept back to their original form, traced to their exact pre/post-105 diffs across commits bac8f6b0d, 46de8038c, e33d6a139.
  • Retained-effect fixtures (internal/server/scope_retained_effects_test.go, new): real reproductions of the SC-001-excluded, deliberately-unchanged effects — shared-limiter contention, cross-server scan admission (via the actual shadowing.cross_server impersonation-clone mechanism), prompt-name collision, global prompt cap, direct display-name collision, plus shared prompt-refresh deadline via a companion package (internal/upstream/manager_prompts_deadline_test.go, new, two discriminating regimes), and shared log rotation (cited cross-package).
  • HTTP credential matrix (internal/server/scope_http_matrix_test.go, new): real minted tokens over real loopback HTTP through mcpAuthMiddleware, covering every FR-014 applicability-matrix row at least once plus a content-level (raw wire-text) non-disclosure proof for retrieve_tools.
  • Latency harness finalized (internal/server/scope_latency_test.go): all four FR-011 operations (retrieve_tools, read_cache, prompts/list, tools/list) with real workloads, plus .github/workflows/scope-latency.yml (new) and cmd/scope-latency-compare (new, stdlib-only, unit-tested) for the merge-base p95 regression gate — verified end-to-end locally against this PR's actual merge-base commit.
  • Bug fix found via this suite: internal/logs.ReadUpstreamServerLogTail/ReadUpstreamServerLogTailAttributed dereferenced a nil *config.LogConfig (affecting admin and scoped readers identically — a robustness gap, not a scope/security issue). Fixed with a TDD red/green pair (internal/logs/nil_log_config_test.go).
  • Docs and roadmap sync: docs/features/agent-tokens.md invariant wording finalized (no overclaiming — most FR coverage is via re-run dedicated fixtures, not literally every FR through the general 3-server harness). roadmap.yaml's scope-refusal-shapes task was found still status: todo despite PR G (fix(scope): scope-first refusal precedence, hidden equals nonexistent on every surface (Spec 105 PR G, FR-010) #1328) having already merged — flipped to done with its PR number. scope-regression-suite's own task status and the epic-level agent-scope-hardening status are deliberately left as todo/in_progress for the maintainer to flip on merge, per this repo's "no self-merge" convention for these security PRs.

Test plan

  • go build ./..., go vet ./... (bare + -tags server): clean
  • Full -race suite across internal/server, internal/upstream, internal/cache, internal/logs, cmd/scope-latency-compare: green
  • golangci-lint run --config .github/.golangci.yml (bare + --build-tags server, --new-from-rev=origin/main): 0 new issues
  • gofmt -l clean on every touched/new file
  • ./scripts/test-api-e2e.sh: 70/70 passed
  • Cross-model review: opencode terra/sol/astra confirmed quota-exhausted before each round; fell back to codex exec --model gpt-5.6-sol --sandbox read-only per CLAUDE.md's fallback rule. 4 rounds, every finding verified genuine before fixing (never accepted a finding without first confirming it against the actual code, and every fix was verified non-vacuous by temporarily reverting the underlying guard/logic and confirming the new test goes red, then restoring it). Round 1 found 7 real issues across 8 review areas (including two genuinely vacuous retained-effect fixtures that never exercised the mechanism they claimed to); round 2 found 2 more (including the nil-pointer panic above) plus a fix that itself needed strengthening; round 3 found the deadline fixture still didn't rule out an independent-concurrent alternative design; round 4: VERDICT: clean"Both prior MUST-FIX findings are resolved: The complementary 150ms/100ms fixture distinguishes shared-sequential behavior from both independent-concurrent and independent-sequential deadlines. The real-HTTP retrieve_tools test provides content-level non-disclosure through authentication middleware, with an authorized positive control. Combined with the differential suite and existing direct/profile HTTP checks, further per-row content assertions have insufficient marginal value." Full round-by-round history in specs/105-agent-scope-hardening/tasks.md T116.

Related #1223 #1224 #1225 #1226 #1227 #1279 #1282 #1283 #1284 #1285 #1325 #1326 #1328

…ng holds (Spec 105 PR H1)

Spec 105 PR H1 — `scope-regression-suite` part 2 (FR-011/013/014, SC-007,
gaps FR01x-G4..G7). Closes tasks T107-T116. This is the FINAL phase of the
nine-PR agent-scope-hardening epic (A, B, D, E, H0, C, F, G already merged).

## Changes

- **Two-fixture differential oracle** (`internal/server/scope_differential_test.go`,
  new): `newScopeFixture`/`runScopeScenario`/`normalizeScopeResponse` per
  contracts/differential-oracle.md, plus `TestScopeCoverage_EveryUserStoryScenario`
  registering every US1.1-1.8/US2.1-2.6/US3.1-3.4 scenario by id — some
  directly via the general three-server harness, most by re-running each
  prior PR's own dedicated differential fixture (plan.md: "H1 re-registers
  them by User Story id").
- **Pinned-reversal grep guard** (`internal/server/scope_pinned_reversal_guard_test.go`,
  new): `TestScopePinnedReversalsStayInverted` proves none of the four
  pre-105 insecure assertions gap-map.md's FR01x-G7 entry names have crept
  back to their original form, traced to their exact pre/post-105 diffs.
- **Retained-effect fixtures** (`internal/server/scope_retained_effects_test.go`,
  new): real reproductions of 5 of 7 SC-001-excluded effects (shared-limiter
  contention, cross-server scan admission via the actual shadowing.cross_server
  impersonation-clone mechanism, prompt-name collision, global prompt cap,
  direct display-name collision), 1 via a companion package
  (`internal/upstream/manager_prompts_deadline_test.go`, new — shared vs
  independent prompt-refresh deadline, two discriminating regimes), 1 cited
  cross-package (log rotation).
- **HTTP credential matrix** (`internal/server/scope_http_matrix_test.go`,
  new): real minted tokens over real loopback HTTP through mcpAuthMiddleware,
  covering every FR-014 applicability-matrix row at least once plus a
  content-level (raw wire-text) non-disclosure proof for retrieve_tools.
- **Latency harness finalized** (`internal/server/scope_latency_test.go`):
  all four FR-011 operations (retrieve_tools, read_cache, prompts/list,
  tools/list) with real workloads, plus `.github/workflows/scope-latency.yml`
  (new) and `cmd/scope-latency-compare` (new, stdlib-only) for the
  merge-base p95 regression gate.
- **Bug fix found via this suite**: `internal/logs.ReadUpstreamServerLogTail`/
  `ReadUpstreamServerLogTailAttributed` dereferenced a nil `*config.LogConfig`
  — fixed with a TDD red/green pair (`internal/logs/nil_log_config_test.go`).
- Docs and roadmap sync: `docs/features/agent-tokens.md` invariant wording
  finalized; `roadmap.yaml`'s `scope-refusal-shapes` task (stale `todo`
  despite PR G #1328 already merged) flipped to `done`. `scope-regression-suite`
  and the epic-level status are deliberately left for the maintainer to flip
  on merge.

## Testing

- `go build`/`go vet` (bare + `-tags server`): clean
- Full `-race` suite across internal/server, internal/upstream,
  internal/cache, internal/logs, cmd/scope-latency-compare: green
- `golangci-lint --new-from-rev=origin/main` (bare + `--build-tags server`):
  0 new issues
- `./scripts/test-api-e2e.sh`: 70/70 passed
- Cross-model review: opencode terra/sol/astra confirmed quota-exhausted;
  fell back to `codex exec --model gpt-5.6-sol`. 4 rounds, every finding
  verified genuine before fixing (non-vacuous confirmed by temporarily
  reverting the underlying guard and observing red). `VERDICT: clean`
  (round 4) — full history in tasks.md T116.

Related #1223 #1224 #1225 #1226 #1227 #1279 #1282 #1283 #1284 #1285 #1325 #1326 #1328
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 446b25c
Status: ✅  Deploy successful!
Preview URL: https://1d52b627.mcpproxy-docs.pages.dev
Branch Preview URL: https://105-h1-regression-suite.mcpproxy-docs.pages.dev

View logs

@github-actions

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: 105-h1-regression-suite

Available Artifacts

  • archive-darwin-amd64 (30 MB)
  • archive-darwin-arm64 (27 MB)
  • archive-linux-amd64 (18 MB)
  • archive-linux-arm64 (16 MB)
  • archive-windows-amd64 (30 MB)
  • archive-windows-arm64 (26 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (24 MB)
  • installer-dmg-darwin-arm64 (22 MB)
  • smart-mcp-proxymcpproxy-goOQ3K1P.dockerbuild (0 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 35534699095 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 61.53846% with 30 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/scope-latency-compare/main.go 57.14% 26 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

@Dumbris
Dumbris merged commit 0ef17f5 into main Sep 21, 2026
55 checks passed
@Dumbris
Dumbris deleted the 105-h1-regression-suite branch September 21, 2026 09:51
Dumbris added a commit that referenced this pull request Sep 21, 2026
…one (#1335)

Spec 105 PR H1 (#1332) merged, closing the last outstanding phase.
All 9 phases of the agent-token scope-hardening epic are now shipped.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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