CVE and advisory ids, semgrep registry rules (both change daily)
ignored
LLM code review
advisory
control refs, which only the LLM control judge stamps today (Expect::llm_violations); shown in the report, never gating, per the #309 decision
NIGHTLY_BLESS=1 rewrites the snapshots (the expect block still has to hold). The report goes to target/nightly/report.md.
.gitea/workflows/nightly.yml replaces the stale e2e job, which also lacked the Firmwerk git auth and so could not even compile:
Services: mongo, plus the :latest agent image (dev mode, source_only).
Harness job: runs the harness in rust:1.94 and keeps the report as an artifact.
Alerting: opens one tracking issue while the nightly stays red.
Manual runs:workflow_dispatch has a bless input.
Bugs the first runs found (fixed here)
Scan runs silently vanished from GET /scan-runs (and the dashboard's scan list). Four phases the pipeline records (control_triage, semantic_control_mapping, grounded_control_checks, plc_provision) were missing from ScanPhase, so any run that reached them failed to deserialize. update_phase now takes ScanPhase, so the compiler stops this drift.
The PLC pump-station demo failed every scan since #256. Its optional live endpoint fell back to modbus://plc-sim:502, live URLs only accepted http(s), and one refused artifact failed the whole scan.
NetGuard::check_live_url now accepts modbus:// and opc.tcp://, with the same host rules.
DAST only takes http(s) live URLs.
Optional env-backed demo artifacts are skipped when their variable is unset, which the shell seeder already did.
Dependencies removed from a repo stayed in its SBOM forever. The pipeline's stale-entry delete compared the target id as an ObjectId against the stored hex string, so it matched nothing.
Rescanning an unchanged firmware repo wiped its SBOM (12 → 1 component). The firmware step deleted all entries, and the Syft stage is skipped when there are no new commits.
Fix for 3 and 4: each step now replaces only its own package managers.
The manifest's control_refs_any was never checked: the field wasn't in Expect, so serde dropped it. Zephyr's build system fact is now zephyr (west), matching the current Firmwerk.
Verification
cargo fmt --check and clippy -D warnings pass on all CI targets.
snapshot diff semantics (exact reports both directions, at-least only losses);
rule normalisation;
every recorded phase deserializes;
check_live_url accepts PLC schemes and refuses internal hosts;
an optional live URL is skipped without its env var.
End to end locally: the fixed agent binary, built in rust:1.94-bookworm and put on the current :latest image, against Mongo.
Before the fixes, the harness hung on the vanished runs and reported the pump-station failure.
After the fixes, bless on a fresh database, then compare on another fresh database: all 4 targets pass, deterministic across fresh runs, about 22 s.
A rescan on the same database now keeps the SBOM.
Not yet run in CI: the workflow runs :latest, which gets these fixes only once this merges and the image rebuilds. After merge I'll trigger it by hand.
Needs from you (secrets on platform/pruefwerk)
NIGHTLY_ALERT_TOKEN: a token with issue write, used for the tracking issue. Without it the job still goes red, just without the issue.
Optional:NIGHTLY_LITELLM_URL and NIGHTLY_LITELLM_API_KEY, so control refs appear in the advisory section.
Known limits
The Zephyr fixture clones upstream main, so an upstream change shows up as an SBOM diff to re-bless. #313 mirrors pinned fixtures.
The Zephyr baseline records the #317 junk entries on purpose; fixing #317 will show as an intended diff.
Closes #188 (part of epic #309).
## What
**`compliance-agent/tests/nightly.rs`, the harness**, runs against a running agent (`NIGHTLY_AGENT_URL`) and skips otherwise:
1. `POST /targets/demo-seed` (rescan) seeds the demo-target corpus.
2. It waits until every target has a *new* finished scan run.
3. It collects findings, SBOM, detected facts and applicable scans through the public API.
4. It compares them with two baselines:
- **the manifest `expect` block**, now a reusable `Expect::violations`;
- **a blessed snapshot**, `fixtures/nightly/baselines/<key>.json`:
| | |
|---|---|
| exact | scan status, skipped stages, SBOM (`manager:name@version`), deterministic findings (`scanner:rule file:line`: PLC rules, gitleaks, patterns, lint, our `cra-ai-*` semgrep rules) |
| at least | CVE and advisory ids, semgrep registry rules (both change daily) |
| ignored | LLM code review |
| advisory | control refs, which **only the LLM control judge stamps** today (`Expect::llm_violations`); shown in the report, never gating, per the #309 decision |
`NIGHTLY_BLESS=1` rewrites the snapshots (the `expect` block still has to hold). The report goes to `target/nightly/report.md`.
**`.gitea/workflows/nightly.yml`** replaces the stale e2e job, which also lacked the Firmwerk git auth and so could not even compile:
- **Services:** mongo, plus the **`:latest` agent image** (dev mode, `source_only`).
- **Harness job:** runs the harness in `rust:1.94` and keeps the report as an artifact.
- **Alerting:** opens one tracking issue while the nightly stays red.
- **Manual runs:** `workflow_dispatch` has a **bless** input.
## Bugs the first runs found (fixed here)
1. **Scan runs silently vanished from `GET /scan-runs`** (and the dashboard's scan list). Four phases the pipeline records (`control_triage`, `semantic_control_mapping`, `grounded_control_checks`, `plc_provision`) were missing from `ScanPhase`, so any run that reached them failed to deserialize. `update_phase` now takes `ScanPhase`, so the compiler stops this drift.
2. **The PLC pump-station demo failed every scan since #256.** Its optional live endpoint fell back to `modbus://plc-sim:502`, live URLs only accepted `http(s)`, and one refused artifact failed the whole scan.
- `NetGuard::check_live_url` now accepts `modbus://` and `opc.tcp://`, with the same host rules.
- DAST only takes `http(s)` live URLs.
- Optional env-backed demo artifacts are skipped when their variable is unset, which the shell seeder already did.
3. **Dependencies removed from a repo stayed in its SBOM forever.** The pipeline's stale-entry delete compared the target id as an ObjectId against the stored hex string, so it matched nothing.
4. **Rescanning an unchanged firmware repo wiped its SBOM** (12 → 1 component). The firmware step deleted *all* entries, and the Syft stage is skipped when there are no new commits.
Fix for 3 and 4: each step now replaces only its own package managers.
5. **The manifest's `control_refs_any` was never checked**: the field wasn't in `Expect`, so serde dropped it. Zephyr's build system fact is now `zephyr (west)`, matching the current Firmwerk.
## Verification
- `cargo fmt --check` and clippy `-D warnings` pass on all CI targets.
- Tests pass: core 92, agent 358, werkbank-exec 9, control-map 28, dashboard 28.
- New tests:
- `Expect::violations` and `llm_violations`;
- snapshot diff semantics (exact reports both directions, at-least only losses);
- rule normalisation;
- every recorded phase deserializes;
- `check_live_url` accepts PLC schemes and refuses internal hosts;
- an optional live URL is skipped without its env var.
- **End to end locally:** the fixed agent binary, built in `rust:1.94-bookworm` and put on the current `:latest` image, against Mongo.
- Before the fixes, the harness hung on the vanished runs and reported the pump-station failure.
- After the fixes, bless on a fresh database, then compare on another fresh database: **all 4 targets pass**, deterministic across fresh runs, about 22 s.
- A rescan on the same database now keeps the SBOM.
- **Not yet run in CI:** the workflow runs `:latest`, which gets these fixes only once this merges and the image rebuilds. After merge I'll trigger it by hand.
## Needs from you (secrets on platform/pruefwerk)
- **`NIGHTLY_ALERT_TOKEN`:** a token with issue write, used for the tracking issue. Without it the job still goes red, just without the issue.
- **Optional:** `NIGHTLY_LITELLM_URL` and `NIGHTLY_LITELLM_API_KEY`, so control refs appear in the advisory section.
## Known limits
- The Zephyr fixture clones upstream `main`, so an upstream change shows up as an SBOM diff to re-bless. #313 mirrors pinned fixtures.
- The Zephyr baseline records the #317 junk entries on purpose; fixing #317 will show as an intended diff.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
The nightly workflow only ran the stale e2e suite (#298). It lacked the
firmwerk git auth, so it could not even compile.
- tests/nightly.rs: seeds the demo-target corpus on a running agent
(NIGHTLY_AGENT_URL), waits for every scan, and compares the results with:
- the manifest's `expect` block, now `Expect::violations`, reusable;
- blessed snapshots in fixtures/nightly/baselines/: exact for scan status,
skipped stages, SBOM and deterministic findings; at-least for CVEs and
semgrep registry rules.
LLM code review is ignored. Control refs, which only the LLM control judge
stamps, are reported as advisory (`Expect::llm_violations`). NIGHTLY_BLESS=1
re-blesses. The report goes to target/nightly/.
- nightly.yml: mongo + the :latest agent image as services (dev mode,
source_only, optional LLM), the harness in rust:1.94, the report as an
artifact, and one tracking issue while the nightly stays red
(NIGHTLY_ALERT_TOKEN). workflow_dispatch has a "bless" input.
Bugs the first runs found, fixed here:
- Scan phases control_triage / semantic_control_mapping /
grounded_control_checks / plc_provision were missing from ScanPhase. Runs
failed to deserialize and silently dropped out of GET /scan-runs (and the
dashboard's scan list). update_phase now takes ScanPhase, so this cannot
drift again.
- The PLC pump-station demo failed every scan since #256: its optional live
endpoint fell back to modbus://plc-sim:502, and live URLs only accepted
http(s). NetGuard::check_live_url now also allows modbus:// and opc.tcp://,
with the same host rules; DAST only takes http(s) live URLs. Optional
env-backed demo artifacts are skipped when their env var is unset, as the
shell seeder already did.
- SBOM clean-up:
- The pipeline's stale-entry delete compared the target id as an ObjectId
against the stored hex string, so it never deleted anything, and removed
dependencies stayed in the SBOM forever.
- The firmware step deleted every entry, so a rescan with no new commits
wiped the Syft entries.
Each step now replaces only its own package managers.
- Manifest: `control_refs_any` was silently ignored (not in Expect). Zephyr's
detected build system is "zephyr (west)".
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #188 (part of epic #309).
What
compliance-agent/tests/nightly.rs, the harness, runs against a running agent (NIGHTLY_AGENT_URL) and skips otherwise:POST /targets/demo-seed(rescan) seeds the demo-target corpus.expectblock, now a reusableExpect::violations;fixtures/nightly/baselines/<key>.json:manager:name@version), deterministic findings (scanner:rule file:line: PLC rules, gitleaks, patterns, lint, ourcra-ai-*semgrep rules)Expect::llm_violations); shown in the report, never gating, per the #309 decisionNIGHTLY_BLESS=1rewrites the snapshots (theexpectblock still has to hold). The report goes totarget/nightly/report.md..gitea/workflows/nightly.ymlreplaces the stale e2e job, which also lacked the Firmwerk git auth and so could not even compile::latestagent image (dev mode,source_only).rust:1.94and keeps the report as an artifact.workflow_dispatchhas a bless input.Bugs the first runs found (fixed here)
Scan runs silently vanished from
GET /scan-runs(and the dashboard's scan list). Four phases the pipeline records (control_triage,semantic_control_mapping,grounded_control_checks,plc_provision) were missing fromScanPhase, so any run that reached them failed to deserialize.update_phasenow takesScanPhase, so the compiler stops this drift.The PLC pump-station demo failed every scan since #256. Its optional live endpoint fell back to
modbus://plc-sim:502, live URLs only acceptedhttp(s), and one refused artifact failed the whole scan.NetGuard::check_live_urlnow acceptsmodbus://andopc.tcp://, with the same host rules.http(s)live URLs.Dependencies removed from a repo stayed in its SBOM forever. The pipeline's stale-entry delete compared the target id as an ObjectId against the stored hex string, so it matched nothing.
Rescanning an unchanged firmware repo wiped its SBOM (12 → 1 component). The firmware step deleted all entries, and the Syft stage is skipped when there are no new commits.
Fix for 3 and 4: each step now replaces only its own package managers.
The manifest's
control_refs_anywas never checked: the field wasn't inExpect, so serde dropped it. Zephyr's build system fact is nowzephyr (west), matching the current Firmwerk.Verification
cargo fmt --checkand clippy-D warningspass on all CI targets.Expect::violationsandllm_violations;check_live_urlaccepts PLC schemes and refuses internal hosts;rust:1.94-bookwormand put on the current:latestimage, against Mongo.:latest, which gets these fixes only once this merges and the image rebuilds. After merge I'll trigger it by hand.Needs from you (secrets on platform/pruefwerk)
NIGHTLY_ALERT_TOKEN: a token with issue write, used for the tracking issue. Without it the job still goes red, just without the issue.NIGHTLY_LITELLM_URLandNIGHTLY_LITELLM_API_KEY, so control refs appear in the advisory section.Known limits
main, so an upstream change shows up as an SBOM diff to re-bless. #313 mirrors pinned fixtures.🤖 Generated with Claude Code
https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p