Files
museion/docs/devlog/20261020-issue25-apply-skip-fix-cards-trust-ui_log.md
T
AlexKucera 4d33676a08
CI / ci (push) Canceled after 0s
feat(mentor): apply/skip fix cards (#25)
Fix Cards become actionable. Mechanical cards offer Apply behind a
blocking ask-before sheet showing the exact edit (anchored quote ->
replacement, occurrence + context; empty fix cuts); the sheet is the
only path to a write, one card at a time, no apply-all. The edit
lands through the editing session (pending edits flush first, the
editor re-seeds via adoptText, the card closes applied); Skip and
Done close the card in place, recording nothing; demonstration
cards close Done/Skip only (ADR-0006). Cards arrive ranked
(store-stamped, scan-ordered, open-first palette) and capped at ten
per submit — the app keeps the ranked head and the wire reply
discloses the drop. Stale anchors re-validate at apply: no text
selected or changed, the card flags itself. Includes the
finish-audit round (11 fixes, 2 flip-verified pins); 316 tests
green.

Closes #25
2026-10-20 16:46:43 +02:00

8.1 KiB
Raw Blame History

#25 M2: Apply/Skip Fix Cards & trust UI (S3.2–S3.3, S2.5)

Date: 2026-10-20 Type: issue Reference: git.babylondreams.de/Museion/issues/25

Goal

Implement #25 over the landed #24 pass substrate: findings as actionable Fix Cards — Apply writes the mechanical edit into the piece under the ask-before trust level (a blocking ask), Skip/Done close the card recording nothing, cards arrive ranked and capped per pass (an attention budget), stale anchors alert without touching text, trust levels visible in the UI. Then run the finish-audit reviewer fanout and fix what it flags.

What Was Done

  • Dependency check first: #24 (Run a Pass) closed — the blocked-by edge was satisfied before any work.
  • Three subagent slices at pre-agreed seams (parent owned scenarios, seams, verification, review aggregation):
    • Store — FixCardStore: passCardCeiling = 10 (submit keeps the ranked head, tail drops before validation), rank stamped 1-based in submit order, appliedText(of:in:) (pure span replacement, nil for demonstration lanes or unresolvable anchors), close(pieceURL:id:status:anchorStatus:) in-place status flip, Status enum (open|applied|skipped|done), scan sorts submittedAt DESC → rank ASC (nil last) → filename DESC.
    • Model/Session — PostsModel.applyCard/skipCard/doneCard → FixCardApplyOutcome (.applied|.stale|.refused); EditorSession.adoptText (Yes-reload's body with provided text: loadGeneration bump re-seeds both surfaces, immediate flush).
    • UI/Wire/ADR — FixCardsPalette became the work surface (open-first ordering, per-lane actions, blocking ApplyAskSheet, rank + ask-before meta, footer trust line); MCP schema descriptions declare the ranked ≤10 + fix-as-replacement contract; over-ceiling replies carry dropped_over_ceiling; ADR-0006 gains the governing sentence.
  • Consolidated DOX pass — Museion/AGENTS.md (FixCardStore, PostsModel, MCPServer, EditorSession, palette bullets), MuseionTests/AGENTS.md, ADR-0006.
  • finish-audit fanout (ponytail/security/general, parallel, exclusion-listed): 0 critical/high; 11 accepted fixes — converged stale-path try? → surfaced lastError; ask sheet scrolls untrusted text; adoptText refuses loadFailed sessions; occurrence + context in the ask; pollUntil asserts post-loop; 6 ponytail deletions (closeCard dedupe, storedCard shared / fixtureCard deleted, makePiece trim, dead filename pre-sort, decoded(in:) shared walk, wire-test seeder). 2 new pins, flip-verified (both failed with guards deleted in one batch, passed restored).
  • Verification: full suite 316/316 (299 pre-#25 → +11 slice pins → +2 audit pins), xcresult verdict Passed; swiftformat clean; scoped swiftlint unchanged posture; SwiftFairy audits zero findings on changed ranges; GitNexus impact pre-checked per symbol, detect-changes in scope only.

Decisions & Rationale

Decision Rationale
Mechanical fix field = the exact replacement for the anchored span (empty = cut) The only reading where Apply is a pure function without the app owning the tables; ADR-0006 sentence now pins it; sample-pass's "prose stands in for that rail" caveat covers the divergence from FC-10's prose fix
Ceiling = keep-the-ranked-head truncation, disclosed on the wire — not a tool error Slice 1 deviated from the throw-first contract and the parent kept it: a malformed 12th card can't error an otherwise-fine submit, the writer keeps the best findings, and dropped_over_ceiling keeps the wire honest
Rank stamped store-side from array order (like id/submittedAt) The persona's ranked call IS the rank; scan's filename order (slug-alphabetical within a shared stamp) loses it — the store preserves arrival order at the boundary
Apply routes through the session (adoptText), never disk-direct A disk-direct write would fight the dirty buffer and self-trigger the #67 conflict alert; flush-first + adopt keeps buffer and disk in agreement on both surfaces
adoptText guards loadFailed at the session (audit fix) flush() reports success on a clean no-op, so a never-loaded session would close cards .applied over a write that never landed; the guard lives at the write path (root cause), not in applyCard
Ask-before = the blocking sheet is the ONLY path from Apply to a write S2.5/S3.3 structurally: no apply-all, no batch, never-do needs no control because nothing auto-applies

Gotchas & Fixes

Problem Root Cause Fix
Slice 1's summary claimed done but scan never ordered by rank and close couldn't refresh anchorStatus Child self-reports drift from the contract; rank was stamped but unused Parent verified the landed diff against the seam contract before wave 2; both gaps folded into slice 2 as store addenda with pins
xcodebuild ... | grep | tail exits 0 regardless of test outcome Pipe exit status is the LAST command's Pull the verdict from the xcresult bundle (xcresulttool get test-results summary) — the grep filter can also eat the ** TEST SUCCEEDED ** line entirely
Prescribed -only-testing:MuseionTests/PostsModelTests ran nothing for slice 2 Suite-name filters don't run free functions (house convention); tests must live inside a struct suite Slice 2 put pins inside struct FixCardApplyTests and ran the full unit target instead
Parallel sibling builds transiently broke the shared app target Two agents editing one fs-synced project race the build Slices used separate -derivedDataPath roots; the broken run was re-run once the sibling landed
gitnexus detect-changes failed with "Multiple repositories indexed" Global registry holds 11 repos Always pass --repo museion
First line-length patch added a pointless + "" concat without shortening the line Improvised line-break instead of splitting the literal Split the raw string properly at the JSON boundary

Files Changed

File Change Summary
Museion/FixCardStore.swift Ceiling, rank, appliedText, close(anchorStatus:), Status enum, rank-sorted scan, shared decoded(in:)
Museion/PostsModel.swift applyCard/skipCard/doneCard + FixCardApplyOutcome (guards, stale persistence, surfaced close errors)
Museion/EditorSession.swift adoptText — programmatic text adoption + immediate flush, loadFailed guard
Museion/FixCardsWindow.swift Palette work surface: open-first, per-lane actions, blocking ask (scrolling, occurrence + context), trust meta/footer
Museion/MCPServer.swift Schema descriptions (ranked ≤10, fix-as-replacement), dropped_over_ceiling reply
MuseionTests/FixCardApplyTests.swift New — 11 scenario-headed pins incl. 2 flip-verified audit pins
MuseionTests/MCPToolsTests.swift Store pins + shared storedCard (internal, submittedAt/rank params)
MuseionTests/MCPServerWireTests.swift Wire ceiling pin + seedWirePiece helper
docs/adr/0006-fix-cards-travel-as-typed-mcp-tool-calls.md Mechanical-fix-as-replacement + ten-card ceiling sentence
Museion/AGENTS.md, MuseionTests/AGENTS.md, AGENTS.md DOX pass + generated GitNexus counter

Open Items & Next Steps

  • Closes #25 rides the commit — verify the tracker auto-close after push (webhook races a fast read; re-check once).
  • #6 (native deslop lint) is the next domino — it emits the lane: mechanical cards that make Apply commonplace; the deferred cumulative cards/ size cap lands with it or #26.
  • Deferred (security): provenance/emitter self-declared on the wire — ADR-0006 schema-by-design; revisit with a second client surface.
  • Deferred (security Info): card→piece binding relies on close()'s foreign-id throw; add an explicit binding check if a non-UI caller ever appears.
  • Deferred (review): outline-piece apply E2E needs a window-hosting harness (none in suite); the loadGeneration rail itself is pinned.
  • Deferred from #24: cancelAck fake mode for individually discriminating cancelPass's wire effect — still owed to the harness.

Log written by write-log skill