Repository navigation
feat(core): v1 core service with identity, marks, redaction, stats, export and import (AFDEV-13) - #5
Merged
Merged
Conversation
Moved unchanged, import paths only, so the running v3 service and its e2e gate stay green while the v1 core takes internal/core.
…xport and import (AFDEV-13) internal/core is the transport-neutral v1 service on the decoder, the canonical writer and the v1 store: create with keyed replay, 409 on key reuse and the 24-hour keyless window; get and list with cursors, q and presence-aware filters; single and batch processing marks; redaction tombstones; stats; export format 2 streamed with its digest; import format 2 verified before the write transaction, uid preserved, key conflicts reported. pkg/canonjson gains Sum and pkg/envelope the content_hash identity and DecodeWithLimit for the import cap.
Normalisation trims a trimmed member again after a truncation cut (new fixture trim-after-truncate, reference and README updated), so the decoder is idempotent on its stored output; FuzzDecode now asserts that. Import re-decodes with two levels of depth headroom for the nesting inference can add. Record members follow the Submission schema order; a blank verdict, ref or processed_by clears the field; import requires RFC 4122 version and variant bits; requested but empty stats groups and series are present; the missing-member error is deterministic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The transport-neutral v1 service layer, on top of the decoder (
pkg/envelope), the canonical writer (pkg/canonjson) and the v1 store (internal/store). Nothing serves it yet; the HTTP routes land next.What changed
internal/coremoves unchanged tointernal/v3/core(import paths only, first commit), so the running v3 service and its e2e gate stay green.canonjson.Sum(hex SHA-256 of the canonical bytes);(*envelope.Envelope).IdentityTreeandContentHashover the identity members. Everyconformance/hash/vector passes through the decoder and throughService.Create.envelope.DecodeWithLimits.DecodeisDecodeWithLimits(body, BodyLimit, MaxDepth); import re-decodes stored envelopes under the 32 MiB import cap (a stored envelope can exceed the 10 MiB create cap after U+FFFD replacement) and two levels of depth headroom (StoredDepthHeadroom: the nesting inference can add).x-trimthat truncation cut is trimmed again (step 5 inconformance/README.md, reference implementation, new fixturetrim-after-truncate). Without it a cut could leave trailing whitespace that a second pass removes, and the service could not re-import its own export.FuzzDecodenow asserts the decoder is idempotent on its stored output. No existing fixture's expected output changed.internal/core(nonet/httpin its dependency closure, enforced by a test):Create: keyed replay (200), key reused with different content (409replay_mismatch,key_reuseddetail withexisting_id), 24-hour keyless window skipping processed rows, UUIDv7uid; lookups and insert in oneBEGIN IMMEDIATEtransaction.Get,List(cursors,q, presence-aware filters validated in one place shared withStats),Stats.Mark/MarkBatch: strict body decoding,updated/unchanged/not_foundclassified in the same write transaction as one set-based update.Redact: tombstone keeps identity, hash and processing fields; repeat is unchanged.Export: format 2 streamed in one read transaction with header, trailer and digest.Import: format 2 verified in full before the write transaction (strict record parser, count and digest,uidand timestamps, recomputedcontent_hash; tombstones recognised byredacted_atkeep their hash), thenuiddedupe and key conflicts reported, never failed.Meta,Schemas,Schema; typed*Problemerrors carrying the contract's codes and pointers (?namefor parameters); a busy database is 503unavailable.Submissionschema, no HTML escaping.docs/develop.md: layout and the frozen-hash rule updated.Tests
conformance/decode/fixture and everyconformance/hash/vector throughService.Create: status and code, warnings as a multiset of (code, pointer), stored envelope as canonical bytes,content_hash.processed_at,processed=falseclears all five.payload); re-import is a no-op; key conflicts listed; tampered count or digest writes nothing.Gates
just check,go test -race -count=1 ./...,just fuzz, the e2e suite against the built binary (55/55), shellcheck on both skills,bash tests/skill/run-tests.sh(124/124),just contract, andstaticcheck2026.2.1: all green locally.