| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
type
m-5. `mark_approved_but_unbuilt` was a function that did nothing, called from
the failure path with a comment explaining that it did nothing. The mechanism is
real — a failed build leaves the accepted pointer alone, and "approved, build
failed, index still serving the old version" is what the derived query reads
back — but a no-op in the failure path is a trap for whoever traces a build
failure at 3am. Deleted; the explanation moved to the call site that needs it.
m-6. The step loop extended the lease by a hardcoded 90 seconds while `Config`
carried `lease_secs`, so an operator who raised the lease got leases that were
silently reset to 90s after the first step.
m-8. Dead parameters and `let _ =` debris: `upstream::run` took a `Db` it never
used (and a `let _ = local;` after the value's only use), `risk::assess` took a
`Pkgbase` it never used, `accepted_pins` took a `Db`, `detect::schedule_next`
took a `Pkgbase` it discarded, `diff::version_delta` computed a `vercmp` and
threw the answer away, and two HTTP handlers took arguments they ignored. All
gone, with the callers following.
m-11. `schedule_next` re-queried the subscription for `poll_interval_secs` that
its caller had read moments earlier to decide whether the pkgbase was paused —
two queries, and two chances to get different answers. The interval is now an
argument, and the scheduler's own tick (which already holds the row) was already
doing it the right way.
m-15. `Config::load`/`save`/`ensure_dirs` returned `anyhow::Result` while the
rest of the crate returns `error::Error`, which put two vocabularies on either
side of one boundary and turned "there is no config yet, run init" — the one
thing a caller can branch on — into an opaque string. They return the crate's
error now; `main` keeps `anyhow` at the CLI edge, where it belongs.
m-19. `skip_declared` was hardcoded `true` for VCS entries, so the field that
means "the recipe gave us no checksum to trust" also meant "this is a git
source", and a new `-git` source was rendered to a reviewer as
`sha256sums=SKIP` — a warning about a recipe that had done nothing wrong. The
field now means one thing everywhere, `SourceDigest::is_vcs()` says which
integrity mechanism protects an entry, and the diff panel prints "pinned commit"
for those.
n-6. `recipe_at` was `pub` for no reason; it is `pub(crate)`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
M-8 named four more machines after `build_state`, and each had the same defect
in miniature: `&str` constants, a writer that took any `&str`, and a rule that
lived only in the caller's discipline. They are `CandidateState`, `StepState`,
`ReleaseState` and `SubscriptionState` now, all parsed through one
`db::state_col` at the row boundary — a column value the code cannot name fails
the read rather than becoming a state it did not ask for.
The one that mattered is the review machine. `resolve_in(tx, id, &str)` would
move a candidate to any state from any state, so an approval racing a
rejection, or a stale worker resolving a review that had already been
superseded, silently overwrote what a human had decided — the direct route to
breaking I2 and I3 with no symptom anywhere. It is a compare-and-swap on
`CandidateState` now: a decided review is only ever frozen, never re-decided,
and a refusal names both states. `supersede_in` goes through it, so the freeze
cannot resurrect a superseded review either.
`StepState` gives I5 teeth. `begin_step` upserted over any existing checkpoint,
including one recorded `succeeded`, so a resume that asked to re-run a finished
step could rewrite the very row that told it to skip; the upsert now refuses to
touch a done checkpoint and `finish_step` is a CAS. The blocked path
(`running → pending`) and the reaper's `running → interrupted` are unchanged,
and both are in the table.
Two behaviour changes, both for the better and both tested: the UI's pause
button now says "orphaned: nothing to pause" instead of rewriting an orphaned
subscription back to a pausable state, and a step checkpoint that is already
done makes `begin_step` an error rather than a quiet overwrite.
Five tests in `tests/state_machine.rs` cover the review CAS in both directions,
the frozen checkpoint, the interrupted/blocked transitions, and the unknown
value in a candidate and a step row.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`build_state` was seven `&str` constants and `set_state(&str)` would write any
string a caller invented, so the machine existed only as `WHERE state IN (...)`
clauses scattered across six modules and nothing could say that
`succeeded → running` is nonsense. It is `db::model::BuildState` now: parsed
where a row is read (a state the code cannot name is an error, not an empty
string — which also retires m-12's `current_state` returning `""`), and
`set_state` takes the variant and writes only if the row's current state is one
of `to`'s legal predecessors. A refused transition writes nothing and says why.
Writing the machine down surfaced three things that were true of the flows but
of nobody's documentation. The step loop re-asserts `Running` at every step
boundary, so a self-write is a no-op and not a move — every state accepts its
own name. A failed build is resumed *on its own row* (I5: the step checkpoints
say where to continue), so `failed → running` is a real transition. And
`builds::retry` — the UI's requeue button — moved any row to `queued`
unconditionally, including one that had already published, re-queueing a build
whose every step was checkpointed as done; it goes through the machine now and
is refused with a reason. `requeue_transient` likewise.
What the CAS buys is the zombie case, which no test covered: a worker's lease
expires mid-step, the reaper returns the build to the queue, and the original
worker — still running — comes back and writes `succeeded` over whatever the new
owner has since done. That write now fails loudly and the queue keeps ownership.
`builds_for_pkgbase` had a second, hand-copied row mapper that dropped unreadable
rows with `filter_map(|r| r.ok())`; it shares `row_to_build` now and a bad row
fails the query instead of vanishing from the package page (m-9's policy,
applied where it bit).
`tests/state_machine.rs` pins the whole table, the zombie refusal, the unknown
state, the terminal build that does not move, and the requeue-of-a-published-
build refusal. `tests/live.rs` walks a build through `running` before succeeding
instead of teleporting it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
M-6. `db::stage_b_cache_get` and `db::stage_b_recent` returned
`watch::upstream::StageB`, so the persistence layer could not be read without
the VCS watcher, and the table's row shape was defined by whatever the watcher
happened to find convenient. The row is `db::model::StageBCacheRow` now —
epoch, pkgver, pkgrel, pins — and `watch::upstream` converts at its own
boundary. The two types are deliberately not the same one: `StageB` carries
`cached`, and "was this answer a cache hit?" is a fact about the resolution
that just happened, not a column.
M-7. `review::risk` called `watch::digests::skip_on_non_vcs` while
`watch::detect` called into `review::candidates`, a cycle between two sibling
domains. Whether a recipe declines to verify its own sources is a question about
the recipe, so `skip_on_non_vcs` — with `SKIP`, `declared_sums` and
`is_hex_digest`, which it needed and which the watcher had no business owning —
moved to `recipe.rs`, a leaf both sides may look down at. `watch::digests` keeps
its use of them for digest resolution; the re-export is gone.
`tests/layers.rs` enforces the direction from now on: `src/db` names no module
above itself, `src/review` does not name `watch`, `src/watch` does not name
`pipeline` or `http`, and `recipe.rs` names nothing at all. Each rule failed
before this commit and each failure message prints the exact file and line of
the offending edge, so the next reasonable-looking commit cannot reintroduce
one quietly.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function behind `Identity::hash` — the digest an approval echoes back —
did two things its name promised and it did not do. It did not order anything:
the doc comment conceded that callers were expected to pass "already-canonical
values", which is a convention, not a property, and a struct serializes in
whatever order its fields were declared. And on a serialization failure it
returned `"{}"`, so every value that failed to serialize hashed to one shared
digest. For a system whose whole job is provenance, "two identities that could
not be serialized would look identical to the approval echo" is the worst
possible failure to have available.
Serialization now routes through `serde_json::Value`, whose map is a
`BTreeMap`, so object keys come out sorted whatever the input's construction
order — the name describes what happens. A failure propagates: `canonical_json`
returns `Result`, `Identity::hash` returns `Result`, and the four call sites
(detect, put_world_snapshot, the world step, both enqueue paths) pass it on.
There is no path left where a digest is invented for a value that could not be
rendered.
`tests/hash.rs` pins all three properties: an unserializable value is an error
naming itself, two same-field-different-declaration-order values render
identically (and to the exact compact sorted bytes), and the identity digest
changes when any element of the tuple changes.
|
| |
|
|
|
|
|
| |
The identity is the tuple an approval pins. Rendering it as raw canonical
JSON made the 'hash' a blob of unescaped JSON that no form field could
carry faithfully; hash the canonical form instead and keep the JSON
internal.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The detection path (§5.1, §5.1a, §5.3, §7.1):
* git helpers, all subprocess git in one auditable place. Mirrors are
cloned with --mirror and polled with git ls-remote, fetching only when
the tip actually moved; --no-prune keeps history we may need forever.
* .SRCINFO parsing (authoritative) with a PKGBUILD fallback, and
source=() parsing that keeps VCS kind, #commit/#tag/#branch refs and
the filename:: form.
* recipe_hash over the whole snapshot tree, so a shipped patch is part
of the recipe and cannot change silently.
* source digest resolution: declared checksums are trusted-as-declared
(makepkg enforces them, no bandwidth), local files are hashed from the
mirror, and SKIP sources are downloaded and stream-hashed into the
content-addressed source cache. Detection always re-fetches SKIP
sources — answering from our own cache would defeat drift detection.
* candidate creation with base = current_accepted_release, collapse in
place while unviewed, supersede only once a human has looked, and a
previously rejected identity is not re-raised.
* non-publishable change handling (I11): unchanged version string means
no review, but never silence — recipe drift and pin drift become
notices, and a changed digest on a remote source with an unchanged
version becomes a high-severity integrity_alert.
Also vercmp + dep-string parsing with the ALPM test vectors, and the
approval record with optimistic concurrency (§7.1a) that the CLI and web
layers will both call.
16 detection tests against real file:// git fixtures, incl. I2 across
three unattended detections and I11 for all three drift kinds.
Part of P0 (DESIGN.md §17).
|
|
|
The §11 data model as four migrations, plus the §11a concurrency model:
one writer thread owning the write connection (mutations arrive as
closures over a crossbeam channel, so SQLITE_BUSY is not part of the
design) and thread-local read-only connections under WAL.
Invariants that are database guarantees rather than conventions:
I7 partial unique index -> at most one pending_review per pkgbase
I3 UNIQUE(pkgbase_id, identity_hash) -> no duplicate candidates
I10 audit table rejects UPDATE and DELETE by trigger
§16 current_accepted_release_id moves only by compare-and-swap
Also: vercmp + dependency-string parsing (ALPM algorithm, no libalpm),
hash helpers including recipe_hash over the whole AUR tree, the clock
helper that stamps every write, and the config/root layout.
Part of P0 (DESIGN.md §17).
|