summaryrefslogtreecommitdiffstats
path: root/src/pkgver
Commit message (Collapse)AuthorAgeFilesLines
* vercmp: three real bugs, found by comparing against pacman's own binaryaur-build13 days1-46/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tests/versions.rs started as a hand-typed table of ALPM ordering vectors and turned into something better: a differential test that runs the hand-written comparator against pacman's `vercmp` over a 34-fragment cross-product (1156 pairs) of shapes that appear in real recipes. It found three bugs, all of which would have shipped. 1. **Numeric vs alphabetic chunks were inverted.** The code had 'a numeric chunk is always older than an alphabetic one'. It is the opposite: 1.0.1 > 1.0.a. The unit test asserted the wrong direction with the comment 'alpha sorts after numeric', so the suite was protecting the bug. 2. **Separators were ignored entirely.** They are not merely skipped. ALPM distinguishes an alphabetic chunk glued to the previous chunk from one after a separator, and the separated one is newer regardless of the letters: 1.0 > 1.0a, but 1.0 < 1.0.a, and 1.0z < 1.0.a. Two versions differing only in where the dot sits were being called equal. 3. **The end-of-string rule looked at the wrong thing.** When one side runs out, the decision comes from the other side's *next raw character* before any separator skipping: a letter there makes the exhausted string newer (the 1.0rc1 < 1.0 rule), anything else makes it older. The rewrite is character-wise rather than a chunk pre-pass, because the glued-or-separated distinction cannot be made after the separators have been thrown away. Rule 3 is the kind of thing nobody can be confident about from the spec alone, which is exactly what the oracle is for; it is skipped with a note when pacman is not installed, and the curated table — every pair of which was also checked against the binary — always runs. Also: the recipe parser's epoch is now exercised end to end (an epoch added to a PKGBUILD must land on the candidate, and 1:0.9-1 must beat 1.0-1 rather than read as a downgrade), and the downgrade path asserts the index keeps serving the higher version, since a downgrade is a human decision and not an automatic rebuild. 161 tests pass, clippy clean.
* feat: AUR mirror watcher, recipe parsing, candidate creationaur-build14 days1-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* feat: SQLite schema, migrations, single writer actoraur-build14 days1-0/+273
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).