Skip to content

Reduce runtime duplication across WAL, KV, and Git proof - #101

Merged
carsonfarmer merged 8 commits into
mainfrom
cf/runtime-minimalism
Sep 25, 2026
Merged

carsonfarmer merged 8 commits into
mainfrom
cf/runtime-minimalism

Conversation

@carsonfarmer

Copy link
Copy Markdown
Owner

The WAL, KV provider, and Git example repeated publication, write, and catalog logic. This change consolidates those paths while preserving the public API, durable format, and Git/KV behavior. It removes 177 production runtime lines across Rust and Go; the complete diff is 156 lines smaller after adding a reproducible Git lookup benchmark.

The core now shares checked head publication, pending-result classification, conditional object-store write setup, and one auditable list of durable option fields. KV shares its radix insertion and Spin provider retry paths. Git uses the authenticated next radix prefix directly, decodes validated repository fields once, and removes duplicate read-error observation. The object-store helper returns the backend future directly because an extra async wrapper slowed append benchmarks.

The existing malformed-pack provider test failed on main: the parser rejects a short object before the stored writer closes, while the test required the writer's exact error phrase. Its assertion now checks the protocol outcome—unpack failure, no ref acknowledgment, and no published refs—without depending on which stage rejects the pack.

Validation passed on the final branch: make check (full workspace tests, Go race/vet, strict native and WASIp2 Clippy), make spin-kv-check, make git-spin-config-test, make wasi-credential-test, Git auth transport tests, core and Spin KV suites against disposable local MinIO, and the default unchanged-client Git provider suite against the composed Spin component and MinIO. Independent correctness reviews found no blocker in the core, KV, Git, durable format, or combined diff.

Representative local benchmarks on Apple M4 Pro show no sustained slowdown (Criterion in-memory, 20–30 samples and 2 s measurement; Go 5 × 500 ms):

Workload main This branch
WAL append, batch 16 5.908 µs 5.908 µs
WAL append, batch 1, warmed alternating runs 5.025 µs 4.928–5.044 µs
KV prepare-set, 4,096 keys 81.28 µs 79.94 µs
Git lookup, 16,384 objects 138.2 ns 59.4 ns

Git lookup allocates zero bytes in both versions. Repository-config decode remained within the before/after run-to-run spread (123–127 vs 124–126 µs, 2,345 allocations in both). The new BenchmarkLookupCatalog keeps the lookup comparison reproducible. These are local measurements, not remote-storage performance claims.

carsonfarmer and others added 8 commits September 25, 2026 14:09
Reuse one checked conditional head update across retention, collection, and commit publication. Classify storage and admission failures consistently while preserving pending outcomes.

Co-authored-by: Codex <noreply@openai.com>
Share the radix insertion path and the provider retry path without changing publication or admission behavior.

Co-authored-by: Codex <noreply@openai.com>
Use the authenticated next radix prefix directly and let encoding/json decode validated repository fields. Remove duplicate failure recording already covered by deferred observers.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
The pre-scan can reject a short decoded object before the stored writer closes. Require an unpack failure, no ref acknowledgment, and no published refs for either malformed pack.

Co-authored-by: Codex <noreply@openai.com>
Keep the 16,384-object lookup fixture used for before/after timing so future changes can be checked against the same workload.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@carsonfarmer
carsonfarmer merged commit 052e1cb into main Sep 25, 2026
3 checks passed
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