CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 6s
CI / Deploy Docs (push) Skipped
CI / Deploy MCP (push) Successful in 5m4s
CI / Deploy Dashboard (push) Successful in 6m57s
CI / Deploy Agent (push) Successful in 9m4s
First part of t72, Prüfwerk metering (LB §2 Abs. 4–5, §7). This PR records what a scan is metered by. Nothing is counted or enforced yet; counters, the 6-per-day limit and the Prüftag cap come in the next PR. ## What changes - **Included vs extra targets.** Each target stores `billing: included | extra`. - The oldest active targets by `created_at` are included, up to the plan's `limits.included_targets` from the registry entitlement. The rest are extra. - The split is refreshed before each scan and when a target is created. Archiving an included target moves the oldest extra one up. - A plan without that key includes every target, which is every plan until the registry sends the limits. So this PR changes nothing for existing tenants. - **Run attribution.** Each run records an `attribution`: - `request`: the customer started it (dashboard or API). - `support`: staff started it. - `change`: something the customer changed, i.e. new commits, other uploads, or a live URL. - `rescan`: only the Prüfwerk build changed. For scheduled and webhook scans it's set where change detection decides, so our rescan after an update is no longer counted as a customer change. `uploads_changed` / `content_changed` don't depend on `UPLOAD_CHANGE_SKIP`. - **`chargeable`.** Says whether the run counts once it completes: - a request always counts; - a change counts only on an extra target; - rescans and support scans never count. `scan.completed` now carries `attribution` and `counted` as properties. - **Dashboard.** The targets list shows a "Zusätzliches Prüfobjekt" badge on an extra target. ## Tests - **Core:** the included/extra split, attribution, and the contract table of what counts. - **Agent:** `content_changed`/`uploads_changed`, the `included_targets` limit, reading a stored target's billing, and a Mongo integration test (`tests/target_billing.rs`): the oldest are included, and an extra target moves up on archive. Not built locally, per the CI-only rule; CI is the compiler here. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Reviewed-on: #927
35 lines
655 B
Rust
35 lines
655 B
Rust
// Library entrypoint — re-exports for integration tests and the binary.
|
|
|
|
pub mod agent;
|
|
pub mod api;
|
|
pub mod classify;
|
|
pub mod config;
|
|
pub mod controls;
|
|
pub mod database;
|
|
pub mod demo_seed;
|
|
pub mod error;
|
|
pub mod evidence;
|
|
pub mod finding_migrations;
|
|
pub mod fixtures;
|
|
pub mod git_source;
|
|
pub mod import;
|
|
pub mod ingest;
|
|
pub mod license_conclusions;
|
|
pub mod lifecycle;
|
|
pub mod llm;
|
|
pub mod metering;
|
|
pub mod pentest;
|
|
pub mod pipeline;
|
|
pub mod rag;
|
|
pub mod registry;
|
|
pub mod retention;
|
|
pub mod scan_gate;
|
|
pub mod scheduler;
|
|
pub mod secrets;
|
|
pub mod targets;
|
|
pub mod tenant_path;
|
|
#[allow(dead_code)]
|
|
pub mod trackers;
|
|
pub mod webhooks;
|
|
pub mod werkbank;
|