Skip to content

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 15 Sep 06:12
· 27 commits to master since this release

Highlights

A from-the-ground-up rewrite. The engine now compiles cleanly to
three targets (native CLI, wasm, HTTP server) from one codebase,
ships with 47 unit tests, and respects the 256-line ceiling —
the largest file is src/time.rs at 241 lines.

The dependency tree went from ~190 transitive crates down to a
handful. Removed: serde, serde_json, chrono, anyhow,
reqwest, axum, maud, tracing, tokio, mimalloc, tower,
http-body, http, hyper, h2, bytes. Kept: rustls,
webpki-roots, wasm-bindgen, js-sys. No new deps.

What's in this release

Hand-rolled from first principles:

  • src/json/ — recursive-descent JSON parser + serializer
    (replaces serde_json)
  • src/time.rs — RFC 3339 parser, proleptic Gregorian calendar,
    unix epoch math (replaces chrono)
  • src/http.rs + src/http_server.rs — rustls HTTPS client +
    blocking HTTP/1.1 server with token-bucket rate limiter and
    per-IP state (replaces reqwest + axum)
  • src/escape.rs — SVG / URL / subject validation (replaces
    maud)
  • src/error.rs — flat Error enum with Result alias
    (replaces anyhow)
  • src/web/ — four files: mod.rs (router), headers.rs
    (CSP/security headers), pages.rs (HTML), css.rs (styles)

Module split — every file ≤ 241 lines:

Module Largest file Lines
card/ (11 files) graveyard.rs 121
metrics/ (4 files) analyze.rs 153
web/ (4 files) pages.rs 132
github/ (3 files) client.rs 156
json/ (2 files) parser.rs 213

Native → wasm portability fix:

Utc::now() previously panicked on wasm32-unknown-unknown because
it goes through SystemTime::now(). The wasm path now uses a
#[wasm_bindgen] extern "C" { fn wasm_clock_secs() -> f64; } import
that JS supplies via Date.now() / 1000.

Security headers (in web/headers.rs):

  • X-Content-Type-Options: nosniff
  • Referrer-Policy: no-referrer
  • X-Frame-Options: DENY
  • Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; connect-src https://api.github.com; img-src 'self' data:; font-src 'self'

Test coverage: 47 unit tests covering JSON parsing, RFC 3339
roundtripping, HSL→hex, fate thresholds, SVG element presence,
easter-egg rendering, XML escaping (XSS guard), and end-to-end
HTTP server loopback.

Verification

cargo test --lib           → 47 passed, 0 failed
cargo clippy ... -D warnings → clean
cargo fmt --all -- --check  → clean
wasm-pack build --release    → 44801-byte SVG output
cargo tree --edges normal   → 4 runtime deps (rustls,
                              webpki-roots, wasm-bindgen, js-sys)