Cards open to be read — the mobile detail screen turns read-only, editing moves behind a transactional Save

CardDetailScreen renders title, inline-Markdown body, and a quiet dates
footer; all writing moves to the new CardEditScreen, a full-screen cover
with segmented Details/Body panes. Drafts commit in one perform bracket
on Save only — Cancel guards dirty drafts with a discard confirmation,
and a failed write keeps the sheet and its drafts and raises an alert
instead of dismissing. CardAttributesSection becomes a pure
binding-driven editor with no write path of its own. The UI test walk
crosses the new split, with body-pane and discard coverage, and a
deterministic replaceAllText helper retires the flaky ⌘A select-all.

Claude-Session: https://claude.ai/code/session_01SR4XGjmBE16ZUYWpfFHXwY
This commit is contained in:
2026-08-08 14:47:50 -04:00
parent 28abaac2d9
commit c4591ead2c
6 changed files with 580 additions and 164 deletions
@@ -208,6 +208,39 @@ extension XCUIApplication {
}
}
extension XCUIElement {
/// Replaces this field's/editor's entire text with `text`, wholesale.
///
/// **Neither A nor the long-press callout survived contact with this suite.** A is delivered
/// as a `UIKeyCommand` down the responder chain, and that routing is not guaranteed wired up the
/// instant `tap()` returns behind a `fullScreenCover`'s own presentation transition, or right
/// after a `TextEditor` is freshly mounted by a pane switch, A sent too early is silently
/// dropped while ordinary character input (a different, lower-level path) still lands, so the
/// retyped text ends up inserted at whatever the stale cursor position was rather than replacing
/// anything and a fixed settle before it only wins *sometimes*, because under a full suite
/// run's extra load the gap it needs to cover stretches past any delay worth hard-coding. The
/// long-press "Select All" callout fares worse: it never appeared at all in this environment (the
/// Simulator's hardware keyboard appears to suppress the touch selection UI outright).
///
/// What is left, and has been reliable through every run: plain character `typeText` always
/// lands, so the fix sidesteps selection entirely. A tap near the field's trailing/bottom edge
/// past wherever the current text actually ends is where both `UITextField` and `UITextView`
/// place the caret at the *end* of the text (the standard "tap in the empty run-out" behavior,
/// not an assumption this suite is inventing), which is what makes a plain backspace-per-character
/// safe here where the original in-place editor's own comment once ruled it out: that caveat was
/// about a tap landing *mid-text*, not about the technique itself.
@MainActor
func replaceAllText(with text: String) {
let trailingEdge = coordinate(withNormalizedOffset: CGVector(dx: 0.95, dy: 0.5))
trailingEdge.tap()
if let current = value as? String, !current.isEmpty {
typeText(String(repeating: XCUIKeyboardKey.delete.rawValue, count: current.count))
}
typeText(text)
}
}
// MARK: - Polling the filesystem
/// Waits up to `timeout` for some file under `root` (searched recursively) to contain
@@ -223,6 +256,14 @@ func waitForFile(under root: URL, containing substring: String, timeout: TimeInt
return fileExists(under: root, containing: substring)
}
/// A point-in-time negative check `waitForFile`'s substring test with no polling, for asserting a
/// draft was never written. Discarding a `CardEditScreen` never calls `session.perform` at all, so
/// there is no async write to wait out; polling the full timeout for something that never becomes
/// true would only slow the suite down for no better an answer than one immediate look.
func fileDoesNotContain(under root: URL, substring: String) -> Bool {
!fileExists(under: root, containing: substring)
}
/// Waits up to `timeout` for the directory at `url` to exist or, with `toExist: false`, to be
/// gone. The package-shaped counterpart to `waitForFile(under:containing:)`, and what a move
/// assertion needs: `relocateBoard` hands the actual transfer to a detached task and answers the UI