Skip to content

tech-debt-backlog §§7.16, 7.17: gloss tools/call + forward-link sanitization - #135

Merged
jascal merged 1 commit into
mainfrom
tech-debt-backlog-7-16-7-17
Jun 16, 2026
Merged

tech-debt-backlog §§7.16, 7.17: gloss tools/call + forward-link sanitization#135
jascal merged 1 commit into
mainfrom
tech-debt-backlog-7-16-7-17

Conversation

@jascal

@jascal jascal commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

Two XS-sized doc nits from PR #76's review log, both targeting the same
### Trust Boundary subsection in README.md.

  • §7.17 — gloss tools/call as MCP jargon on first use. The first
    occurrence now reads "There is no auth check on the JSON-RPC tools/call
    method (the MCP-standard tool-invocation entry point) — any client that
    can connect to the stdio pipe …", so a reader new to the MCP protocol
    doesn't need to already know tools/call is a JSON-RPC method name.
  • §7.16 — forward-link to the §4.3 sanitization story. Added a third
    bullet to the Trust Boundary list — "Exception messages are scrubbed.
    Errors raised inside tools/call are passed through
    sanitize_exception_message in q_orca/mcp_server.py before being
    returned, so stack traces and absolute filesystem paths do not leak into
    the JSON-RPC response. Set ORCA_MCP_DEBUG=1 to disable the scrubbing
    for local debugging." Pointed at the source file directly because no
    dedicated "MCP error handling section" exists in the README. Also
    surfaces the ORCA_MCP_DEBUG=1 escape hatch from §4.3, which is
    otherwise invisible without reading the module.

Bundled in one PR because both tasks target the same six-line subsection
and come from the same PR review log, matching the §7.21–7.24 (PR #129)
and §7.12 (PR #131) precedents.

Test plan

  • README.md is not referenced by any test under tests/ (verified
    by grep -ri 'README\.md\|Trust Boundary' over tests/), so the
    existing pytest baseline is unaffected.
  • Visually inspect the rendered ### Trust Boundary subsection on
    the PR diff to confirm the bullet renders as a third list item and
    the gloss reads naturally.
  • Tasks §7.16 and §7.17 marked [x] with closing notes in
    openspec/changes/tech-debt-backlog/tasks.md per the file's
    convention.

Pre-existing CI / test failures (not introduced here)

pytest -q on main (at e638bd9, before this branch) reports
78 failed / 1134 passed / 74 skipped. The failures span
tests/test_vqe.py, tests/test_verifier.py,
tests/test_two_qubit_parameterized.py, etc., and surface as
AssertionError: assert 'invalid' == 'valid' and
ModuleNotFoundError — none of them are README-related and they
reproduce verbatim with this branch's changes stashed. Worth a
separate nightly to triage.

🤖 Generated with Claude Code

…ization

§7.17 (gloss `tools/call` as MCP jargon on first use): the first occurrence
in the README's `### Trust Boundary` subsection now reads "There is no auth
check on the JSON-RPC `tools/call` method (the MCP-standard tool-invocation
entry point) — any client that can connect to the stdio pipe …". Subsequent
occurrences stay bare — the jargon is glossed once on the reader-facing
mention. One-sentence change with no behavioural impact.

§7.16 (forward-link to the §4.3 sanitization story): added a third bullet to
the same subsection — "**Exception messages are scrubbed.** Errors raised
inside `tools/call` are passed through `sanitize_exception_message` in
`q_orca/mcp_server.py` before being returned, so stack traces and absolute
filesystem paths do not leak into the JSON-RPC response. Set
`ORCA_MCP_DEBUG=1` to disable the scrubbing for local debugging." Points
at the source file directly rather than an anchored "MCP error handling
section" — no such section exists in the README, so a code reference is
the honest forward-link. Also surfaces the `ORCA_MCP_DEBUG=1` escape
hatch from §4.3, which is otherwise invisible without reading the module.

Doc-only — no tests touched. The README is not referenced by any test
under `tests/`, so the existing pytest baseline is unaffected.

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

@jascal jascal left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Code Review — Claude Sonnet 4.6

Scope: docs-only. README.md (the ### Trust Boundary subsection) and the [x] task closures in openspec/changes/tech-debt-backlog/tasks.md. No production or test code changes.

Verdict

Looks good — ship it. The change is small, the prose is accurate against the code it documents, and it introduces no lint or test regressions. A couple of optional precision notes below.

Correctness / accuracy (the real bar for a docs PR)

I verified every factual claim in the new README bullet against q_orca/mcp_server.py:

  • sanitize_exception_message exists — q_orca/mcp_server.py:246.
  • ✅ It is genuinely invoked inside the tools/call pathq_orca/mcp_server.py:304, in the inner except around call_tool(...) (and again as the outer-handler backstop at :324). So "Errors raised inside tools/call are passed through sanitize_exception_message before being returned" is precisely true.
  • ORCA_MCP_DEBUG=1 disables scrubbing — _mcp_debug_enabled() at :242-243 reads the env var and threads debug= into the helper; with debug=True the function returns the raw message un-scrubbed (:257-258).
  • tools/call really is the JSON-RPC method name (case "tools/call":, :293), so the §7.17 gloss ("the MCP-standard tool-invocation entry point") lands on a real method, not a paraphrase.

The §7.17 rewording reads naturally and, as the task note claims, only the first reader-facing occurrence is glossed — the bare name is reused later, which is the right call.

Two minor precision notes (non-blocking)

  1. "stack traces … do not leak" — true, but for a subtly different reason than the bullet implies. The scrubber operates on str(exc) (:256), i.e. only the exception message, never traceback.format_exc(). So stack traces don't leak because they're never included in the first place; the regex's actual job is stripping absolute paths (_ABS_PATH_RE.sub("<path>", ...), :259) plus length-capping (:260-261). The sentence is accurate as written, so this is optional — but if you want the doc to be airtight, "stack traces and absolute filesystem paths do not leak" slightly over-credits the scrubber for the stack-trace half.
  2. Accepted truthy values — the README shows ORCA_MCP_DEBUG=1, but the code also accepts true/yes (:243). Fine as an example; just noting the env var is more permissive than the single value documented.

Lint (ruff)

.venv/bin/ruff check . reports 18 errors, but all are pre-existing and in test files (tests/test_compiler.py ×9, tests/test_noise_model_section.py ×5, tests/test_verifier.py ×2, plus test_qpc_convergence.py, test_examples.py) — unused pytest imports and E402 module-level-import-not-at-top. None are in README.md/tasks.md (ruff doesn't lint markdown), so this PR adds zero lint debt. Those test-file nits look like good candidates for a separate cleanup task if not already tracked.

Tests

.venv/bin/pytest --tb=short -q on this branch: 1282 passed, 8 skipped, 0 failed (23s). Clean.

⚠️ Worth a look: the PR body's "Pre-existing CI / test failures" section claims 78 failed / 1134 passed / 74 skipped on main with ModuleNotFoundError symptoms. I could not reproduce that here — the suite is fully green. The ModuleNotFoundError hint suggests the 78 failures were an environment artifact (a missing optional dependency in the run that produced that number), not a real baseline. Since this is docs-only it changes nothing about the merge decision, but I'd lower confidence in that paragraph — it may mislead a future reader into thinking main is broken when it isn't in a correctly-provisioned env.

Test coverage

N/A — no behavior changes, and the README correctly notes it isn't referenced by any test under tests/. Confirmed.

Security / performance

No impact. If anything this is a net positive for security posture: it makes the exception-scrubbing guarantee and the ORCA_MCP_DEBUG escape hatch discoverable from the README rather than buried in the module, which lowers the chance someone wires up a non-stdio transport without realizing the scrubbing exists.

What's good

  • The §7.16 task note is refreshingly honest about why it links to the source file instead of an anchor ("no such section exists in the README") — that's the right level of documentation discipline, and avoids a dead anchor link.
  • Bundling two nits that touch the same six-line subsection into one PR is sensible and consistent with the cited §7.21–7.24 / §7.12 precedents.
  • Claims match code exactly; no drift introduced.

This review was posted automatically by Claude Sonnet 4.6.

@jascal
jascal merged commit 55dacaa into main Jun 16, 2026
6 checks passed
jascal added a commit that referenced this pull request Jun 16, 2026
#138)

Three [XS] follow-ups, all surface-only wording fixes from prior
PR review logs.

- §7.27 — fix the line citation in §7.22's resolution note.
  `examples/hybrid-bridge/README.md:60` → :59. `2·asin√0.85 ≈ 2.346`
  actually sits on line 59 of that file; the PR #129 reviewer flagged
  the off-by-one and it persisted in the merged backlog body.
- §7.28 — replace "class-level docstring" with "leading `#` comment
  on the class" in §7.12's resolution note. Verified against
  tests/test_mcp_server.py:181-188: the §7.12 rationale lives in a
  contiguous `#` comment block immediately above the
  `@pytest.mark.skip`, not a docstring (no `"""…"""` exists on the
  class). The prior wording would mislead a future reader using
  `pydoc` / `__doc__` to find it.
- §7.29 — rewrite the below-atol-guard test's spectrum-recovery
  comment. PR #134's "CNOT inverse-permutation is unitary, so
  singular values propagate unchanged" framing was loose — an entry
  permutation is a row-dependent column swap that does not in
  general preserve a *reshaped* matrix's spectrum. New comment
  references the actual chain that does: exact inverse swap of
  _apply_cnot's forward swap, then a `full_matrices=False` SVD with
  every singular value kept (no truncation), so the reconstruction
  is exact and _apply_cnot's downstream SVD sees the singular
  values of M itself.

Bundled because all three are XS doc-nits from review logs, matching
the §§7.21–7.24 (PR #129), §§7.16/7.17 (PR #135), and §§7.18/7.19
(PR #137) bundling precedent.

`pytest -q`: 1282 passed, 8 skipped (the §7.29 test fixture stays
green; the §7.27/§7.28 edits are tasks.md-only and not referenced
by any test).

Tasks marked `[x]` with closing notes per §6.1.

Co-authored-by: Claude Opus 4.7 <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.

1 participant