Files
mattgodbolt-molty d71d9a3258 MCP: address two more Copilot findings
Two more from the latest Copilot review:

- 405 responses for GET/DELETE on /mcp now advertise `Allow: POST,
  OPTIONS` instead of just `POST`. Strictly per RFC 7231 the Allow
  header should list every supported method, and the OPTIONS handler
  is right above. Tests updated.
- Add unit tests for the `lookup_asm_instruction` MCP tool — every
  other MCP tool had tests; this one didn't. Three cases: success
  path (MOV on amd64 returns html/tooltip), case-insensitive opcode
  (lowercase "mov" upper-cased before lookup), and not-found path
  (returns isError with helpful message). The "internal error in
  catch-block" case is harder to set up cleanly because z.enum on
  `availableAsmDocsKeys` already rejects unknown instruction sets at
  validation, so the catch only fires for genuine provider failures
  (nothing easy to mock without surgery).

A third Copilot finding flagged that getSafeHash's new non-object
assert could regress legacy `req.body.config` strings. Discussed and
deliberately not changing the code: in-tree every caller passes an
object (the default-shortener path on godbolt.org sends an object;
the external-shortener path goes through a different handler). The
old behaviour for string config was undefined-ish (silent no-op on
nonce assignment, possible loop, possibly profane stored hash). The
new behaviour fails loudly with a 500 — strictly better. Updated
docs/API.md to make the body-must-be-object expectation explicit on
/api/shortener since the prior docs implied but never stated it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 09:45:33 -05:00
..
2025-07-28 10:34:46 -05:00
2025-07-28 10:34:46 -05:00