Observability & Audit
Before you ship a repository you want to know whether it is consistent, what changed since the last delivery, and what happened when. Sometimes you also need an old build’s packages to stay on disk after newer builds stop using them. For a standard repository, SOW answers each question with its own command, from a cheap state lookup to a full re-hash of every file:
| Question | Command | Cost | When to run it |
|---|---|---|---|
| Does the repository need a build or recovery? Is a writer active? | status |
Reads recorded state; hashes nothing | Any time, including before writes and from monitoring |
| Are package bytes, indexes, and signatures consistent and ready for delivery? | check |
Reads and hashes every package file | After a build, before you publish or copy |
| Which local files changed between two builds? | changes |
Verifies the current tree like check, then compares recorded manifests |
When you review a delivery or feed another sync tool |
| Which operations ran, when, and what did they change? | log |
Reads the operation journal | When you investigate a change or archive history |
| Which Generations (completed builds) are explicitly retained? | retain ls |
Reads retention records | Before you collect unused packages |
These commands do not modify repository contents.
In a normal workflow
check is the delivery gate. Exit 0 means every layer passed and the repository is ready to
copy; exit 5 means it is not, and the diagnostic names the failed layer or the pending state.
log is for afterwards, when you need to know which operation changed what.
Inspect state
status reports the desired-state revision, the built Generation, the Dists (package sets such
as el9) that need a build, the count and bytes of pending packages, whether a writer holds the lock, and ready_to_copy, which is true only
when the state is clean and no writer is active.
| State | Meaning |
|---|---|
clean |
The built state matches the desired state |
dirty |
Membership or configuration needs a build |
recovering |
Recorded work needs recovery or cleanup |
error |
Recorded state or file evidence has an unresolved error |
For dirty, run build. For recovering or error, follow the diagnostic and the
recovery procedure. status
exits 0 for every state it can read, so scripts should read the state rather than the exit
code. Because it hashes nothing, ready_to_copy describes the recorded state, not the files;
run check before delivery.
Verify the repository
check ignores cached fingerprints: it reads and hashes each unique package file, checks
every index against the membership it claims, verifies the configured metadata and RPM package
signatures, and compares the public tree with the build’s file manifest. It repairs nothing.
A dirty or recovering repository fails even if its last built tree is intact, because that tree
is not what you asked for; run build and check again. sow check
describes each layer.
Compare Generations
Each row gives the action, the phase, the repository-relative path, and, where applicable, the
size and SHA-256. Phases follow the build order:
payload, metadata, pointer, delete. Because changes verifies the current tree first,
it fails with exit 5 while the repository is recovering or damaged.
changes compares local builds and does not inspect a publication target. Run
sow publish TARGET to update a target and resume interrupted transfers, and target GC to
reclaim remote objects.
Retain Generations and collect unused packages
Package files stay in the pool after they leave the index: clients of the previous build may
still download them, and nothing is deleted until you run sow gc, which removes only files
that nothing needs any more. If you need a particular build’s exact package files and metadata
kept, for example a release you shipped to customers, retain it. SOW verifies the Generation,
saves its metadata and file manifest under .sow/<repo>/retained/, and keeps its package files
out of gc. Retention does
not serve or publish that build; it keeps the material on disk.
retain add accepts only the current built Generation, so retain a build before the next build
replaces it. If status shows generation=42:
When you no longer need it, remove the record with sow retain rm 42 -r demo, then run
sow gc -r demo to collect unused bytes. If retain rm or gc stops partway, rerun the same
command to finish its recorded plan.
Local gc requires a clean repository, so build pending changes first. It keeps every package
still needed by desired or built membership, the membership kept for clients of the previous
build, a retained Generation, recovery, or publication state; see gc
for the complete rules. The previous build’s metadata that ordinary builds keep is separate
from explicit retention. For a publication target, run sow gc TARGET: filesystem targets
delete eligible objects conditionally after the cache grace period, and on R2 the default run
writes a candidate report and sow gc TARGET --delete reclaims eligible objects.
Read and export the log
The log is the operation journal, kept after operations finish. It records each operation’s state and times and, where applicable, its package results, membership changes, and file changes; an operation’s detail can also include build-progress events.
log export writes completed operations as JSON Lines to a new file, or to stdout. log prune
accepts a date or an RFC 3339 timestamp and removes eligible terminal records older than it.
Records that recovery needs and Generation manifests remain, so changes against an older
Generation keeps working.
See JSON output for scripts.