record: one enriched record per verified delivery (#39) #76
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Meta/Campaign
Meta/Epic
Meta/Session
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
Reviewed/Confirmed
Reviewed/Curated
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Scope/Campaign
Status/Abandoned
Status/Blocked
Status/Conflicted
Status/In Progress
Status/In Review
Status/Need Grooming
Status/Need More Info
Status/Ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Ting/Jostoph!76
Loading…
Reference in a new issue
No description provided.
Delete branch "agent.teyla/Jostoph:tango/39-the-delivery-record"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
record: one enriched record per verified delivery (#39)
Today every ruling is stateless: one event, one judgment. This is the
first piece of Epic 1.1 — the delivery record — the design law it
settles on: all steward state is derivable from the delivery stream.
In scope
src/record.rs: a JSON-lines write-ahead log distinct from the audittrail (#31). One
DeliveryRecordper verified delivery — payloaddigest (SHA-256), facts mechanically lowered from the payload (the
same
event/subject/field/nestsshapejostoph::deduce::Factsalready produces), and a reference to the ruling reached
(
event_id+verdict— not a copy of theDecision, which staysthe audit trail's alone).
RECORD_SCHEMA_VERSION, independent ofpolicy::SCHEMA_VERSION: arecord whose version this binary does not understand is refused
outright by
RecordLog::all, never silently skipped the way a tornaudit line is.
RecordLog::appendloads everydelivery_idalready on disk atopen()and is a no-op for one ithas seen — the forge's own retries, or a resent delivery, append
nothing a second time.
jostoph replay --record-log FILE [--repo R] [--since TAG]: readsthe log, rebuilds the fact view — a deduplicated, sorted union of
every fact — and prints it. Nothing else reads records; the ruling
path and the future
jostoph curationare meant to read only thisview.
serve --record-log FILE: wires aRecordLoginto the webhooklistener. Extraction happens exactly once, in the one place a
delivery is known to be verified — after the HMAC signature check,
once the decision is reached — and a failure to append is loud
(
tracing::error!) but never turns a verified delivery into arefused one.
Out of scope
#[serde(default)], so a future record carrying a signature or achain link still parses as one of today's.
subjects (F3), new kinds (F4), change-ids (F5). This issue extracts
only what every delivery mechanically carries; those are additive.
--repofilters today'sone shared log by the payload's own
repository.full_name;--sincecuts ordinally bydelivery_id. Both are named provisionalin the CLI help and in
record.rs's doc comment — S4's tagannotation and E1's per-repo store give them their durable meaning.
Boundary
lowering runs on exactly what the payload carried, nothing inferred.
replayfolds facts into aBTreeSet, sothe view has one order regardless of record order, and running it
twice over the same records yields byte-identical output.
Acceptance, as it ran
cargo test: 62 tests, 61 pass (12 new, all green); the one failure(
policy::tests::every_finding_lands_in_one_comment) is pre-existingon
mainatd25ffa0— confirmed by stashing this change andre-running — and unrelated to this issue's scope.
cargo fmt --checkandcargo clippy --all-targets -- -D warningsclean.
nix flake check(eval) passes;nix build .#checks.buildfailsonly on the same pre-existing test, confirmed identically on
unmodified
main.jostoph serve --record-logagainst a realHMAC-signed delivery appends one record; resending the identical
x-forgejo-deliveryid appends nothing;jostoph replayreconstructsthe fact view;
--repocorrectly includes/excludes byrepository.full_name.Closes #39