feat/server-store-engine #48

Merged
xavier merged 10 commits from feat/server-store-engine into dev 2026-11-14 07:25:47 +01:00
Owner
No description provided.
First motion of the ADR round: items/put-upserts pins the amended
contract (ADR-021 L1) — Put distinguishes create from update by the
boundary data alone (same code + same canonical CreatedAt updates; any
other write is a create; a create onto a live code rejects, naming the
code), and a new items/put-create-race clause proves the deterministic
same-suffix race in its mid-transaction form. The amendment binds
every store: filestore's Put gains the same commit-time guard, so its
conformance run and the merge matrix hold under the amended contract.
Three merge-matrix rows modeled 'set status' as a whole-record Put
with a foreign machine clock — under the amendment that is a create
onto a live code; they now mutate the live record (the SetItem
discipline, row 6's existing shape). The guard arbitrates only
against a readable live fact: absent, corrupt or unreadable states
leave the create path free — corruption loudness belongs to the read
paths, and the pinned mid-apply/restore behaviors hold.

Co-Authored-By: Xavier's assistant <assistant@gijoe88.com>
Second motion: one stable machine code per violated commit-time Store
guard, owned by the application layer beside the read sentinels —
«machine-readable rejection codes» begins at the port, not the wire.
PreconditionError implements domain.DomainError, so the CLI envelope
renders it exit-1 and the wire carries it verbatim; the guard → code
enumeration lives in the family's table and is pinned by the suite.
Fourteen guards reuse existing registry codes; four new codes join the
registry and the audited catalogue (E_NO_CONFIG, E_DUPLICATE_ITEM,
E_DUPLICATE_COMMENT, E_DUPLICATE_RECEIPT — ADR-021 point 6 the audit
record). The suite's mustFailAtCommit tightens to assert family and
code across the whole catalog, which types filestore's entire guard
set — including the recode rename endpoints, whose refusals move from
wording to E_UNKNOWN_ITEM / E_DUPLICATE_ITEM. The Set exclusivity
payload now names the live claimant — the losing claimant sees the
winner's name.

Review nits absorbed in the suite pass (PM comment on the task item):
the staged-invisibility peer read is bounded so a reader-blocking
engine fails the clause naming it instead of hanging the suite; the
agents clause asserts members by name instead of coupling to
seedProject's roster count; the InFlight clause gains the
Worktree∧Machine AND-combination (positive and crossed); the
interferer's owner flag becomes the InterloperOwner constant,
symmetric with the rest of the interloper content.

Co-Authored-By: Xavier's assistant <assistant@gijoe88.com>
The Store port implementation over bbolt v1.5.0 (ADR-020): one handle
over one project's database file. Four root buckets mirror the fact
families; one key per fact, values in the filestore's canonical bytes
(shared writer discipline — the schema structs mirror field-for-field,
pinned by the engine's compatibility pin), byte-sorted keys, the
filestore's directory shape carried in the items bucket's keys
(<code>, <code>/claim, <code>/claims/<ulid>, <code>/comments/<ulid>,
<code>/receipts/<ulid>, <code>/needs/<needed> — legal because no
domain identifier contains '/'), versions keyed by a length-prefixed
big-endian encoding whose byte order is the numeric order (matching
VersionID.Compare's no-width-limit note, with the engine's one loud
uint64 component width).

Transactions: staged buffer over a copied MVCC snapshot (the snapshot
is the copy — no long-lived read transaction pins page reuse),
read-your-writes, staged writes invisible outside; every precondition
is a commit-time guard re-checked against the file's one write
transaction (the ADR-021 typed family, engines construct them); the
apply lands the staged view as a diff against committed state; bbolt
copies pages and fsyncs — all-or-nothing, durable on return. No lock
file: bbolt's flock on the project file is single-writer structural;
a second serve fails Open fast (5s timeout, fast and loud). Reads
outside any transaction resolve through fresh MVCC snapshots per read
— never blocking a writer, never waiting behind one (ADR-021 L5 by
engine construction). Put carries the amended create-uniqueness guard
(ADR-021 L1) arbitrating on the canonical birth certificate; only a
readable live fact arbitrates — the free-code classification the
amendment's guard shares with the filestore's.

Engine-specific concerns confined to the package: bbolt appears
nowhere downstream of the port. The ADR-008 dependency audit extends
byte-identically to the server-project-registry branch's mirror
(acdc7fd): same bbolt v1.5.0, same allowedDeps/sanctionedDeps map
form, same audit logic — identical hunks merge clean. pflag stays at
dev's v1.0.9; the dependency diff against dev is bbolt + x/sys and
nothing else.

Co-Authored-By: Xavier's assistant <assistant@gijoe88.com>
The conformance suite's full catalog (75 subtests) proves the
amended contract over the engine: one Harness, one Test. The adoption
doc carries the review-nit sentence on where the engine validates
(stage calls buffer unconditionally; every precondition is a
commit-time guard — the suite's direct-form clauses Fatal on
stage-time errors, which the engine never produces for precondition
violations). Fresh hands out a project file per clause; Alike is a
second Store struct over the same bbolt handle (the honest in-process
peer — single-writer is the file's flock, a second process could not
even open it); Interfere is a normal bolt write transaction committed
between staging and commit — the exact out-of-band race the commit-
time re-checks exist for.

Co-Authored-By: Xavier's assistant <assistant@gijoe88.com>
The engine-specific pins beside the suite (boltstore.md's Testing
section): the bucket-and-key layout read through raw bbolt (four root
buckets, the fact at <code>, sub-facts at <code>/<sub>, byte-sorted);
restart persistence (the file is the truth across close and reopen);
the version key encoding (byte order ≡ numeric order across the width
boundary v0.2.9 < v0.2.10, decode round-trips, the loud uint64
component width); the online backup's CopyFile snapshot (opens as its
own project store, reads whole); the structural single-writer (a
second Open of a held file fails fast, and no lock file exists — the
flock rides the db file); per-project isolation (a typed refusal in
one project leaves the other untouched; two projects' writers
interleave concurrently — separate files, separate locks); the
canonical-bytes compatibility pin (every fact's engine bytes equal
the filestore's on-disk bytes through its public surface — the
shared-writer-discipline claim made mechanical, lockstep enforced);
and the workload sanity at the ruled sketch's shape — 800 items with
comments, receipts, episodes and edges land at 1.0 MB, and a read-
heavy ~10:1 mixed workload (whole-project graph reads, targeted
reads, concurrent writer) completes with no read ever queueing behind
a commit.

Co-Authored-By: Xavier's assistant <assistant@gijoe88.com>
F2 (this task's pin): TestPinWorkloadSanity skips under the race
detector. The pin is a performance-shape assertion — wall-clock
budget, per-read latency bound — and under instrumentation it would
measure the detector, not the engine; a detector-scaled budget would
be an arbitrary number measuring the wrong thing. The workload's
concurrency stays race-covered by TestPinPerProjectIsolation
(concurrent handles committing in parallel, green under -race); the
build-tag probe (workload_race_test.go / workload_norace_test.go) is
the idiomatic detection — the skip's reason is stated in the message
and the comment.

F1 (pre-existing probe, folded here by the PM's ruling — the ONE file
outside the engine's lane this branch now touches):
TestProbeSameParentChildrenAddAdd's hunk-count assertion is
second-boundary-aware. The twin clones' mints are wall-clock stamps
from two processes; straddling a second boundary diverges created_at
as well as title and git yields a second hunk. The conflicted bytes
are now parsed into hunks (parseConflictHunks) and classified by the
canonical fact line each hunk is about (conflictHunk.key): exactly one
title hunk required, at most one created_at hunk tolerated (the stamp
straddle), any other hunk names a mangled shape and fails. Both
titles' presence-in-bytes and the ref-level assertions stand
unchanged. The probe's other rows (status/status, label/label) seed
from one shared commit, so their records cannot diverge on created_at
— the same-remedy question does not arise there.

Verified: 4x full parallel go test -count=1 ./... green (the flake was
2/2 under load), -race tree-wide green, probe solo x4 and x3 under
concurrent boltstore-pin load green, workload pin solo x2 green and
skipping under -race, gofmt/vet clean.

Co-Authored-By: Xavier's assistant <assistant@gijoe88.com>
server-store-engine: hunk-classification teeth probe — every mangled conflict shape fails the F1 predicate
All checks were successful
/ secrets-scan (gitleaks 8.28.0, all refs, redacted) (pull_request) Successful in 5s
/ test (linux/amd64, full suite) (pull_request) Successful in 59s
/ build linux/amd64 (pull_request) Successful in 25s
/ build windows/amd64 (pull_request) Successful in 26s
/ build darwin/amd64 (pull_request) Successful in 31s
/ build darwin/arm64 (pull_request) Successful in 28s
/ build windows/arm64 (pull_request) Successful in 28s
/ build linux/arm64 (pull_request) Successful in 36s
/ release (six binaries + checksums.txt, tag pushes only) (pull_request) Has been skipped
9a0ec4337e
xavier deleted branch feat/server-store-engine 2026-11-14 07:25:47 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
assistant/skuld!48
No description provided.