Skip to main content

Module ipc_corruption

Module ipc_corruption 

Source
Expand description

§Module: ipc_corruption

§Spec

Forensic detector for the #ipcfullprompt corruption shape: a full-document editor-side IPC mutation (e.g. PatchWatcher.setText) that deletes or duplicates a previously-committed assistant ### Re: response block while the user is typing a live prompt. The binary’s IPC snapshot-adoption guards fail closed against the snapshot, but the editor-visible buffer can still be corrupted; this detector turns each occurrence into a durable forensic signal (default-on capture) without changing any mutation behavior.

  • detect_response_block_corruption compares a prior document (the committed baseline) against a current document (the live editor buffer / candidate) and returns one finding per prior ### Re: heading that is now absent (deleted) or appears more times than it did in prior (duplicated).
  • summarize_findings renders findings as a compact, single-line, ops.log-friendly string.

§Agentic Contracts

  • Detection only. This module never mutates a document or changes an adoption decision. A finding is a forensic log signal, not a block.
  • Only headings that were present in prior are considered, so a brand-new response added this cycle (present in current, absent from prior) is never flagged — that is expected growth, not corruption.
  • Heading identity ignores the working-tree-only (HEAD) annotation and leading/trailing whitespace, matching how the rest of the binary treats the (HEAD) boundary artifact.

§Evals

  • detect_flags_deleted_prior_response
  • detect_flags_duplicated_prior_response
  • detect_ignores_new_response_block
  • detect_ignores_head_annotation_difference
  • detect_clean_document_has_no_findings

Structs§

IpcCorruptionFinding
One detected corruption of a previously-committed response block.

Enums§

IpcCorruptionKind
The kind of #ipcfullprompt corruption detected for a response heading.

Functions§

detect_duplicated_scaffold
Detect a duplicated structural scaffold in current (a self-check; no prior needed). Counts only lines that, when trimmed, exactly equal a canonical structural marker — so an inline mention inside response prose does not inflate the count — and returns one finding per marker that appears more than once. This is the #ipcfullprompt full-tail-duplication signature that detect_response_block_corruption (which keys on ### Re: headings) misses.
detect_response_block_corruption
Detect the #ipcfullprompt corruption shape by comparing the committed prior document against the live current (candidate) document.
summarize_findings
Render findings as a compact single-line summary for ops.log. Truncates each heading so a long topic cannot blow up the log line.