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
|
|
@ -98,6 +98,44 @@ describe("EditReplayModal", () => {
|
|||
expect(screen.getByText(/Numbers must be finite/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
// Replay dispatches through the typed client methods, so a param they have no
|
||||
// room for is dropped. Saying which, rather than seeding it into the editor,
|
||||
// is what keeps the modal from inviting an edit that Send discards.
|
||||
it("names the params replay cannot re-send", () => {
|
||||
renderWithMantine(
|
||||
<EditReplayModal
|
||||
{...baseProps}
|
||||
params={{ name: "echo" }}
|
||||
droppedParamKeys={["_meta"]}
|
||||
/>,
|
||||
);
|
||||
expect(screen.getByText(/`_meta` is not re-sent/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("says nothing when every param survives", () => {
|
||||
renderWithMantine(
|
||||
<EditReplayModal
|
||||
{...baseProps}
|
||||
params={{ name: "echo" }}
|
||||
droppedParamKeys={[]}
|
||||
/>,
|
||||
);
|
||||
expect(screen.queryByText(/not re-sent/)).toBeNull();
|
||||
});
|
||||
|
||||
it("agrees with its verb for several dropped params", () => {
|
||||
renderWithMantine(
|
||||
<EditReplayModal
|
||||
{...baseProps}
|
||||
params={{ cursor: "abc" }}
|
||||
droppedParamKeys={["_meta", "extra"]}
|
||||
/>,
|
||||
);
|
||||
expect(
|
||||
screen.getByText(/`_meta`, `extra` are not re-sent/),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("closes without sending when cancelled", async () => {
|
||||
const user = userEvent.setup();
|
||||
const onSend = vi.fn();
|
||||
|
|
|
|||
Loading…
Reference in a new issue