Skip to content

Latest commit

 

History

History
212 lines (151 loc) · 5.98 KB

developer-guide.md

File metadata and controls

212 lines (151 loc) · 5.98 KB

EdaTime Developer Guide

Local development

The backend workspace requires Rust 1.88 or newer. Cargo enforces this MSRV consistently for every workspace crate.

Run the app:

cargo run -p edatime-bin --bin edatime

Use a custom config file:

EDATIME_CONFIG=./config.toml cargo run -p edatime-bin --bin edatime

The app serves the frontend from frontend/ and listens on 127.0.0.1:3000 by default.

Validation

Backend validation:

cargo check-all   # workspace, all targets, all features
cargo lint        # Clippy with warnings denied
cargo test-all    # workspace tests with all features
cargo test-doc    # documentation tests

These repository-local aliases are defined in .cargo/config.toml. Run make verify-rust to execute formatting, compilation, linting, tests, doctests, and a benchmark compile as one group.

Frontend architecture and syntax validation (requires Node.js for the TypeScript tooling):

npm run check:frontend:all   # type-check + architecture checker
npm run check:frontend:budgets # production bundle budget check

Optional development workflow with Node.js:

npm run check:frontend
npm run typecheck          # TypeScript type-check (no emit)
npm run build:frontend     # dev build with sourcemaps
npm run build:frontend:prod # minified production build
npm run watch:frontend     # watch mode for dev

Combined local validation sequence:

make verify

Documentation

The repository includes a Sphinx + Read the Docs documentation site under docs/.

Local docs build:

python -m pip install -r docs/requirements.txt
python -m sphinx -b html docs docs/_build/html

Convenience Make targets:

make docs
make docs-clean

Start at docs/index.md for the structured documentation entry point.

Benchmarks

The repository exposes a reusable library target so internal pipeline code can be benchmarked directly.

Compile and run the Criterion benchmarks:

cargo bench --workspace

Current benchmark coverage:

  • Time-range filtering plus LTTB reduction on a synthetic multi-series dataset
  • Metadata profiling on a synthetic dataset with histograms enabled

If you change filtering, downsampling, or metadata profiling behavior, rerun the benchmark and compare regressions before merging.

CI and release checks

The main CI workflow lives in .github/workflows/ci.yml and runs:

  • cargo fmt-check
  • cargo check-all
  • cargo lint
  • cargo test-all
  • cargo test-doc
  • npm run check:frontend
  • cargo bench-check

This is intentionally a validation pipeline, not a deployment pipeline. There is no production release automation in the repository yet.

Docker

A multi-stage Dockerfile is included for containerized builds:

docker build -t edatime .
docker run --rm -p 3000:3000 edatime

The image uses rust:1.88-bookworm for the build stage and debian:bookworm-slim for the runtime — no Node.js required. The final image contains only the compiled binary and the frontend static files.

Makefile

Common targets:

Target Description
make build Debug build
make build-release Release build
make run Run in release mode
make dev Build frontend + run in debug mode
make check Static Rust, frontend, contract, and hygiene checks
make test Rust and frontend tests
make verify-rust All Rust quality groups
make verify Complete backend + frontend pre-merge gate
make frontend-prod Minified production frontend build
make docker Build Docker image
make docker-run Run Docker image

Security process

The automated dependency audit lives in .github/workflows/security.yml.

Local dependency audit:

cargo install cargo-audit --locked
cargo audit

The current security posture in the app is centered on:

  • upload-size enforcement
  • request validation
  • per-client rate limiting
  • short-lived in-memory caches tied to dataset revision
  • CSP headers for the frontend shell

See SECURITY.md for reporting expectations.

Keyboard shortcuts

Current chart and navigation shortcuts:

  • Alt+1 opens the upload page
  • Alt+2 opens the Signals page
  • Alt+3 opens the Preparation page
  • Alt+4 opens the Correlation matrix page
  • Alt+5 opens the Spectrum page
  • Alt+6 opens the Time-frequency page
  • Alt+7 opens the Causality page
  • Alt+8 opens the Drift page
  • Shift+R resets the main chart zoom
  • Shift+Z zooms out one step on the main chart
  • Shift+C clears adaptive line filters on the main chart
  • Shift+E exports visible filtered data as CSV for the active page

API reference

The application exposes only the versioned /api/v1 contract. The canonical method/path/request/response table is generated from contracts/api-v1.json in the API reference. Run make check-contract to verify that the router, frontend route table, contract artifact, and generated reference remain aligned.

Configuration

Runtime configuration via config.toml or environment variables:

Setting Env var Default
Server host EDATIME_HOST 127.0.0.1
Server port EDATIME_PORT 3000
Sample data path EDATIME_SAMPLE_DATA sample.csv
Cache TTL (seconds) EDATIME_CACHE_TTL_SECONDS 60
Cache max entries EDATIME_CACHE_MAX_ENTRIES 64
Cache max bytes EDATIME_CACHE_MAX_BYTES 67108864
Rate limit requests EDATIME_RATE_LIMIT_MAX_REQUESTS 1000
Rate limit window EDATIME_RATE_LIMIT_WINDOW_SECONDS 60
Max upload size EDATIME_MAX_UPLOAD_BYTES 268435456
Database URL EDATIME_DATABASE_URL —
Database backend EDATIME_DATABASE_BACKEND none

Phase 4 feature notes

The scatter page now includes:

  • a compact scatter matrix tied to the active query context
  • distribution cards for the selected axes and color column
  • CSV and JSON export of visible filtered scatter rows

The main chart toolbar now includes CSV and JSON export of filtered series rows.