Repository navigation
Closed
Description
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', acorrectionstamp, acorrectslink): 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:noneper 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.
Metadata
Metadata
Assignees
Labels
No labels
Activity
feat(summaries): make summary prose correctable in place (sovereign u…
Make summary prose correctable in place (sovereign user revisions) (#251
Ambisphaeric commentedon Jul 18, 2026
Closing evidence — landed via PR #251, merge
4f51b72, main CI greenPer acceptance criterion (relative paths,
file:line+ test names):Engine — correction write-path + sovereignty.
shared/contracts/src/records/summary.ts:153source: 'model' | 'user'(absent ⇒ model, back-compat:129–:130);:152proposalrelaxed to boolean;SummaryCorrectionstamp +correctslink (:98). Generated schemas committed (zero-drift):shared/contracts/schemas/Summary.json,SummaryCorrection.json,CorrectSummaryRequest.json; plusshared/contracts/src/api/payloads.ts,routes.ts;shared/contracts/src/contracts.test.tsextended.apps/engine/src/store/workspaces.ts:393resolveSummaryHeads— supersession + sovereignty keyed by the re-derivation-stable(session, level, window)identity; asource:'user'row outranks every machine revision on that key.correctSummarymintssource:'user'rows with STRUCTURAL provenance only; the machine chain is retained underincludeSuperseded(:335,:390); survives re-derivation ANDmoveSession.apps/engine/src/api/http.ts:1233POST /summaries/correct→:2124correctSummary→store.correctSummary:2131. Producer read path resolves heads inapps/engine/src/index/produce-summaries.ts.Acceptance bar — sovereignty proof (outrank machine AND survive re-derivation).
apps/engine/src/index/summaries-correct.test.ts:44correct → re-run producer (even a NEW machine revision) → read still returns the user text;:103correcting a degraded summary is refused (nothing to correct until a model connects).apps/engine/src/api/summaries-correct-e2e.test.ts:56POST /summaries/correctrecords a sovereign revision thatGET /summariesreturns and a re-build cannot defeat.Client — edit affordance, wired end-to-end, honest states.
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.apps/client/src/surfaces/hud/summary-correct.ts—SummaryEditSessionwith 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 viaregistry.tsand the nestedrerenderIntocomposition indev-entry.ts(chat input + editor coexist). Correction targets the summary identity, nevercurrent. "edited by you" marker isuser-select:noneviastyles.ts.apps/client/src/surfaces/hud/summary-correct-surface-e2e.test.ts)::223click pencil, type, save — corrected prose renders, persists on re-query, marks the row as your edit;:262a refused save surfaces an honest visible error line (raw reason on hover), never a silent no-op;:285focus survival — editor keeps focus, caret, and draft across a background live re-render;:314the pencil reaches the pad center summary.Privacy. A correction is a LOCAL write on the existing
consentFor/guardOptionsseams — 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.