Skip to content

Copy as Report: reviewed Markdown/plain reports from command blocks - #360

Closed
raiseCatError wants to merge 40 commits into
feature/copy-selectionfrom
feature/copy-report
Closed

raiseCatError wants to merge 40 commits into
feature/copy-selectionfrom
feature/copy-report

Conversation

@raiseCatError

@raiseCatError raiseCatError commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Copy as Report builds Markdown or plain text from stored command records and opens explicit review. Enter copies exactly the reviewed text; cancel preserves the clipboard. Source fragments are sanitized/redacted before authored Markdown, toggles rebuild from stable snapshots, and edits are rescanned and labelled when unredacted. Short reviews keep body rows reachable and refuse approval when they cannot fit. Backtick enclosure stays bounded for hostile or long input. Detection is best-effort; external clipboard failure cannot guarantee rollback of bytes already written.

The additive stabilization fixes catchable startup termination and frontend cleanup. SIGTERM/SIGHUP handlers precede host-probe/journal waits; stopped probe completion cannot create a journal, and saves already underway retain durability. Stop removes only the frontend's instance-owned exit callback, preventing retention across session switches while preserving unrelated listeners. Controlled regressions fail before correction and pass afterward; assertions and deadlines are unchanged.

The reattach fixture waits for the complete final-size native pager frame and prompt before a single quit key, retaining original deadlines and strict cleanup. Bounded failure-only observations distinguish repaint from quit completion. Controlled native less read/WINCH evidence establishes a signal/input hazard; it does not reconstruct historical CI failures.

Native completion retains fragmented readiness within a bounded initialization buffer and recognizes the complete LF/CRLF marker without resetting existing budgets. A real-PTY regression fails before correction and passes afterward, including naturally fragmented reads. This independently confirmed framing fix does not establish the historical Copy recovery failure cause.

Clipboard completion requires an error-free payload-write callback and the backend’s own successful exit, retaining original error/timeout/process cleanup safeguards. Real-child regressions cover suppressed finish, partial reads and callback errors after exit. Early fullscreen startup regressions submit before the notice through the actual editor/submit pipeline, including delayed journal startup; original input/abort/ownership assertions remain intact. This proves independently controlled defects/fixture assumptions, not the precise historical failure causes.

Published head: cb28d4586197e563e4f98c1f0a96e9e3b8f95251. Focused lifecycle/startup/clipboard, clean exact-head canonical build/full runtime/ranking/cleanup/diff verification pass. Comprehensive candidate CI 38567509019 passes every required job, including Fedora/timing; actual PR CI 38568288217 passes applicable platform/runtime/aggregate gates. Attempts: 1/1.

Shared acceptance, exact ancestry, remaining gates and retained historical failures are tracked in #359 and the durable handoff. Historical macOS/Ubuntu failures remain unattributed; new passes do not explain them. Native pager input during concurrent resize remains a physical QA limitation. Forced SIGKILL can bypass detached-helper cleanup while trusted configuration blocks it. No release/master merge or frontend integration occurs here.

Physical QA remains unperformed in Ghostty/Terminal.app across zsh, Bash and Fish: actual clipboard bytes, cancellation/backend failure, edits/toggles and hostile Markdown/control/Unicode input at narrow and short sizes. Automated/headless results do not claim this validation.

Refs #351
Refs #359
Refs #363

…-text report

- /copy … --report (Markdown) or --report=plain, and /cp alike; the picker's r; Actions → Copy as
  report…. Built from the command records only: command, recorded status, exit code, duration, and
  optionally directory and start time; output in a fence longer than any backtick run inside it.
- Redaction (on by default) replaces common token, key and credential shapes, private-key blocks,
  email addresses and private paths (home as ~, other users' homes as <user>), and says what it
  changed. It is a pattern match, and the review says so.
- The review opens whenever the unredacted report looks sensitive (and always from the picker and
  Actions): the exact text to be copied, switches for redaction, format, directory and times, and e
  to correct it in VISUAL/EDITOR (a private temporary file, removed afterwards). Enter copies, Esc
  copies nothing.
- The same clipboard write, feedback and Auto-expand rule as every other copy; nothing is sent
  anywhere.
…dits are re-checked

A report is made to be shared and redaction is a pattern match, so a report never reaches the
clipboard unseen: /copy --report opens the review too (Enter copies). The review marks each line
redaction changed and lists their numbers, and text edited in VISUAL/EDITOR is scanned again and
called out when it still looks sensitive. Redaction also covers --password/--token style flags,
Cookie and Set-Cookie headers, PGP private-key blocks and Stripe secret keys.
- Invisible format characters (zero-width spaces and joiners, bidi overrides, soft hyphens) are
  removed from reports and from edits before scanning, so a secret cannot slip past redaction
  behind characters the review never shows.
- Token shapes are found when glued to a word character (build_ghp_..._done), not only at \b.
- The review wraps long lines instead of cutting them, and the more-below row no longer covers a
  line: every character Enter copies has been on screen. Enter copies exactly the reviewed text.
…sted and parsed

- U+2028/U+2029 become real line breaks before fences are sized: editors and Markdown readers
  treat them as newlines, so a separator inside output could otherwise close the fence on paste.
- Every default-ignorable code point is removed (variation selectors, fillers and other invisible
  characters, not only format characters).
- Patterns match a skeleton of the text (compatibility forms, combining marks dropped) mapped back
  to the original: full-width look-alikes or marks inside a token no longer hide it, and text outside
  a redacted span keeps its exact characters.
- The review counts any character a terminal may draw wider as two cells, so no row overflows and
  is cut.
@raiseCatError

Copy link
Copy Markdown
Owner Author

The failed actual published head remains 690ff65f8b356f2a9d06b399bff17befbca57c4e, CI 38500575001; no rerun or harmless-flake attribution.

The unchanged fixture reproduced the quit timeout on Ubuntu/less 590 with a live foreground pager and both PTYs at 35×110. A separate observation found the literal q in active raw passthrough and the client socket write; this is not proof through all later layers. A controlled native-only read/resize pair confirms less can consume a quit key yet skip decoding it when WINCH intervenes. It establishes an independent native hazard, not the historical CI's exact cause.

Test-only input candidate c9fcbf92701ef30d72a83e3cb75c31237dba160f now waits for the complete final-size pager frame plus explicit native prompt before one q, with the same repaint/completion deadlines and strict cleanup. Bounded observations cover either failing stage. Focused macOS checks, uninstrumented Ubuntu controls, fast verification and review passed; clean-head canonical is running. No new Report publication or freeze is claimed. All failed controls and setup-only failures are retained separately in the durable handoff. New exact heads still require canonical, security, Linux/Fish and final actual CI gates. Integration remains separate.

@raiseCatError

Copy link
Copy Markdown
Owner Author

Integrated, not merged here: this head (cb28d458) is part of the release line that shipped in v0.20.0 through the authoritative release PR #392 (merge commit 65e4de55). Closing because its changes reached master by that route; the branch is kept for history.

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.

1 participant