fix(web): seed Edit-and-replay from what replay sends, name each JSON editor
Copilot's fourth pass, one inline plus two suppressed. All three were right. - The modal presented the whole captured frame as editable, but replay does not re-send a frame: it dispatches through the typed InspectorClient methods, whose signatures have no room for `_meta` (a captured `tools/call` carries `_meta.progressToken`) or for any list-request key but `cursor`. So editing `_meta` and pressing Send transmitted something other than what was on screen. `replayableParams` now projects the frame down to what the dispatcher actually reads, the modal seeds from that, and it names what was left out rather than leaving the difference to be discovered. The projection lives beside the dispatch switch because the two are halves of one contract. - `ContentViewer` gains `jsonLabel`, so a read-only JSON editor can say what it holds. Every one of them announced "JSON content", and an expanded Protocol entry has two while the list has many pairs — leaving a screen reader with indistinguishable textboxes and only the visible headings to tell them apart. Protocol entries now name theirs per method and direction, Network entries per request/response body. - `isJsonDocument` became `formatJsonDocument`, returning the formatted text instead of a boolean. The heuristic path parsed the payload to decide and then parsed it again to render; Protocol and Network hand over serialized bodies as untyped text and are not virtualized, so a long history paid twice per payload per render. 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
12c00d8c63
commit
5abe289caa
1 changed files with 413 additions and 31 deletions
|
|
@ -371,9 +371,16 @@ const RevealButton = Button.withProps({
|
|||
function BodyPreview({
|
||||
body,
|
||||
contentType,
|
||||
label,
|
||||
}: {
|
||||
body: string;
|
||||
contentType?: string;
|
||||
/**
|
||||
* What this body *is* ("Request body", "Response body"), so a JSON payload's
|
||||
* editor is named. An expanded entry holds both, and the list holds many
|
||||
* pairs, so unnamed they all announce identically to a screen reader.
|
||||
*/
|
||||
label: string;
|
||||
}) {
|
||||
// Reveal state for masked secrets. Hooks run before any early return so the
|
||||
// order stays stable across the too-large / has-secrets branches. The reveal
|
||||
|
|
@ -413,7 +420,13 @@ function BodyPreview({
|
|||
}
|
||||
|
||||
if (!hasSecrets) {
|
||||
return <ContentViewer block={{ type: "text", text: body }} copyable />;
|
||||
return (
|
||||
<ContentViewer
|
||||
block={{ type: "text", text: body }}
|
||||
copyable
|
||||
jsonLabel={`${label} JSON`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const shown = revealed ? body : masked;
|
||||
|
|
@ -432,7 +445,11 @@ function BodyPreview({
|
|||
{revealed ? "Hide" : "Reveal"}
|
||||
</RevealButton>
|
||||
</Group>
|
||||
<ContentViewer block={{ type: "text", text: shown }} copyable />
|
||||
<ContentViewer
|
||||
block={{ type: "text", text: shown }}
|
||||
copyable
|
||||
jsonLabel={`${label} JSON`}
|
||||
/>
|
||||
</Stack>
|
||||
);
|
||||
}
|
||||
|
|
@ -587,6 +604,7 @@ export function NetworkEntry({
|
|||
key={`${entry.requestHeaders["content-type"] ?? ""}|${entry.requestBody}`}
|
||||
body={entry.requestBody}
|
||||
contentType={entry.requestHeaders["content-type"]}
|
||||
label="Request body"
|
||||
/>
|
||||
</Stack>
|
||||
)}
|
||||
|
|
@ -604,6 +622,7 @@ export function NetworkEntry({
|
|||
key={`${entry.responseHeaders?.["content-type"] ?? ""}|${entry.responseBody}`}
|
||||
body={entry.responseBody}
|
||||
contentType={entry.responseHeaders?.["content-type"]}
|
||||
label="Response body"
|
||||
/>
|
||||
) : (
|
||||
<DimmedNote>
|
||||
|
|
|
|||
Loading…
Reference in a new issue