Skip to main content

Crate reposix_sim

Crate reposix_sim 

Source
Expand description

Reposix simulator — in-process REST API that mimics issue-tracker semantics.

Exposes a handful of pure functions so integration tests can spin a real HTTP server on a random port without forking a process. The standalone reposix-sim binary is a thin tokio::main wrapper over run.

§Module layout

  • stateAppState shared across handlers.
  • dbSQLite connection opener + issues-table DDL.
  • seed — deterministic seed loader (reads fixtures/seed.json).
  • errorerror::ApiError enum + IntoResponse impl.
  • (routes and middleware land in task 2 of plan 02-01 / plan 02-02.)

Re-exports§

pub use error::Result;
pub use error::SimError;
pub use state::AppState;

Modules§

db
SQLite storage for the simulator — issues table + audit schema load.
error
Typed error types for the sim crate.
middleware
Axum middleware layers applied to the simulator router.
routes
Route modules for the simulator.
seed
Deterministic seed loader: reads a JSON file describing a project plus issues, and INSERT OR IGNOREs them into the issues table.
state
Shared application state for the simulator’s axum handlers.

Structs§

SimConfig
Runtime configuration for the simulator.

Constants§

CAPABILITIES
Capability matrix row published by this backend for reposix doctor.

Functions§

build_router
Build the axum router with both middleware layers attached.
prepare_state
Open the DB, seed if configured, and return an AppState.
run
Bind the configured address and serve until the listener dies.
run_with_listener
Run the sim on an already-bound listener. Integration tests use this to bind 127.0.0.1:0, read the ephemeral port, and drive the sim without racing a separate binary.