fix(web): resolve the replay tool from the draft, and say why a draft is stuck

Copilot's ninth pass, three comments, two of them consequences of round 8.

- The coercion check resolved the tool from the *entry's* name while the modal
  lets `name` be edited, so retargeting an `echo` replay at `add` validated
  against `echo`. The modal now takes the whole tool list and resolves from the
  draft's current name, which is the one the dispatch will look up.

- `IMPRECISE_INTEGER_ERROR` (was `ROUNDED_INTEGER_ERROR`) no longer names the
  safe-integer range, because the range is not the rule: a whole number past
  ±(2^53 − 1) that is exactly representable round-trips and is accepted. It
  talks about exact representability instead, and its doc links the helper that
  actually exists.

- `SchemaJsonField` carries the parser's reason instead of flattening every
  case to "Not valid JSON", which misdiagnosed a document that parses fine and
  holds a number this client cannot send — leaving the user reading about
  syntax while looking at syntactically fine JSON.

The last one had a bug the gate caught rather than the tests: empty text is not
a *problem*, so routing the value through the reason check let `JSON.parse("")`
throw out of the change handler. It surfaced as five unhandled errors across
four suites with every assertion still green, which is why `npm run ci` and not
`npm run test` is the gate. Excluded explicitly, with a regression test.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UL9retfvAXRgvi6EWk4SY4
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-08-27 05:16:23 -04:00
commit 03bf9ece42

View file

@ -346,12 +346,6 @@ export function ProtocolEntry({
const requestParams = extractParams(entry);
const canReplay = isReplayableProtocolMethod(method);
const editableParams = replayableParams(method, requestParams);
// The tool this entry called, when it called one — the schema an edited
// argument would be coerced against.
const replayedTool =
method === "tools/call" && typeof requestParams?.name === "string"
? tools?.find((candidate) => candidate.name === requestParams.name)
: undefined;
const resultType = extractResultType(entry);
const subscriptionId = extractSubscriptionId(entry);
@ -503,7 +497,9 @@ export function ProtocolEntry({
// the editor must not offer a field that Send would drop.
params={editableParams.params}
droppedParamKeys={editableParams.dropped}
tool={replayedTool}
// The whole list, not this entry's tool: `name` is editable, so the
// schema to validate against is whichever the draft now names.
tools={tools}
onSend={onReplay}
onClose={() => setIsEditingReplay(false)}
/>