feat: bootstrap crate skeleton, deps, and TestError (#1) #19

Merged
charles merged 1 commit from feat/1-bootstrap-crate-skeleton into main 2026-04-11 18:41:59 +00:00
Owner

Closes #1.

Summary

Bootstraps the crate so subsequent stories have a stable foundation:

  • Cargo.toml: declares the runtime dependencies from spec §2 (tokio, tokio-tungstenite, serde_json, futures-util, reqwest with rustls, anyhow, colored) and gates clap behind a default-on cli feature.
  • src/lib.rs: declares the six top-level modules (assert, client, error, harness, report, runner) plus a prelude re-exporting TestError, TestResult, ProcessHarness, RpcClient, TestRunner, and serde_json::{json, Value}.
  • src/error.rs: full TestError enum with all six variants — Assertion, Timeout, Connection, RpcError, Skip, Other. TestResult alias. Display impl that pretty-prints assertion failures with the expected/got diff and source location. std::error::Error impl. From<anyhow::Error> and From<tokio_tungstenite::tungstenite::Error> conversions. Five unit tests cover each variant's Display.
  • src/{harness,client,runner}.rs: empty unit-struct stubs named ProcessHarness / RpcClient / TestRunner so the prelude re-exports compile. Real bodies land in their tickets.
  • src/{assert,report}.rs: empty module placeholders pointing to the issues that will populate them.

Checklist (from issue #1)

  • Cargo.toml declares the package and pulls in all required deps
  • src/lib.rs declares the modules and prelude
  • TestError enum with all variants including new Skip(String)
  • pub type TestResult = Result<(), TestError>;
  • Display, Debug, From<anyhow::Error>, From<tungstenite::Error>, std::error::Error
  • cargo build and cargo check succeed
  • cargo doc builds without warnings (verified locally)

Test plan

  • just qa (fmt-check + clippy -D warnings + tests) — green locally, 5/5 unit tests pass
  • CI green on Forgejo

Notes for the reviewer

  • Skip(String) is new vs the spec body — added per the spec-review §7 finding so tests can opt out at runtime via Err(TestError::Skip(...)). The runner ticket (#11) wires it up.
  • From<tokio_tungstenite::tungstenite::Error> uses the re-exported tungstenite path to avoid pulling in tungstenite as a separate dependency.
  • The placeholder unit structs in harness.rs/client.rs/runner.rs exist purely to make the prelude re-exports compile. Each ticket replaces them with the real type as it lands.
Closes #1. ## Summary Bootstraps the crate so subsequent stories have a stable foundation: - **Cargo.toml**: declares the runtime dependencies from spec §2 (tokio, tokio-tungstenite, serde_json, futures-util, reqwest with rustls, anyhow, colored) and gates `clap` behind a default-on `cli` feature. - **`src/lib.rs`**: declares the six top-level modules (`assert`, `client`, `error`, `harness`, `report`, `runner`) plus a `prelude` re-exporting `TestError`, `TestResult`, `ProcessHarness`, `RpcClient`, `TestRunner`, and `serde_json::{json, Value}`. - **`src/error.rs`**: full `TestError` enum with all six variants — `Assertion`, `Timeout`, `Connection`, `RpcError`, `Skip`, `Other`. `TestResult` alias. `Display` impl that pretty-prints assertion failures with the expected/got diff and source location. `std::error::Error` impl. `From<anyhow::Error>` and `From<tokio_tungstenite::tungstenite::Error>` conversions. Five unit tests cover each variant's `Display`. - **`src/{harness,client,runner}.rs`**: empty unit-struct stubs named `ProcessHarness` / `RpcClient` / `TestRunner` so the prelude re-exports compile. Real bodies land in their tickets. - **`src/{assert,report}.rs`**: empty module placeholders pointing to the issues that will populate them. ## Checklist (from issue #1) - [x] `Cargo.toml` declares the package and pulls in all required deps - [x] `src/lib.rs` declares the modules and `prelude` - [x] `TestError` enum with all variants including new `Skip(String)` - [x] `pub type TestResult = Result<(), TestError>;` - [x] `Display`, `Debug`, `From<anyhow::Error>`, `From<tungstenite::Error>`, `std::error::Error` - [x] `cargo build` and `cargo check` succeed - [x] `cargo doc` builds without warnings (verified locally) ## Test plan - [x] `just qa` (fmt-check + clippy `-D warnings` + tests) — green locally, 5/5 unit tests pass - [ ] CI green on Forgejo ## Notes for the reviewer - `Skip(String)` is new vs the spec body — added per the spec-review §7 finding so tests can opt out at runtime via `Err(TestError::Skip(...))`. The runner ticket (#11) wires it up. - `From<tokio_tungstenite::tungstenite::Error>` uses the re-exported tungstenite path to avoid pulling in `tungstenite` as a separate dependency. - The placeholder unit structs in `harness.rs`/`client.rs`/`runner.rs` exist purely to make the prelude re-exports compile. Each ticket replaces them with the real type as it lands.
feat(error): add TestError, TestResult, module skeleton (closes #1)
All checks were successful
qa / qa (pull_request) Successful in 3m23s
c05f124b10
Bootstraps the crate per ticket #1:

- Cargo.toml: declare runtime deps (tokio, tokio-tungstenite, serde_json,
  futures-util, reqwest with rustls, anyhow, colored) and an optional
  clap dep behind a default-on `cli` feature.
- src/lib.rs: declare the six top-level modules (assert, client, error,
  harness, report, runner) plus a `prelude` re-exporting the public
  surface (TestError, TestResult, ProcessHarness, RpcClient, TestRunner,
  serde_json::json/Value).
- src/error.rs: TestError enum with all six variants from the spec
  (Assertion, Timeout, Connection, RpcError, Skip, Other), TestResult
  alias, Display impl that pretty-prints assertion failures with the
  expected/got diff and source location, std::error::Error impl, and
  From<anyhow::Error> + From<tungstenite::Error> conversions. Includes
  five unit tests covering each variant's Display.
- src/harness.rs, src/client.rs, src/runner.rs: empty unit-struct stubs
  named ProcessHarness/RpcClient/TestRunner so the prelude re-exports
  compile. Real implementations land in their respective tickets.
- src/assert.rs, src/report.rs: empty module placeholders.

cargo build / cargo test / cargo clippy --all-targets -- -D warnings
all pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
charles left a comment

Review — bootstrap crate skeleton (#1)

Dépendances (Cargo.toml)

  • clap optionnel derrière la feature cli (default-on) — bonne décision pour une lib qui embarque une couche CLI.
  • reqwest avec rustls-tls + default-features = false — correct, évite native-TLS.
  • anyhow est déclaré mais n'est importé nulle part dans le code du framework (la gestion d'erreur repose entièrement sur TestError). Si c'est pour être re-exporté côté utilisateur, ça devrait être explicite (pub use anyhow). Sinon c'est une dépendance morte à retirer.

Skeleton des modules

  • Stubs compilables avec liens vers les issues dans les doc-comments — cohérent.
  • Module prelude posé dès le début — bon choix pour l'ergonomie utilisateur.

Aucun bloquant.

## Review — bootstrap crate skeleton (#1) ### Dépendances (Cargo.toml) - `clap` optionnel derrière la feature `cli` (default-on) — bonne décision pour une lib qui embarque une couche CLI. - `reqwest` avec `rustls-tls` + `default-features = false` — correct, évite native-TLS. - `anyhow` est déclaré mais n'est importé nulle part dans le code du framework (la gestion d'erreur repose entièrement sur `TestError`). Si c'est pour être re-exporté côté utilisateur, ça devrait être explicite (`pub use anyhow`). Sinon c'est une dépendance morte à retirer. ### Skeleton des modules - Stubs compilables avec liens vers les issues dans les doc-comments — cohérent. - Module `prelude` posé dès le début — bon choix pour l'ergonomie utilisateur. Aucun bloquant.
charles left a comment

Pas de bloquant — bonne fondation. Seul point à clarifier : anyhow est déclaré en dépendance mais n'est jamais importé dans le code du framework. Soit le re-exporter explicitement (pub use anyhow;) pour les utilisateurs, soit le retirer.

✅ Pas de bloquant — bonne fondation. Seul point à clarifier : `anyhow` est déclaré en dépendance mais n'est jamais importé dans le code du framework. Soit le re-exporter explicitement (`pub use anyhow;`) pour les utilisateurs, soit le retirer.
charles deleted branch feat/1-bootstrap-crate-skeleton 2026-04-11 18:42:00 +00:00
Sign in to join this conversation.
No description provided.