Skip to content

feat(scroll): P6.7 block provenance (agent change-bar) — P6 CLOSE - #73

Merged
github-actions[bot] merged 2 commits into
mainfrom
p6.7-provenance
Jul 27, 2026
Merged

github-actions[bot] merged 2 commits into
mainfrom
p6.7-provenance

Conversation

@cordialApple

Copy link
Copy Markdown
Owner

Render which blocks the native agent authored — the last piece of P6, so this closes the phase.

What

  • lastAuthor CRDT field ('agent' | 'human') on the block Y.Map. It lives IN the CRDT (not a Yjs transaction origin, which does not survive network sync) so every peer sees who wrote each block. blockAuthor() reads + validates it (garbage off the wire → undefined); setBlockAuthor() stamps idempotently; setBlockText(...author?) stamps in the SAME transaction (no per-keystroke double render); blockViewOf() is the shared builder and OMITS author when unset (unstamped BlockView stays {id,type,text}).
  • Agent driver stamps 'agent' on its target, inside the SAME proposal as the edit — one commit the authority guard-checks as a single op.
  • Human typing clears to 'human' (last-writer-wins). Structural edits (split/merge) do NOT re-author: the split tail INHERITS the source author, the merge survivor keeps its own — authorship follows content, not the Enter/Backspace.
  • Layout-safe gutter change-bar — data-author + an absolutely-positioned ::after in the sheet's left gutter. Zero reflow (the P6.1 invariant): no padding/border on the block, and ::after (not ::before) so it never collides with the :empty::before strut that keeps an empty block from collapsing.

Gate

simplifier → 4 parallel inspectors (one lens each) → adjudicator PASS. The inspectors surfaced two execution-proven blockers, both fixed with independently-reproduced teeth:

  1. Author-only proposal bypassed the spatial guard. The guard signature was {id,type,text-delta}, so a setBlockAuthor-only change (the shape the driver emits when its actor no-ops) into a live reader's band committed unchecked. FIX: the guard signature now includes lastAuthor — an author stamp into a guarded band is refused like any edit. (Regression tests: author-only into a guarded band → refused; author-only on a cold block → commits.)
  2. Split/merge stamped false 'human' provenance on unchanged (possibly agent-authored) content. FIX: structural edits follow content — the tail inherits the source author, the survivor keeps its own, no false stamp.

Plus: marker ::before→::after (an empty agent block otherwise lost its anti-collapse strut → reflow), blockAuthor wire-validation, and a per-block provenance tie in the milestone e2e (a partial-stamp regression now fails, not just total removal).

  • 272 pass / 3 skip, tsc -b --noEmit = 0.

Debt (logged, non-blocking)

  • W1 — the split/merge fix at the Editor.tsx layer has no regression test (the model-primitive tests pass on the buggy commit too, since the bug was the editor stamping after the primitive). No React/Editor render harness in-repo; the fix is read-verified and preventDefault guarantees no onEdit path fires on split/merge.
  • W2 — the ::after no-reflow invariant is inspection-verified only (no CSS harness).
  • MF6 — the driver stamps target regardless of which blocks a future richer actor touches (latent today; the one actor touches only target). Stamp per-touched-block when richer actors land.
  • TF5 — data-author is unasserted in any e2e (no agent-in-browser harness); the attribute pass-through is trivial and model + persistence are covered.
  • Coarse merge — mergeIntoPrevious can't represent a mixed-authorship survivor (it keeps its own author).

Closes #72.

🤖 Generated with Claude Code

https://claude.ai/code/session_01X7WHDHurYHVibsjwvevzFr

@cordialApple cordialApple added the automerge auto-merge when CI green label Jul 27, 2026
@github-actions
github-actions Bot enabled auto-merge (squash) July 27, 2026 19:59
@github-actions
github-actions Bot merged commit 28bb3a3 into main Jul 27, 2026
4 checks passed
@cordialApple
cordialApple deleted the p6.7-provenance branch July 27, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge auto-merge when CI green

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P6.7: provenance rendering (agent-authored blocks) — P6 CLOSE

1 participant