Skip to content

Restore reorder-maths test coverage (D-131 / 7.13)#131

Merged
Considus merged 1 commit into
mainfrom
test/restore-reorder-geometry-coverage
Jul 17, 2026
Merged

Restore reorder-maths test coverage (D-131 / 7.13)#131
Considus merged 1 commit into
mainfrom
test/restore-reorder-geometry-coverage

Conversation

@Considus

Copy link
Copy Markdown
Owner

What & why

M7 of #130 ("Pillar 2: the UIKit timeline replaces the SwiftUI one") deleted InlineReorderGeometryTests along with the SwiftUI editor those statics tested, and — as the M7 commit body itself noted — left the UIKit editor's drag-to-reorder geometry with zero automated coverage. Reorder is a live gesture (the in-editor checklist and the Shot List), so a regression would only surface on a device. This restores CI coverage (D-131 / WorkPlan 7.13).

Change

  • Pure-maths extraction (behaviour-preserving). The slot-index calculation is lifted out of updateDrag into a testable static, BlockEditorViewController.reorderTarget(draggedCenterY:otherCenterYs:). updateDrag now calls it — same inputs (real view-frame centres), same result. No behaviour change.
  • New suite BlockEditorReorderGeometryTests (app-target CatchlightTests, #if canImport(Catchlight), matching the file it replaces) exercising the real contract:
    • Drop-target index — above all rows → slot 0; stepping past each centre → 1, 2, 3.
    • Strict < boundary — resting exactly on a centre stays in the slot above it (no jitter).
    • Clamping — above the first row clamps to 0; below the last clamps to count (the contract returns count, not count-1 — asserted as-is).
    • No-op / same-slot — a row released in its origin slot comes back with its index unchanged.
    • Tall wrapped row — with heights 44/120/44 (centres 22/106/188), a drag to y=100 stays at slot 1 because it hasn't passed the tall row's real centre. A fixed row height would have overshot to slot 2 — the exact bug this maths was built to avoid (owner 2026-06-21).
    • Plus the prefix(while:)-not-filter().count contract, pinned so nobody "simplifies" it and silently changes behaviour on unsorted input.

Testing

CatchlightTests unit suite green on the iOS Simulator (iPhone 16): Executed 582 tests, 1 skipped, 0 failures — including the 9 new BlockEditorReorderGeometryTests. No behaviour change to reorder; the extraction is a straight call-through.

Refs D-131, #130.

🤖 Generated with Claude Code

M7 of PR #130 deleted InlineReorderGeometryTests along with the SwiftUI
editor it tested, leaving the UIKit editor's drag-to-reorder geometry with
zero automated coverage (the M7 commit body flagged this).

Extract the pure slot-index maths out of updateDrag into a testable static
`BlockEditorViewController.reorderTarget(draggedCenterY:otherCenterYs:)` —
behaviour-preserving, updateDrag now calls it — and add
BlockEditorReorderGeometryTests exercising the real contract:
drop-target index (top/middle/bottom), the strict-`<` boundary, clamping at
both ends (clamps to `count`, not `count-1`), the no-op same-slot release,
and the tall wrapped-row case (real centres, not a fixed row height) that is
the whole reason the maths exists.

Replaces InlineReorderGeometryTests (retired SwiftUI statics). App-target
only (CatchlightTests, `#if canImport(Catchlight)`), matching the file it
replaces.

Refs D-131, PR #130.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Considus
Considus merged commit bad24c6 into main Jul 17, 2026
4 checks passed
@Considus
Considus deleted the test/restore-reorder-geometry-coverage branch July 17, 2026 17:08
Considus added a commit that referenced this pull request Jul 17, 2026
The label lane picks its word from `isSnoozed ? "SNOOZED" : "OVERDUE"`, but the rewritten
timeline never wired snooze through: `TimelineReadCell` didn't pass isSnoozed and
`UIKitTimeline` never received the snoozed set — so every snoozed overdue Take read
"OVERDUE". Snooze isn't derivable from the Take (it lives in `vm.snoozedReminderIDs`),
which is exactly why the rebuild dropped it — found while re-anchoring the Feature Register
after the M7 merge.

Thread `snoozedIDs` from DailiesView → UIKitTimeline → the cells, with its OWN reconfigure
trigger: a snooze doesn't change the Take's value, so the value-diff that reconfigures
cells couldn't see it (same shape as the month-filter restyle). Diff the set instead.

Owner-verified on device: a snoozed Take now reads SNOOZED, and flips the moment it's
snoozed without needing another edit to that Take.

(The reorder-coverage + register-anchor work from the same local pass is already on main
via PR #131 — its `reorderTarget` extraction and test file are byte-identical to what that
PR landed, so nothing to add here.)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant