summaryrefslogtreecommitdiffstats
path: root/src/time.rs
Commit message (Collapse)AuthorAgeFilesLines
* foundation, http: export what is used above you, and nothing elsedev11 days1-21/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The leaf modules were the widest liars. `git` exported 19 names of which 5 were named by nobody; `hash` exported a constant `EMPTY` that no code had ever referenced; `time` exported a virtual clock, an `advance` and a `wrap` whose only caller was a test that turned out not to exist. A leaf's interface is the whole contract the rest of the crate can rely on, and these interfaces were mostly decoration. Nine items were genuinely dead and are gone: `hash::EMPTY`, `git::{clone_source, count_commits, log_oneline, ls_remote_heads}`, `recipe::is_diffable`, `pkginfo::values_of`, `time::virtual_now`, and a free `time::advance` that had been shadowed by the `VirtualClock` method tests actually call. Eighteen more were used only inside their own module and are now private — `fetch`'s `Body` aside, which is the return type of a public parser and so is part of the interface whether or not anyone writes its name. http went 68 exported names to 27, and its last two glob re-exports (`pub(crate) use mutations::*; use pages::*;`) are explicit lists now. That makes the crate's glob count zero, so the allowlist in the architecture test is empty and can stay that way. Narrowing surfaced dead code that `pub` had been hiding, because a public item is presumed used and never questioned: `Req::query` and `Req::body` were parsed and stored and never read, `Res::found` had no callers, and `sse::FileBody` was a reader nobody constructed. All four are deleted rather than re-published to keep the warning quiet. git 19→14, hash 8→7, recipe 11→7, urlutil 2→1, config 35→31, pkgver 18→14, time 16→14, pkginfo 7→6, http 68→27. Crate totals: 585→516 pub, 219→115 dead, 4→0 globs. 281 passed / 0 failed, clippy -D warnings clean, release build clean, architecture 8/8.
* time: the production clock module needs nothing from its parentaur-build12 days1-2/+0
|
* time: the virtual clock freezes, it does not raceaur-build12 days1-8/+20
| | | | | | | | Advancing the clock on every wait made virtual time outrun real work: a build taking a few hundred ms would burn forty ticks and expire its own lease. Under a virtual clock a wait now costs a yield and the clock only moves when a test moves it with time::advance, so a frozen lease stays frozen however fast the loop runs.
* time: a wait seam the control loops call throughaur-build12 days1-0/+149
| | | | | | | | | | The dispatcher tick, watcher tick, SSE poll, agent watchdog and remote keepalive each slept on the wall clock in their own slice loop, so every test that wanted a tick waited for real time. They call crate::time::wait/sleep now, which is the same real sleep in a production build and a virtual clock advance under test-support: a test that takes the clock owns it, and threads it spawns inherit it. production_surface checks the virtual path is compiled out and that no control loop went back to std::thread::sleep.
* comments: keep only what the code cannot showaur-build12 days1-7/+0
| | | | | | | | | | | Stripped every comment that described what an item does, documented its arguments or fields, or cited the design docs (§n, I-n, m-n, decision n). 2247 comments down to 83. What survives: the section dividers that segment the large modules, the secret-handling warnings, the agent wire-frame directions, and the few notes without which the code they attach to reads as redundant, reorderable, or unsound.
* comments: say why, not whataur-build12 days1-23/+5
| | | | | | | | | | | | | | Every module-level `//!` header is gone, and the comments that remained either re-explained the line below them or had grown into paragraphs. Density went from one comment line per 6.7 lines of code to one per 10. 827 insertions against 2194 deletions across 86 files. What survived: the invariants (I1-I12), the design cross-references into DESIGN.md, and the notes recording a bug that was found and fixed — those are the comments that carry weight, because they answer a question the code cannot answer about itself. What did not: restating a function signature in prose, and narration of the statement underneath.
* time: relative arithmetic honors the pinned clockaur-build13 days1-7/+24
| | | | | | | | | | | | | | | | | | | `now()` returned the pinned instant when a test had pinned one, but `secs_ago`/`secs_ahead` called `Utc::now()` directly (m-1). Anything built from them — every lease expiry, every `next_check_at`, every cooldown cutoff — was therefore computed against the real wall clock and then compared against the pinned one. A test that pinned 2026-01-01 and took a 90-second lease got an expiry 90 seconds after *today*, so the reaper comparing `lease_expires_at < now()` saw a lease that would not expire for a century, or one that had expired millions of seconds ago, depending on which way the pin pointed. The test still passed, because nothing asserted on the number. Both now go through a `base()` that reads the pinned instant, so a pinned test computes and compares on the same clock. `tests/time.rs` pins the arithmetic directly and then does the thing the bug actually broke: claim a lease under a pinned clock, assert the expiry is 90 seconds after the pinned now, assert the reaper sees nothing yet, advance the pinned clock 91 seconds, and assert it reaps.
* feat: SQLite schema, migrations, single writer actoraur-build2026-11-171-0/+69
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).