Skip to content

Make cheatsheet examples linkable and add Undo on load - #406

Merged
owenthereal merged 3 commits into
mainfrom
pipeline/cheatsheet-links-and-undo
Dec 6, 2026
Merged

owenthereal merged 3 commits into
mainfrom
pipeline/cheatsheet-links-and-undo

Conversation

@owenthereal

Copy link
Copy Markdown
Member

Closes #120

What changed

Each of the 13 cheatsheet rows now has native links in both cells and one keyboard Tab stop. A modified click can open the example in a new tab. A plain click loads it in place and clears jq flags so the example runs as shown.

When loading an example replaces work, a 10-second Undo restores the JSON or HTTP draft, query, options and output. This includes pre-URL HTTP drafts and cleared editors. Undo restores completed output verbatim, including time-dependent filters. An interrupted local jq run can finish. An interrupted HTTP request shows that its response is unavailable. Undoing a completed POST restores its response without issuing another request, including when the HTTP form is already open. Close, timeout and Undo release the snapshot.

Verification

  • npm run lint, npm test (134 passing), and npm run build passed locally with Node 26.14.0. Vite configuration and OpenAPI warnings were also present on the baseline.
  • Unit tests round-trip all 13 example URLs through the snippet schema, classify click modifiers and HTTP drafts, and verify snapshot isolation.
  • Before implementation, Chromium found 0 of 26 expected links. Loading an example from a workspace with -r produced unquoted output and offered no Undo. The feature passed all seven planned browser scenarios in production Chromium at 1440 × 900.
  • In a disposable regression check, disabling individual protections restored deleted query text and stale Monaco JSON, sent a second mocked POST, lost pre-URL drafts, and expired the second Undo early. Each corresponding assertion passed with the protections in place.
  • Whole-branch review exposed three regressions. Before their fixes, an already-open HTTP form showed GET after restoring a POST, an interrupted POST stayed at “Running...”, and Undo changed the timestamp returned by jq now. Chromium checks now compare method, fields, request counts and exact output before and after Undo, then edit the restored query to verify that execution resumes.
  • Keyboard Enter, Close, repeated selection, copy notifications, and dismissal of an older notification were also exercised.

Security review

The separate branch security review found no actionable issues. Example URLs contain only the built-in examples. Release of the in-memory Undo action was checked on dismissal, and stale completions were checked against restored output. A server can still finish processing a request that it has already received.

Risk and rollback

Medium risk. Undo interacts with debounced jq execution and HTTP requests that can have side effects. The main check for reviewers is that Undo restores a completed POST and its output while the browser's Network panel still shows a single POST.

Revert this PR to roll back the feature. There is no database or storage migration.

Codex implemented the change and supplies the automated reviews, so implementation and review are from the same vendor.

Rulings I made

  • Use disposable Linux Chromium for the browser checks. It supports a real Ctrl-click and the mocked worker POST. Vitest covers the macOS Meta-key predicate.

  • Dismiss an existing Undo when the same example is selected again. Otherwise a no-op selection would leave an older restore action visible.

  • Rebase onto the merged Place Output above JSON on narrow viewports #405 layout change before final review because both changes touch Playground. Repeat the browser and CI checks on the rebased head.

  • Restore settled local jq output verbatim. A pending local query can run again. For an interrupted HTTP request, show that its response is unavailable and keep the request count unchanged.

Cheatsheet after opening an example in another tab, original workspace intact (1440 × 900)

Example loaded in place with Undo and Close, raw-output flag cleared (1440 × 900)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 6, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-06T05:47:05.896990Z 0377f3d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@owenthereal

Copy link
Copy Markdown
Member Author

Owen, this is ready for your review and merge decision at 0377f3d050ded038839eb5d3690cda0ff1246bf0. I recommend merging this head after your review.

CI passed, Codex’s GitHub review completed with no findings, and there are zero unresolved review threads. The separate security review found no actionable issues. Local verification passed lint, all 134 tests, the production build, and all seven planned Chromium scenarios.

The change is medium risk because restoring an HTTP workspace can affect requests with side effects. For your review, use a disposable POST endpoint with the Network panel open. Load a cheatsheet example, reopen the HTTP tab, then click Undo. The original method, fields and completed output should return with a single POST in Network. The automated check exercised this exact sequence. For a quick native macOS check, Cmd-click a cheatsheet example and confirm it opens in a new tab while the original dialog and work stay in place.

@owenthereal
owenthereal merged commit a6cf8ed into main Dec 6, 2026
1 check passed
@owenthereal
owenthereal deleted the pipeline/cheatsheet-links-and-undo branch December 6, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loading an example erases a user's work

1 participant