Skip to content

feat(adr-001 #4): extend MCP budget enforcement + phase-2 method coverage - #28

Merged
ruvnet merged 1 commit into
mainfrom
adr/mcp-budget-coverage
May 19, 2026
Merged

ruvnet merged 1 commit into
mainfrom
adr/mcp-budget-coverage

Conversation

@ruvnet

@ruvnet ruvnet commented May 19, 2026

Copy link
Copy Markdown
Owner

Summary

Phase-2 of ADR-001 item #4 promised "enforce `max_complexity_class` on solve handlers" — plural. `handleSolve` and `handleSolveTrueSublinear` were already wired; this lands the missing peer (`handleEstimateEntry`) + extends `METHOD_WORST_CASE` with the phase-2A/2B primitives shipped in PRs #26 and #27 so the `estimateComplexityClass` tool surfaces them.

What changes

  • `handleEstimateEntry` now calls `enforceComplexityBudget(method, params.max_complexity_class)` before any validation — matches `handleSolve`'s gate ordering. Cheap O(1) rank lookup before any solver work.
  • `estimateEntry` input schema gains `max_complexity_class` arg + a sibling `x-complexity` annotation, so budget-aware clients can both see the class at tool-list time AND refuse the call by budget.
  • `METHOD_WORST_CASE` table extended with the phase-2A/2B primitives:
    method worst case
    closure-indices SubLinear
    contrastive-solve-on-change Linear (Adaptive worst)
    solve-single-entry-neumann SubLinear
    contrastive-solve-on-change-sublinear SubLinear

Why

The "bounded-planning kernel" promise of ADR-001 phase-2 only holds if every solve handler honours the budget. estimateEntry was a hole in the gate.

Test plan

  • `npm run build` clean (TS compiles, WASM copy succeeds)
  • `cargo check --lib` clean (no Rust-side touches)
  • Full CI

🤖 Generated with claude-flow

…rage

Phase-2 of item #4 promised "enforce max_complexity_class on solve
handlers" — plural. handleSolve and handleSolveTrueSublinear were
already wired; handleEstimateEntry was the missing peer. estimateEntry
runs per-entry solver work via the same neumann/random-walk methods
that handleSolve uses, so the same budget gate applies.

Also extends METHOD_WORST_CASE with the phase-2A/2B primitives
that landed in PRs #26 and #27, so the estimateComplexityClass
tool surfaces them and budget-aware clients can refuse them
at tool-list time:

  closure-indices                          SubLinear
  contrastive-solve-on-change              Linear (Adaptive worst)
  solve-single-entry-neumann               SubLinear
  contrastive-solve-on-change-sublinear    SubLinear

handleEstimateEntry now calls enforceComplexityBudget with the
caller's `method` (default 'neumann') before any validation —
matches handleSolve's gate ordering. The estimateEntry input
schema gains `max_complexity_class` arg + a sibling `x-complexity`
annotation so clients can see the class without making the call.

Co-Authored-By: claude-flow <ruv@ruv.net>
@ruvnet
ruvnet merged commit 9f381c5 into main May 19, 2026
11 of 12 checks passed
@ruvnet
ruvnet deleted the adr/mcp-budget-coverage branch May 19, 2026 13:30
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.

1 participant