Realign code with the 2026-07-31 findings-resolution rulings
The full bullet list from Implementation card bf080d9a — both ruling batches, including the three appended mid-session by16ef377: - Restore subjects compose the inverse, never nest: crossing "Undo: S" emits "Redo: S" and vice versa; parity, not stack depth, reads a legacy double prefix (GitHistoryProvider.restoreSubject). - Git-operation failures join the one-shot failure banner tier: BannerCenter.GitFailureBanner (undo/redo/branchSwitch/addGit), error tone at failure rank merged with write one-shots by recency; the postLoss compromise is retired at both AppModel wirings. - order/schema optional below the board root: append-at-end reading (ordered siblings first, folder-name tie-break among the order-less), schema reads 1, both coerce-tier logged; the root keeps its requirements. Ranks.resolvedOrders materializes finite ranks so models and placement math stay untouched; first Writer rewrite stamps a real rank on touch, placement against an order-less sibling stamps that sibling inline in the same bracket. Agent guide v10 teaches optional keys and zero-read filing. Hostile-YAML order shapes become coercion tests; Fixtures/Valid/optional-keys.kanban replaces the four retired Malformed boards. - .gitignore is the relocation-heal noise gate: GitignoreRules pure matcher (standard semantics, board-root file only), loader consults it once per walk so matched loose files keep the stray posture; seeded (.DS_Store + .*.lanework-*) at board creation and template instantiation, healed in when missing at open — repo-nested included; empty file honored, existing files never edited; the committer's obedience via libgit2 status is pinned by test. - Comments crash-residue sweep gates on step ownership: HistoryStep derives backing from its own undo expectations, backedContent unions both stacks, the sweep purges per-entry only what no live step owns. - Skip-purge decoupled (16ef377): a stale-skipped coarse step strands whole in NativeHistoryProvider.strandedSteps — still backing, retired only at session end; clean exits purge as before. - Coarse close step named "Changes to '<card>'"; the fine body-edit wording never leaks onto the board menu. - Branch-switch settle clears every open card window's fine stack on Save All and Discard alike; the empty fold registers no coarse step. - Close flush awaits its covering snapshot (quiesce + one generation bump, 1s bound), and an explicit flush now queues behind an in-flight one instead of skipping — the audit-caught interleaving could lose a close flush permanently when the debounce fired inside the close sequence; regression tests force both races. - Commit comment bullets sort chronologically by created, not UUID. - The production-unwired CardBodyEditSession.editSessionDidChange seam is deleted with its seam-only tests. - Composition-root pins: beginSession composes the committer with the store's own EchoLedger and binds the announcer (the miswire class). - Deliberate 06 conformance pass over every 2026-07-31-tagged sentence: fixed Change-custom-key subjects (the retired named generic was the only producer), the unbuilt Replace attachment vocabulary, heal commits now authored Lanework Integrity, the config reader scopes identity to plain [user] sections, add-git re-runs detection at create (a stale mode-none could initialize inside the user's repo), and add-git failures answer at the form or the banner. Structural residue filed on the Redesign board. 2554 tests / 439 suites green. Claude-Session: https://claude.ai/code/session_01CqjXB7ASoWtbyoGod68k97
This commit is contained in:
@@ -109,7 +109,11 @@ private func compose(
|
||||
isRootCommit: false,
|
||||
snapshot: try after.snapshot(),
|
||||
previousSnapshot: try before.snapshot(),
|
||||
agentGuideText: guideText
|
||||
agentGuideText: guideText,
|
||||
// Resolved the way a flush resolves it — off the "after" tree, through the committer's own
|
||||
// reader — rather than hand-assembled, for the same reason both snapshots are loaded rather
|
||||
// than built: a map the flush could never produce would prove nothing about the flush.
|
||||
commentTimestamps: GitAutoCommitter.commentTimestamps(for: paths, boardRoot: after.root)
|
||||
))
|
||||
}
|
||||
|
||||
@@ -201,6 +205,37 @@ struct CommitMessageSingleEventTests {
|
||||
#expect(message == "Remove 'spec.pdf' from card 'Fix login'")
|
||||
}
|
||||
|
||||
@Test("A rewritten attachment composes Replace — never the anonymous path generic")
|
||||
func replacingAFile() throws {
|
||||
// Added 2026-07-31: "a changed file under a card's `attachments/` with an unchanged listing is
|
||||
// a content replacement, named from the path alone". The listing is unchanged here — same
|
||||
// name, new bytes — so the snapshot diff has nothing to say and the path says it instead.
|
||||
let message = try compose { fixture in
|
||||
try baseBoard(fixture)
|
||||
try fixture.file("\(Ident.lane1)/\(Ident.card1)/attachments/photo.png", Data("old".utf8))
|
||||
} change: { fixture in
|
||||
try fixture.file("\(Ident.lane1)/\(Ident.card1)/attachments/photo.png", Data("new".utf8))
|
||||
}
|
||||
#expect(message == "Replace attachment 'photo.png' — card 'Fix login'")
|
||||
}
|
||||
|
||||
@Test("Two replaced attachments on one card fold plural, still naming the card")
|
||||
func replacingSeveralFiles() throws {
|
||||
let message = try compose { fixture in
|
||||
try baseBoard(fixture)
|
||||
try fixture.file("\(Ident.lane1)/\(Ident.card1)/attachments/photo.png", Data("old".utf8))
|
||||
try fixture.file("\(Ident.lane1)/\(Ident.card1)/attachments/spec.pdf", Data("old".utf8))
|
||||
} change: { fixture in
|
||||
try fixture.file("\(Ident.lane1)/\(Ident.card1)/attachments/photo.png", Data("new".utf8))
|
||||
try fixture.file("\(Ident.lane1)/\(Ident.card1)/attachments/spec.pdf", Data("new".utf8))
|
||||
}
|
||||
#expect(subject(of: message) == "Replace 2 attachments — card 'Fix login'")
|
||||
#expect(body(of: message) == [
|
||||
"- Replace attachment 'photo.png' — card 'Fix login'",
|
||||
"- Replace attachment 'spec.pdf' — card 'Fix login'",
|
||||
])
|
||||
}
|
||||
|
||||
@Test("A repositioned card composes Reorder, naming its lane")
|
||||
func reorderingCards() throws {
|
||||
// A *foreign* single-file reorder: one card's rank crosses its sibling's, nothing else
|
||||
@@ -378,16 +413,56 @@ struct CommitMessageExternalSurfaceTests {
|
||||
#expect(try withKey("due: 2026-08-31") == "Set due date on card 'Fix login'")
|
||||
}
|
||||
|
||||
@Test("An unmodeled custom key composes a named generic — never a board-level shrug")
|
||||
func customKeysComposeANamedGeneric() throws {
|
||||
@Test("An unmodeled custom key says what it is, with its values in the body")
|
||||
func customKeysSayWhatTheyAre() throws {
|
||||
// Re-ruled 2026-07-31: the named generic ("Update card 'X'") is retired here — "first lines
|
||||
// self-describe; generics are a last resort". One key, so the singular.
|
||||
let message = try compose { fixture in
|
||||
try fixture.item(
|
||||
"\(Ident.lane1)/\(Ident.card1)",
|
||||
"---\nschema: 1\ntitle: Fix login\norder: 1024\nsprint: 42\nestimate: 3\n---\n\n"
|
||||
"---\nschema: 1\ntitle: Fix login\norder: 1024\nsprint: 42\n---\n\n"
|
||||
)
|
||||
}
|
||||
// Two custom keys, one event: the item is what is named, not the keys.
|
||||
#expect(message == "Update card 'Fix login'")
|
||||
#expect(subject(of: message) == "Change custom key on card 'Fix login'")
|
||||
#expect(body(of: message) == ["sprint: (none) → 42"])
|
||||
}
|
||||
|
||||
@Test("Several custom keys fold plural on one item, each named with its old → new values")
|
||||
func customKeysFoldPlural() throws {
|
||||
let message = try compose { fixture in
|
||||
try baseBoard(fixture)
|
||||
try fixture.item(
|
||||
"\(Ident.lane1)/\(Ident.card1)",
|
||||
"---\nschema: 1\ntitle: Fix login\norder: 1024\nsprint: 41\nestimate: 3\n---\n\n"
|
||||
)
|
||||
} change: { fixture in
|
||||
try fixture.item(
|
||||
"\(Ident.lane1)/\(Ident.card1)",
|
||||
"---\nschema: 1\ntitle: Fix login\norder: 1024\nsprint: 42\n---\n\n"
|
||||
)
|
||||
}
|
||||
// Two keys, one event — the item is still what the subject names — and the body carries both
|
||||
// sides of each, a removal reading as a move to absence.
|
||||
#expect(subject(of: message) == "Change 2 custom keys on card 'Fix login'")
|
||||
#expect(body(of: message) == ["estimate: 3 → (none)", "sprint: 41 → 42"])
|
||||
}
|
||||
|
||||
@Test("A lane's and the board's custom keys name their item too — never a board-level shrug")
|
||||
func customKeysNameLanesAndTheBoard() throws {
|
||||
let lane = try compose { fixture in
|
||||
try fixture.item(
|
||||
Ident.lane1,
|
||||
"---\nschema: 1\ntitle: Todo\norder: 1024\nwip-limit: 5\n---\n\n"
|
||||
)
|
||||
}
|
||||
#expect(subject(of: lane) == "Change custom key on lane 'Todo'")
|
||||
|
||||
// The board is the case 06 calls out by name: "never a board-level shrug when the touched item
|
||||
// is identifiable" — and the board is identifiable, by its own title.
|
||||
let board = try compose { fixture in
|
||||
try fixture.item("", "---\nschema: 1\ntitle: Board\nsprint-length: 2w\n---\nBoard description.\n")
|
||||
}
|
||||
#expect(subject(of: board) == "Change custom key on board 'Board'")
|
||||
}
|
||||
|
||||
@Test("A foreign change composes identically to an app-mediated one")
|
||||
@@ -750,6 +825,103 @@ struct CommitMessageCommentTests {
|
||||
}
|
||||
#expect(message == "Delete card 'Fix login'")
|
||||
}
|
||||
|
||||
// MARK: The chronology
|
||||
|
||||
/// A comment's `index.md` with a `created` stamp — the one field the ordering below reads, written
|
||||
/// in the YAML 1.1 timestamp grammar the loader accepts (`FrontmatterFields.date`).
|
||||
private static func datedComment(_ body: String, created: String) -> Data {
|
||||
Data("---\nschema: 1\nkind: comment\nauthor: Ada\ncreated: \(created)\n---\n\(body)\n".utf8)
|
||||
}
|
||||
|
||||
/// **"A commit's comment bullets sort chronologically … never UUID-arbitrary"** (06 ▸ Rules
|
||||
/// ▸ Auto-commit, blessed 2026-07-31).
|
||||
///
|
||||
/// Three comments on one card, each with a *different verb* so the bullets are distinguishable,
|
||||
/// and identities deliberately ordered against their chronology: the earliest comment carries the
|
||||
/// middle UUID and the latest carries the smallest. Folder-name order would read Edit, Comment,
|
||||
/// Delete; the conversation happened in the other order, and that is what the body says.
|
||||
@Test("Comment bullets read in the order the conversation did, not in UUID order")
|
||||
func commentBulletsSortByCreated() throws {
|
||||
let card = "\(Ident.lane1)/\(Ident.card1)"
|
||||
let message = try compose { fixture in
|
||||
try baseBoard(fixture)
|
||||
// Posted first, and edited in this window: the latest `created`, the smallest UUID.
|
||||
try fixture.file(
|
||||
Self.thread(Ident.card1, Self.commentA),
|
||||
Self.datedComment("First draft.", created: "2026-07-31T12:00:00Z")
|
||||
)
|
||||
// Deleted in this window, so it exists before and moves into `comments/.trash/`.
|
||||
try fixture.file(
|
||||
Self.thread(Ident.card1, Self.commentC),
|
||||
Self.datedComment("Regretted.", created: "2026-07-31T11:00:00Z")
|
||||
)
|
||||
} change: { fixture in
|
||||
try fixture.file(
|
||||
Self.thread(Ident.card1, Self.commentA),
|
||||
Self.datedComment("Second thoughts.", created: "2026-07-31T12:00:00Z")
|
||||
)
|
||||
// Posted in this window — the earliest `created`, the middle UUID.
|
||||
try fixture.file(
|
||||
Self.thread(Ident.card1, Self.commentB),
|
||||
Self.datedComment("Said hours ago.", created: "2026-07-31T10:00:00Z")
|
||||
)
|
||||
try fixture.moveFolder(
|
||||
"\(card)/comments/\(Self.commentC)",
|
||||
to: "\(card)/comments/.trash/\(Self.commentC)"
|
||||
)
|
||||
}
|
||||
|
||||
#expect(body(of: message) == [
|
||||
"- Comment on 'Fix login'",
|
||||
"- Delete comment on 'Fix login'",
|
||||
"- Edit comment on 'Fix login'",
|
||||
])
|
||||
}
|
||||
|
||||
/// "**folder name on ties**" — and the name that breaks the tie is the *comment's* folder, not the
|
||||
/// composite key the groups are gathered under. Two cards, one timestamp: the comment named
|
||||
/// `…0001` speaks first even though its card sorts second.
|
||||
@Test("Comments created at the same moment fall back to folder name, never to the card's path")
|
||||
func tiesFallBackToTheFolderName() throws {
|
||||
let stamp = "2026-07-31T09:30:00Z"
|
||||
let message = try compose { fixture in
|
||||
// On the *first* card, the larger identity.
|
||||
try fixture.file(
|
||||
Self.thread(Ident.card1, Self.commentC),
|
||||
Self.datedComment("On Fix login.", created: stamp)
|
||||
)
|
||||
// On the second card, the smaller one.
|
||||
try fixture.file(
|
||||
Self.thread(Ident.card2, Self.commentA),
|
||||
Self.datedComment("On Ship it.", created: stamp)
|
||||
)
|
||||
}
|
||||
|
||||
#expect(body(of: message) == [
|
||||
"- Comment on 'Ship it'",
|
||||
"- Comment on 'Fix login'",
|
||||
])
|
||||
}
|
||||
|
||||
/// The undated sort **after** the dated — `CommentThread.sorted`'s own fallback, applied one layer
|
||||
/// up. The undated comment here carries the smallest identity, so folder-name order alone would
|
||||
/// have put it first.
|
||||
@Test("A comment with no readable created sorts after its dated siblings")
|
||||
func undatedCommentsSortLast() throws {
|
||||
let message = try compose { fixture in
|
||||
try fixture.file(Self.thread(Ident.card1, Self.commentA), Self.commentText("No stamp at all."))
|
||||
try fixture.file(
|
||||
Self.thread(Ident.card2, Self.commentB),
|
||||
Self.datedComment("Stamped.", created: "2026-07-31T08:00:00Z")
|
||||
)
|
||||
}
|
||||
|
||||
#expect(body(of: message) == [
|
||||
"- Comment on 'Ship it'",
|
||||
"- Comment on 'Fix login'",
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Repair
|
||||
|
||||
Reference in New Issue
Block a user