feat(mentor): apply/skip fix cards (#25)
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
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
This commit is contained in:
1 parent
5700264628
commit
4d33676a08
15 files changed
+1012
-74
No files matched your search
@@ -1,3 +1,3 @@
|
||||
# 0006 — Fix cards travel as typed MCP tool calls
|
||||
|
||||
Mentor findings reach the app as typed tool calls — the fix-card schema is the tool's argument schema — rendered from ACP tool-call events, never parsed out of streamed prose. Anchors are quote-based (exact substring + occurrence + context), so edits between issue and accept degrade to a loud no-match, never a wrong-span patch. One schema serves the card UI, the apply-write, and learning promotion; M0's round-trip test exercises exactly this rail. Every fix declares a lane — `mechanical` (the whole fix is a pure function of the anchor plus fixed tables: cut, move, mapping, case) or `demonstration` (any generation) — and only a mechanical fix is ever applied. Every card declares an emitter — `lint` or `engine` — so the engine never re-cards a live lint finding; provenance keeps skill attribution. Rejected: prose parsing (fragile, untyped) and file-watching spools (cards are conversation events, not artifacts).
|
||||
Mentor findings reach the app as typed tool calls — the fix-card schema is the tool's argument schema — rendered from ACP tool-call events, never parsed out of streamed prose. Anchors are quote-based (exact substring + occurrence + context), so edits between issue and accept degrade to a loud no-match, never a wrong-span patch. One schema serves the card UI, the apply-write, and learning promotion; M0's round-trip test exercises exactly this rail. Every fix declares a lane — `mechanical` (the whole fix is a pure function of the anchor plus fixed tables: cut, move, mapping, case) or `demonstration` (any generation) — and only a mechanical fix is ever applied. Every card declares an emitter — `lint` or `engine` — so the engine never re-cards a live lint finding; provenance keeps skill attribution. Rejected: prose parsing (fragile, untyped) and file-watching spools (cards are conversation events, not artifacts). A mechanical card's fix is the exact replacement for its anchored span (empty = cut) — the only edit Apply ever writes; submits are capped at ten cards, the app keeping the ranked head as backstop.
|
||||
@@ -0,0 +1,70 @@
|
||||
# #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](https://git.babylondreams.de/AlexKucera/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*
|
||||
@@ -5,6 +5,7 @@ Complete history of session logs in this directory, newest first. One-line summa
|
||||
<!-- write-log: full-index -->
|
||||
| Date | Type | File | Summary |
|
||||
|------|------|------|---------|
|
||||
| 2026-10-20 | issue | [20261020-issue25-apply-skip-fix-cards-trust-ui_log.md](20261020-issue25-apply-skip-fix-cards-trust-ui_log.md) | #25 Apply/Skip Fix Cards: ranked ≤10 ceiling, adoptText apply rail, blocking ask, audit fanout with 11 fixes — 316 tests green |
|
||||
| 2026-10-20 | issue | [20261020-issue24-pass-guard-matrix_log.md](20261020-issue24-pass-guard-matrix_log.md) | #24 close-out: verified against landed #23, pinned the full runPass guard matrix + cancelPass, finish-audit fanout — 299 tests green |
|
||||
| 2026-10-20 | issue | [20261020-issue23-museion-tools-mcp-server-dogfood-hardening_log.md](20261020-issue23-museion-tools-mcp-server-dogfood-hardening_log.md) | #23 museion-tools MCP server + fix-card store, Fix Cards palette, dogfood fixes (prompt timeout, persona, debug filter), 3-reviewer audit round — 296 tests green |
|
||||
| 2026-10-19 | issue | [20261019-issue123-ptacek-fold-text-landings_log.md](20261019-issue123-ptacek-fold-text-landings_log.md) | #123 card-emitting doctrine, lane/emitter terms, FC-10 mechanical exemplar landed across skills, CONTEXT, ADR-0006; deslop gap fixed at source |
|
||||
|
||||
Reference in new issue
Block a user