Skip to content

Make summaries correctable in place: sovereign user-corrected revisions #246

Closed

Description

@Ambisphaeric

Problem

The summaries block why-line tells the user a summary is "a draft you can correct" (apps/client/src/surfaces/blocks/summaries.ts), but no edit affordance exists anywhere in the client. The wired action verbs are a closed set (copy / mark-done / accept + glyph dismiss); the "user corrections sovereign" invariant is real in the store layer for claims/entity overrides but unreachable for summary prose from the pad.

Goal

Make summary prose correctable in place, with the correction stored as a sovereign, append-only user revision that outranks any machine revision on read and survives re-derivation.

Engine

  • Add a correction write-path for summaries. Summaries are append-only with supersession (apps/engine/src/index/produce-summaries.ts, apps/engine/src/store/workspaces.ts). Add a route that appends a user-corrected revision: same summary identity, corrected text, provenance/source marks it USER (never model), and it supersedes the machine row for reads.
  • Sovereignty is the acceptance bar: a user-corrected summary must outrank any machine revision AND survive re-derivation — if the producer regenerates that window/level, the user text still wins on read. Follow the existing claims/entity-override sovereignty precedent (pair-key resolution at read time).
  • Contract change if needed (source: 'model' | 'user', a correction stamp, a corrects link): make it in shared/contracts, regenerate schemas, commit the generated state (zero-drift gate applies to the regenerated state).

Client

  • An edit affordance on live summary rows: a small edit glyph consistent with existing affordance style → the row swaps to an editable field with save/cancel; save posts the correction; the row re-renders with the corrected text and an honest marker that the user corrected it (the marker is a decoration, so it is user-select:none per selection hygiene).
  • Wire the verb end-to-end (actions/interaction-lint honesty, the mount write-path). Degraded/empty rows get no edit affordance.

Tests

  • Sovereignty proof: correct → re-run producer → read still returns the user text.
  • A driven served e2e: click edit, type, save, assert the corrected text renders; re-query and assert it persists; simulate a failing save and assert an honest visible error line.
  • Copy stays value-only: after correction, Copy copies the corrected bare text.

Privacy

A correction is a LOCAL write — it must not create any new egress path. The summaries egress-seam tests must not be weakened.

Activity

  1. added a commit that references this issue on Jul 18, 2026
    b6d48b5
  2. added a commit that references this issue on Jul 18, 2026
    4f51b72
  3. Ambisphaeric commented on Jul 18, 2026

    @Ambisphaeric
    OwnerAuthor

    Closing evidence — landed via PR #251, merge 4f51b72, main CI green

    Per acceptance criterion (relative paths, file:line + test names):

    Engine — correction write-path + sovereignty.

    • Contract: shared/contracts/src/records/summary.ts:153 source: 'model' | 'user' (absent ⇒ model, back-compat :129–:130); :152 proposal relaxed to boolean; SummaryCorrection stamp + corrects link (:98). Generated schemas committed (zero-drift): shared/contracts/schemas/Summary.json, SummaryCorrection.json, CorrectSummaryRequest.json; plus shared/contracts/src/api/payloads.ts, routes.ts; shared/contracts/src/contracts.test.ts extended.
    • Store: apps/engine/src/store/workspaces.ts:393 resolveSummaryHeads — supersession + sovereignty keyed by the re-derivation-stable (session, level, window) identity; a source:'user' row outranks every machine revision on that key. correctSummary mints source:'user' rows with STRUCTURAL provenance only; the machine chain is retained under includeSuperseded (:335, :390); survives re-derivation AND moveSession.
    • Route: apps/engine/src/api/http.ts:1233 POST /summaries/correct → :2124 correctSummary → store.correctSummary :2131. Producer read path resolves heads in apps/engine/src/index/produce-summaries.ts.

    Acceptance bar — sovereignty proof (outrank machine AND survive re-derivation).

    • apps/engine/src/index/summaries-correct.test.ts:44 correct → re-run producer (even a NEW machine revision) → read still returns the user text; :103 correcting a degraded summary is refused (nothing to correct until a model connects).
    • Served: apps/engine/src/api/summaries-correct-e2e.test.ts:56 POST /summaries/correct records a sovereign revision that GET /summaries returns and a re-build cannot defeat.

    Client — edit affordance, wired end-to-end, honest states.

    • Pencil affordance on supported live rows: apps/client/src/surfaces/blocks/summaries.ts:33; verbs registered so no rendered affordance is a silent dead button: :19–:21 (summary-edit / summary-edit-cancel / summary-correct). Degraded/empty rows get no affordance.
    • Controller apps/client/src/surfaces/hud/summary-correct.ts — SummaryEditSession with the fix(chat): input keeps focus/caret/IME across refresh, Enter submits, calm status strip (#222) #225 focus/caret/IME snapshot-restore (:66–:72) so the ~1/s live re-render never trashes the editor; wired via registry.ts and the nested rerenderInto composition in dev-entry.ts (chat input + editor coexist). Correction targets the summary identity, never current. "edited by you" marker is user-select:none via styles.ts.
    • Served e2e (apps/client/src/surfaces/hud/summary-correct-surface-e2e.test.ts): :223 click pencil, type, save — corrected prose renders, persists on re-query, marks the row as your edit; :262 a refused save surfaces an honest visible error line (raw reason on hover), never a silent no-op; :285 focus survival — editor keeps focus, caret, and draft across a background live re-render; :314 the pencil reaches the pad center summary.

    Privacy. A correction is a LOCAL write on the existing consentFor / guardOptions seams — no new egress path; the summaries egress-seam tests are unweakened.

    Verdict history (system): first fresh-eyes pass was NOT-FIT — a live-refresh focus/caret loss on the new editor (the #225 focus-thief recurring on a new input surface), raw NUL bytes in store/workspaces.ts, and a trivial rebase conflict. All repaired pre-merge (full #225 snapshot/restore incl. IME defer/flush, adversarially probed for clobber/restore-war; NULs escaped byte-identically, proven by an identical correction-id hash) and re-verified FIT.

    Gates at merge head: contracts 114 · client 636 · engine 1142; schema regen zero-drift; main CI green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions