rastrillo / native Public

Clone
git clone https://amadan.net/rastrillo/native

Plain git — no account needed to clone.

Download

Download this file

1# K3 validation
2
3Continuing WIP 68a51d7 against offline-kit spec 6049830 (discussion #5).
4The inherited implementations were explicitly no-op stubs, not working code.
5
62026-09-24: ran the inherited tests against those stubs before implementation.
7`swift test` failed on missing enqueues, sends, replacement ordering, status
8mapping and store writes. One inherited outbox test indexed an empty result
9and terminated the process. A separate filtered run of `SyncStringsTests`,
10`SyncStatusTests`, `FaultingBlobStoreTests`, and `SealedStoreTests` executed 24
11tests with 78 failures (including missing sealed files). Local transcripts:
12`/tmp/k3-kit-red.log`, `/tmp/k3-kit-red-rest.log`.
13
14After implementation, the storage/status/fault suite passed 32 tests and the
15drainer/catalog suite passed 18. `make ci` passed, including macOS and iOS
16companion builds, Go race tests, and Python bundle tests; transcript:
17`/tmp/k3-kit-ci-1.log`. This is intermediate evidence, not final K3 approval.
18
19The continuation evidence below supersedes the intermediate status. Nothing
20has been merged or deployed.
21
22## Disk stop, 2026-09-24
23
24Work stopped when `df` reported 1.2 GiB free (user's stop threshold: 1.5 GiB).
25Only session-created Docs build outputs and companion DerivedData were removed.
26The inherited `.build` directory in this worktree was preserved.
27
28Additional focused evidence before the stop:
29
30- Seal-count rotation and interrupted-rotation tests: both failed with the
31 rotation call stubbed (`/tmp/k3-rotation-red.log`); all 14 sealed-store tests
32 passed after restoring/fixing rotation (`/tmp/k3-rotation-green-2.log`).
33- Independent-lane retry regression: failed with the first retry starving the
34 next lane (`/tmp/k3-lane-retry-red.log`); all 15 drainer tests then passed
35 (`/tmp/k3-lane-retry-green.log`).
36- Fixed an inherited undeclared AppleTests → RastrilloTestSupport dependency:
37 incremental builds could compile tests against a stale support module.
38- Fixed an inherited test's unchecked empty-array indexing so stub failures
39 produce an assertion instead of terminating the test process.
40
41At that disk stop, the latest changes had not had another full make ci.
42The resumed local gate and later focused checks are recorded below.
43
44Docs adoption is saved on oficina/docs `feat/k3-outbox-lane`, discussion #69.
45Its evidence file lists unresolved title/lifecycle issues and remaining gates.
46
47## Resume: status priority and concurrent close-save
48
49Spec §3.4 gives session-ended priority 2 and empty priority 3. Pending entries
50already produced needsSignIn(n); the empty-session exception is now removed too.
51A concurrent drain now awaits the reserved batch's result, so close-save cannot
52mistake an in-flight batch for idle. New checks failed on the previous behavior
53(2 assertions, /tmp/k3-status-drain-red.log); all 20 status/drainer tests then
54passed (/tmp/k3-status-drain-green.log).
55
56Reservation API rationale: load surfaces unavailable storage rather than an
57empty queue; entries includes held entries for offline replay; beginSend makes
58selection and reservation one actor operation so compaction cannot delete a
59batch in flight; endSend releases a retry/cancelled reservation without ack.
60No update or retarget API was added.
61
62## Final continuation evidence
63
64- Full local `make ci` passed at 3e93ef916f2bb5469fd09375e0f6253938da8650,
65 including Swift, macOS/iOS companion builds, Go race and Python bundle checks
66 (`/tmp/k3-kit-final-ci.log`).
67- A locked store must preserve its last known status. The new regression failed
68 against the previous behavior (`/tmp/k3-unavailable-status-red.log`); all 21
69 drainer/status tests passed after the fix (`/tmp/k3-unavailable-status-green.log`).
70 Explicit app enqueue failures still show cannotSaveOnDevice; unknown storage
71 never masquerades as a known empty queue.
72- The final-head `make ci` rerun is logged at `/tmp/k3-kit-release-ci.log` and
73 its result/head is recorded on [discussion #9](https://amadan.net/rastrillo/native/discuss/9).
74- Hub CI at 3e93ef9 failed before compilation: Sparkle archive extraction could
75 not find unzip. There is no macOS runner; the local macOS gate is authoritative
76 for this task, as directed by the user.
77- Docs now has real SIGKILL red/green proof and the parked-update port. Its
78 replica/metadata/Home adoption and crash tests are on oficina/docs #69.
79
80The only deliberate ordering difference is app-side discard removing the replica
81before its lane; exhaustive crash tests prove this prevents stranded unsent text.
82The prior empty-session status exception is removed. No merge or deployment.
83
84## Fable review follow-up (2026-09-24)
85
86- `testSealBlocksCacheStateAndSkipUnusedQuotaAfterCrash`: failed against the inherited per-seal implementation (38 high-water assertions and two cache assertions); passes with 1024-slot reservations. Two process lifetimes consume 19 seals each, observe durable marks 1024/2048, and produce 38 distinct 96-bit nonces. A restart abandons 1005 unused slots; key rotation still counts reseals and keeps its previous key until completion. Complete file protection remains in every atomic write.
87- `testThrowingLaneDoesNotStarveOtherLanesAndEventuallyHolds`: failed against the inherited drainer (only lane a called, three lanes remained, no hold, fourth throw); passes with b/c draining on the first attempt and a held after its third consecutive untyped throw. Returning a disposition or a typed transport error resets the throw streak.
88- Full Swift suite: 119 tests passed. Red/green logs: `/tmp/k3-native-review-{red,green}.log` (ephemeral); observed assertions above are the durable record.
89- Reservation API addition: `entries(lane:excludingInFlight:)` adds a filter to the existing snapshot, needed to deduplicate held metadata markers without suppressing a successor to a marker already being sent. No new mutation or reservation operation.
90- Snapshot invariant is now documented: entries/summary can retain stale display/deduplication hints on unavailable storage; summary flags this, sendable fails closed, and load/beginSend/all mutations enforce availability before replay or changes.
91- Corrected unavailable-send and Retry-After comments. The latter remains a deadline that neither connectivity nor Try again bypasses.
92