summaryrefslogtreecommitdiffstats
path: root/src/http/routes/mod.rs
Commit message (Collapse)AuthorAgeFilesLines
* http: ten request and response helpers were never crate-internal, just unmarkeddev10 days1-1/+1
| | | | | | | | | | | | | | | | | | | `http` declares 81 `pub(crate)` items, the densest cluster in the tree, and the census called every one of them the good state. Ten of them are not crate-internal at all: `State`, `Req`, `Res`, `logout`, and the five accessors on `Req` and constructors on `Res` are named only from `http/mod.rs`, the file that declares them. The router dispatches through them in the same file; the `pub(crate)` was describing an outside caller that does not exist. `cookie` is the one worth naming: it is the auth-cookie helper, it looked used from `http/routes/mod.rs`, and what is used there is a *field* named `cookie` on `Req`. A word-match census cannot tell those apart, which is the whole reason this pass was done by stripping markers and compiling rather than by reading the census output. priv 159 -> 149 (http 81 -> 71), overwide 22 -> 21. `cargo check` clean under both profiles, no new warnings; tests/http.rs, surfaces.rs, notices.rs and invariants.rs all pass (43 tests).
* sandbox: keep `Exit` out of the release buildaur-build11 days1-0/+14
| | | | | | | | | | | | | | | `Exit` is the result of running a command in a sandbox. `pipeline` consumes it through `Sandbox::run` — `.success()`, `.stderr` — without ever writing the name, which is why the census called it dead outside `sandbox`. The type now lives in a private `mod exit` and reaches the world through an alias that is `pub` only under `test-support` and `pub(crate)` otherwise. A `pub` definition inside a private module is not a nameable path from outside, but it is visible enough to appear in a public trait signature, which is what makes this possible where a plain `pub(crate) struct` is not. Verified with an external crate: naming `aur_build::sandbox::Exit` in a release build is `error[E0603]: struct Exit is private`; with `test-support` it compiles.
* http, config, sandbox: apply the rest of the dispositionsaur-build11 days1-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Five http items were being counted as test-pinned on the strength of a string alone, and are now `pub(crate)`: render::Attention the word appears in crash.rs inside a message Res::html "text/html" is a content type, not a call Res::redirect "redirect" appears in an assertion message routes::logout "/logout" is a route path routes::route "mutating route" appears in an assertion message Nothing in the test tier calls any of them; each carries a comment saying so, because "the census said a test needed this" is not a reason and will be re-asked by the next person to read the line. `config::TestHooks` was already half-gated — the `hooks` field and the `Default` line that fills it are both behind `test-support` — while the type and its impl were not, so a release binary compiled a struct it could never construct, read, or deserialize. Now gated whole. The live kata tier moved into `src/sandbox/kata.rs`. It is not a fixture test: it records its own absence without /dev/kvm or AUR_KATA_API, the same way the vercmp live tier does. It was the only thing outside the module naming `K8sSandboxProvisioner` field by field, so that struct is `pub(crate)` now too. One correction to the table, and it is the kind of correction a heuristic deserves: `http::cookie` and `http::login` were classified `move-test` because their tests contain no harness keyword. They do — `Web::` starts a real HTTP listener, and a test that talks to one is not a unit test however little code it holds. The detector now knows that, and both items are residue, which is what they always were. http: 27 pub -> 22 pub. Test-only items across the crate: 52 -> 46. Suite: 284 passed, 0 failed, 0 ignored. Clippy clean.
* foundation, http: export what is used above you, and nothing elsedev11 days1-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* comments: keep only what the code cannot showaur-build12 days1-15/+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-6/+0
| | | | | | | | | | | | | | 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.
* http: routes split by direction of travelaur-build13 days1-0/+207
n-4. `routes.rs` was 1,065 lines with the routing table, twenty-odd page renderers, every mutating POST, and the size/date formatting helpers in one file, so finding where a form landed meant scrolling past everything that did not touch it. It is a module now: `routes/mod.rs` keeps the gate, the login handlers, the routing table and the helpers two files share (207 lines); `routes/pages.rs` holds the read side, which only ever goes through `db.read`; `routes/mutations.rs` holds the write side, which is where the audit writes and the flash messages live. The split is by *read versus write*, which is the distinction the crate actually cares about — the read path uses the thread-local read-only connection and must never reach the writer — so the file boundary now matches the invariant rather than being an arbitrary line count. Behaviour is unchanged: the handlers are the same functions, re-exported into `routes` so the routing table still reads as one flat list of endpoints.