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:
parent
fcdc65b289
commit
03bf9ece42
1 changed files with 186 additions and 49 deletions
|
|
@ -95,9 +95,15 @@ function* jsonNumberLiterals(text: string): Generator<string> {
|
|||
}
|
||||
}
|
||||
|
||||
/** The message every draft parser uses for {@link hasRoundedInteger}. */
|
||||
export const ROUNDED_INTEGER_ERROR =
|
||||
"A whole number written out in full must be within ±(2^53 − 1) — a longer one loses digits when parsed, so a different value would be sent";
|
||||
/**
|
||||
* The message every draft parser uses for {@link hasImpreciseIntegerLiteral}.
|
||||
*
|
||||
* Phrased as "cannot be represented exactly" rather than naming the safe-integer
|
||||
* range, because the range is not the rule: a whole number past ±(2^53 − 1) that
|
||||
* *is* exactly representable — 2^54, say — round-trips and is accepted.
|
||||
*/
|
||||
export const IMPRECISE_INTEGER_ERROR =
|
||||
"This whole number cannot be represented exactly — it is rounded when parsed, so a different value would be sent";
|
||||
|
||||
/**
|
||||
* Read a JSON-object editor's draft text.
|
||||
|
|
@ -140,7 +146,7 @@ export function parseJsonObjectDraft(text: string): JsonObjectDraft {
|
|||
};
|
||||
}
|
||||
if (hasImpreciseIntegerLiteral(text)) {
|
||||
return { ok: false, error: ROUNDED_INTEGER_ERROR };
|
||||
return { ok: false, error: IMPRECISE_INTEGER_ERROR };
|
||||
}
|
||||
return { ok: true, value: parsed };
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue