Skip to content

Record provenance per environment, and for the newest commit only - #103

Merged
miharp merged 1 commit into
mainfrom
provenance-per-environment
Oct 14, 2026
Merged

miharp merged 1 commit into
mainfrom
provenance-per-environment

Conversation

@miharp

@miharp miharp commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Fixes #102.

Problem

The provenance log skipped any (code_id, commit) pair it had seen before. That lost the answer codavox compilers and codavox provenance give in two cases:

  • A branch that has not diverged gets no record. The key left out the environment. A branch just cut from production has the same tree and HEAD, so the same code_id and commit, and whichever of the two sealed second was dropped. Its COMMIT column showed - until the branch got a commit that changed its tree. Every new branch starts out that way.
  • Returning to an earlier commit reports the one in between. When two commits produce the same tree and a branch is reset to the first, the reset was a known pair and was skipped, so the other commit stayed newest.

Change

  • Keyed by environment and code_id. A record is skipped only when the newest record for that key already names the same commit. Identical reseals still add nothing.
  • Lookup returns append order reversed instead of sorting on sealed_at. Records are appended as they are sealed, so the two agree, but append order is what Record compares against, and a clock stepped backwards cannot reorder it.
  • No migration. OpenLog rebuilds the newest commit per key from file order, and the publisher's reseal at startup writes the records the old key dropped.
  • Docs. commands.md (codavox provenance) and publishing.md (Provenance) say records are per environment and that a commit is listed again when an environment returns to it.

Test plan

  • go test -race ./..., go vet, golangci-lint (0 issues), gofmt, cspell, markdownlint
  • The two new tests, TestProvenanceUndivergedBranchGetsItsOwnRecord and TestProvenanceReturnToEarlierCommit, fail against main's provenance.go

Assisted by Claude.

The provenance log skipped any (code_id, commit) pair it had seen
before, which lost the answer the fleet view and `codavox provenance`
give in two cases.

The key left out the environment. r10k turns a branch into an
environment, and a branch just cut from production has production's
tree and HEAD, so the same code_id and the same commit. Whichever of
the two sealed second was dropped as a duplicate, and its COMMIT column
showed `-` until the branch got a commit that changed its tree. Every
new branch starts out that way.

And a pair already seen was never recorded again. When two commits
produce the same tree and a branch is reset to the first, the reset was
skipped, so the commit in between stayed newest and was reported as
current.

Records are now keyed by environment and code_id, and one is skipped
only when the newest record for that key already names the commit.
Identical reseals still add nothing. Lookup returns append order
reversed instead of sorting on sealed_at: records are appended as they
are sealed, so the two agree, but append order is what Record compares
against and a clock stepped backwards cannot reorder it.

Existing logs need no migration. OpenLog rebuilds the newest commit per
key from file order, and the publisher's reseal at startup writes the
records the old key dropped.

Fixes #102

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Michael Harp <mike@mikeharp.com>
@miharp
miharp force-pushed the provenance-per-environment branch from dba4151 to e9e94cd Compare October 14, 2026 14:51
@miharp
miharp merged commit fa7e9cb into main Oct 14, 2026
12 checks passed
@miharp
miharp deleted the provenance-per-environment branch October 14, 2026 14:53
miharp added a commit that referenced this pull request Oct 14, 2026
The release workflow refuses a tag that installation.md does not
document, so the install lines move to 0.10.0.

The upgrade note exists because the catalog label changes format.
config-version now prints <environment>-<code_id> (#104), so anything
matching the bare 0.9 label, an OpenVoxDB query or a dashboard, has to
change first. It also says when an upgraded server starts printing the
new form: OpenVox computes the label once per cached environment, so
under environment_timeout = unlimited the old form lasts until the next
deploy or restart. The provenance fix (#103) needs nothing from the
operator, but the note says when the missing branch commits appear.

CONTRIBUTING still told the release to bump a VERSION= line in the
README, which has had none since the install moved to the package
repository in #96.

Lab: batches B, F, and I green (56/56) against an fa7e9cb snapshot built
with go1.26.9, including the new I8: on real r10k, a branch that has not
diverged from production gets its own label and its own provenance
commit (codavox-lab 82397df).

Signed-off-by: Michael Harp <mike@mikeharp.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

Fleet view shows no commit for a new branch, and the wrong one after returning to an earlier commit

1 participant