Add test suite, stats command, and fix runtime stack-overflow crash

- Bump urus to v0.2.2 (v0.2.1 -> v0.2.2) and smarm to v0.6.0, pulling in
  a urus fix (pushed alongside this commit) that spawns per-connection
  actors with a 256 KiB stack via smarm's RFC 019 SpawnOpts instead of
  the runtime's bare 64 KiB default. Without it, any request that hit
  fetch_asset_handler's in-handler gzip decompression (i.e. any client
  not sending Accept-Encoding: gzip) blew the actor's guard page and the
  connection died with no response - reproduced 5/5 runs before the fix,
  0/5 after.

- Add `ccc stats`: active/archived package and version counts, total
  gzipped bytes stored, and the resolved db path. Useful for a quick
  sanity check before/after a deploy.

- Add a real test suite, which is what caught the crash above:
    - src/store.rs unit tests: schema init/idempotency, create/add/
      archive success and error paths, gzip round-trip, upsert
      semantics, stats aggregation.
    - tests/cli.rs: black-box tests against the compiled `ccc` binary
      covering usage/exit codes and the full create/add/archive/stats
      lifecycle.
    - tests/server.rs: boots `ccc serve` as a real subprocess and drives
      it over raw TCP (no HTTP client dependency) - boot-without-
      crashing, asset serving both compressed and decompressed, 404s,
      package listing incl. archived-package hiding, and repeated
      sequential requests against one long-lived process.

27/27 tests passing (12 unit + 9 CLI + 6 server).
This commit is contained in:
2026-08-08 22:42:37 +02:00
parent cb9487fc8a
commit cdedab3302
6 changed files with 749 additions and 6 deletions
Generated
+5 -4
View File
@@ -378,9 +378,10 @@ checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
[[package]]
name = "smarm"
version = "0.5.0"
source = "git+https://git.kalsbeek.dev/Markk116/smarm.git?tag=v0.5.0#a03a7ca01ef1ecaeb8aabc00bebe7ddef4f3879a"
version = "0.6.0"
source = "git+https://git.kalsbeek.dev/Markk116/smarm.git?tag=v0.6.0#301e3463e3abb11ee25b94ee2ec31c497fb4e2b4"
dependencies = [
"cc",
"libc",
"loom",
]
@@ -473,8 +474,8 @@ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
[[package]]
name = "urus"
version = "0.2.0"
source = "git+https://git.kalsbeek.dev/Markk116/urus.git#b77448191ec33de1662305f3035473d64f8cd34f"
version = "0.2.2"
source = "git+https://git.kalsbeek.dev/Markk116/urus.git?tag=v0.2.2#535f7bcc687bcdf4ef5cf366177ac166aa8466a1"
dependencies = [
"httparse",
"libc",