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:
@@ -427,6 +427,108 @@ struct FixtureBoardLevelDeletedTests {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Valid/optional-keys.kanban
|
||||
|
||||
/// **The optional-key ruling's golden board** (01-storage-format.md § Frontmatter and § Ordering,
|
||||
/// re-ruled 2026-07-31): below the board root `order` and `schema` are optional, a missing or
|
||||
/// unusable `order` reads as append-at-end, and a missing `schema` reads as 1. Every shape that used
|
||||
/// to have its own board under `Malformed/` lives here instead, as a coercion case.
|
||||
private enum OptionalKeys {
|
||||
static let rankedLane = "10000000-0000-4000-8000-000000000001"
|
||||
static let schemalessLane = "40000000-0000-4000-8000-000000000002"
|
||||
static let orderlessLane = "30000000-0000-4000-8000-000000000003"
|
||||
|
||||
static let rankedCard = "20000000-0000-4000-8000-000000000001"
|
||||
static let minimumCard = "20000000-0000-4000-8000-000000000002"
|
||||
static let nullOrderCard = "20000000-0000-4000-8000-000000000003"
|
||||
static let nonNumericCard = "20000000-0000-4000-8000-000000000004"
|
||||
static let nonFiniteCard = "20000000-0000-4000-8000-000000000005"
|
||||
}
|
||||
|
||||
struct FixtureOptionalKeysTests {
|
||||
|
||||
/// The strip: ranked lanes first in ascending order, then the order-less one — and the
|
||||
/// `schema`-less lane is an ordinary ranked lane, since only its `schema` was absent.
|
||||
@Test func orderlessLaneSortsAfterEveryRankedOne() throws {
|
||||
let model = try loadFixture("Valid/optional-keys.kanban").model
|
||||
#expect(model.lanes.map(\.id.rawValue) == [
|
||||
OptionalKeys.rankedLane, OptionalKeys.schemalessLane, OptionalKeys.orderlessLane,
|
||||
])
|
||||
#expect(model.lanes.map(\.order) == [1024, 2048, 3072])
|
||||
}
|
||||
|
||||
/// Four order-less cards behind one ranked one, in folder-name order — the tie-break the ruling
|
||||
/// states the reading in, and the accepted cost it names ("two order-less siblings sort by UUID
|
||||
/// rather than by intent until touched").
|
||||
@Test func orderlessCardsAppendInFolderNameOrder() throws {
|
||||
let model = try loadFixture("Valid/optional-keys.kanban").model
|
||||
let lane = try #require(model.lanes.first { $0.id.rawValue == OptionalKeys.rankedLane })
|
||||
#expect(lane.cards.map(\.id.rawValue) == [
|
||||
OptionalKeys.rankedCard,
|
||||
OptionalKeys.minimumCard,
|
||||
OptionalKeys.nullOrderCard,
|
||||
OptionalKeys.nonNumericCard,
|
||||
OptionalKeys.nonFiniteCard,
|
||||
])
|
||||
// `append`'s own arithmetic, which is what makes the reading stampable verbatim.
|
||||
#expect(lane.cards.map(\.order) == [1024, 2048, 3072, 4096, 5120])
|
||||
}
|
||||
|
||||
/// A missing `schema` below the root reads as 1 — at both levels.
|
||||
@Test func missingSchemaBelowTheRootReadsAsOne() throws {
|
||||
let model = try loadFixture("Valid/optional-keys.kanban").model
|
||||
let lane = try #require(model.lanes.first { $0.id.rawValue == OptionalKeys.schemalessLane })
|
||||
#expect(lane.schema == 1)
|
||||
|
||||
let ranked = try #require(model.lanes.first { $0.id.rawValue == OptionalKeys.rankedLane })
|
||||
let minimum = try #require(ranked.cards.first { $0.id.rawValue == OptionalKeys.minimumCard })
|
||||
#expect(minimum.schema == 1)
|
||||
#expect(minimum.title == .valid("Minimum Agent Card"))
|
||||
}
|
||||
|
||||
/// Every reading leaves a coerce-tier trace: field, path, and the text as written — an absent
|
||||
/// key having none to record (01-storage-format.md § Frontmatter, the family posture).
|
||||
@Test func everyReadingIsRecordedAsACoercion() throws {
|
||||
let result = try loadFixture("Valid/optional-keys.kanban")
|
||||
let byPath = Dictionary(
|
||||
uniqueKeysWithValues: result.coercedFrontmatter.map { ($0.path, $0.fields) })
|
||||
|
||||
func fields(_ path: String) throws -> [CoercedField] {
|
||||
try #require(byPath[path], "no coercion recorded for \(path)")
|
||||
}
|
||||
|
||||
#expect(try fields("\(OptionalKeys.orderlessLane)/index.md") == [CoercedField(key: "order", raw: "")])
|
||||
#expect(try fields("\(OptionalKeys.schemalessLane)/index.md") == [CoercedField(key: "schema", raw: "")])
|
||||
|
||||
let lane = OptionalKeys.rankedLane
|
||||
#expect(try fields("\(lane)/\(OptionalKeys.minimumCard)/index.md") == [
|
||||
CoercedField(key: "schema", raw: ""), CoercedField(key: "order", raw: ""),
|
||||
])
|
||||
#expect(try fields("\(lane)/\(OptionalKeys.nullOrderCard)/index.md")
|
||||
== [CoercedField(key: "order", raw: "")])
|
||||
#expect(try fields("\(lane)/\(OptionalKeys.nonNumericCard)/index.md")
|
||||
== [CoercedField(key: "order", raw: "banana")])
|
||||
#expect(try fields("\(lane)/\(OptionalKeys.nonFiniteCard)/index.md")
|
||||
== [CoercedField(key: "order", raw: ".nan")])
|
||||
|
||||
// Coerce-tier means read-side only: nothing here is work, so nothing carries a heal class.
|
||||
#expect(result.defects.allSatisfy { $0.healClass == nil })
|
||||
}
|
||||
|
||||
/// The whole board loads clean — no warnings, no fail-fast, and every file byte-identical after
|
||||
/// a parse/serialize round-trip: the bytes are preserved verbatim, which is the coerce tier's
|
||||
/// other half.
|
||||
@Test func loadsWithoutWarningsAndRoundTrips() throws {
|
||||
let result = try loadFixture("Valid/optional-keys.kanban")
|
||||
#expect(result.warnings.isEmpty)
|
||||
|
||||
for file in try allIndexMdFiles(under: fixtureBoard("Valid/optional-keys.kanban")) {
|
||||
let text = try String(contentsOf: file, encoding: .utf8)
|
||||
#expect(try FrontmatterDocument.parse(text).serialized() == text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Malformed/*.kanban — fail-fast cases
|
||||
|
||||
struct FixtureMalformedTests {
|
||||
@@ -436,6 +538,9 @@ struct FixtureMalformedTests {
|
||||
}
|
||||
}
|
||||
|
||||
/// **The board root's own `schema` is still required** (re-ruled 2026-07-31 — the
|
||||
/// this-really-is-a-board gate). Its below-the-root twin is `FixtureOptionalKeysTests`, where
|
||||
/// the same absence reads as 1.
|
||||
@Test func missingSchema() {
|
||||
expectFixtureFailure("Malformed/missing-schema.kanban", path: "index.md", reasonDescription: "missingSchema") {
|
||||
$0 == .missingSchema
|
||||
@@ -450,48 +555,6 @@ struct FixtureMalformedTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test func missingOrderOnLane() {
|
||||
let lane = "10000000-0000-4000-8000-000000000001"
|
||||
expectFixtureFailure(
|
||||
"Malformed/missing-order-lane.kanban", path: "\(lane)/index.md", reasonDescription: "missingOrder"
|
||||
) {
|
||||
$0 == .missingOrder
|
||||
}
|
||||
}
|
||||
|
||||
@Test func missingOrderOnCard() {
|
||||
let lane = "10000000-0000-4000-8000-000000000001"
|
||||
let card = "20000000-0000-4000-8000-000000000002"
|
||||
expectFixtureFailure(
|
||||
"Malformed/missing-order-card.kanban", path: "\(lane)/\(card)/index.md", reasonDescription: "missingOrder"
|
||||
) {
|
||||
$0 == .missingOrder
|
||||
}
|
||||
}
|
||||
|
||||
/// Explicit null reads as missing (01-storage-format.md § Malformed input): `order:` with
|
||||
/// nothing after it fails the same way a missing key does, not as `.malformedOrder`.
|
||||
@Test func explicitNullOrderReadsAsMissing() {
|
||||
let lane = "10000000-0000-4000-8000-000000000001"
|
||||
expectFixtureFailure(
|
||||
"Malformed/explicit-null-order.kanban", path: "\(lane)/index.md", reasonDescription: "missingOrder"
|
||||
) {
|
||||
$0 == .missingOrder
|
||||
}
|
||||
}
|
||||
|
||||
@Test func presentButNonNumericOrder() {
|
||||
let lane = "10000000-0000-4000-8000-000000000001"
|
||||
let card = "20000000-0000-4000-8000-000000000002"
|
||||
expectFixtureFailure(
|
||||
"Malformed/non-numeric-order.kanban",
|
||||
path: "\(lane)/\(card)/index.md",
|
||||
reasonDescription: "malformedOrder(banana)"
|
||||
) {
|
||||
$0 == .malformedOrder(raw: "banana")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func boardRootMissingIndex() {
|
||||
expectFixtureFailure(
|
||||
"Malformed/board-root-missing-index.kanban", path: "index.md", reasonDescription: "boardRootMissingIndex"
|
||||
|
||||
Reference in New Issue
Block a user