Side finding from t47: the agent's integration tests aren't in CI and had rotted. 10 of 21 failed on main (run locally against MongoDB).
Causes
Seeding into the wrong database (5 tests): since the M7.2-D tenant split the API reads <db>_dev, but findings/stats/cascade tests still wrote into <db>. sbom/onboarding had already been fixed by hand. → TestServer::tenant_db_name(), used by every test that seeds data.
DAST target_typewebapp → web_app (the enum is snake_case; the API answered 422);
total_findings after resolving: the overview counts open findings only (open, triaged, needs_review), so 0, not 1. The test comment said the opposite of the code.
A real bug (cascade test): deleting a target looked up its DAST targets and pentest sessions as typed documents. while let Some(Ok(..)) stopped at the first one that didn't decode, so the DAST target and everything below it stayed behind. API-created documents decode fine, but an older or differently shaped one silently broke the deletion.
→ ids_of() reads only the _ids, raw, and deletes everything linked whatever the shape. delete_session_data() replaces three copies of the session cleanup. The cascade test keeps its old-shaped DAST target on purpose, as a regression test.
CI: not in this PR (follow-up, backlog t61). A `mongo:7` service container went away while the e2e binary ran, in the long check job, in a job of its own, and also with `--test-threads=1`. Mongo was reachable when the tests started, and the first binaries passed against it. The likely cause: in a memory-capped container, mongod sizes its WiredTiger cache from the host's RAM unless `--wiredTigerCacheSizeGB` is set (MongoDB docs). Whether the runner lets a service take that argument needs its own try. This PR leaves `ci.yml` unchanged.
Checks:cargo fmt and clippy -D warnings (agent) clean. All 21 agent integration tests pass (podman MongoDB), and lib tests are unchanged.
Side finding from t47: the agent's integration tests aren't in CI and had rotted. **10 of 21 failed on main** (run locally against MongoDB).
**Causes**
1. **Seeding into the wrong database (5 tests):** since the M7.2-D tenant split the API reads `<db>_dev`, but findings/stats/cascade tests still wrote into `<db>`. sbom/onboarding had already been fixed by hand. → `TestServer::tenant_db_name()`, used by every test that seeds data.
2. **Stale API contract (4 tests):**
- `repositories` / `critical` / `high` → `total_repositories` / `critical_findings` / `high_findings`;
- DAST `target_type` `webapp` → `web_app` (the enum is snake_case; the API answered 422);
- `total_findings` after resolving: the overview counts **open** findings only (open, triaged, needs_review), so 0, not 1. The test comment said the opposite of the code.
3. **A real bug (cascade test):** deleting a target looked up its DAST targets and pentest sessions as *typed* documents. `while let Some(Ok(..))` stopped at the first one that didn't decode, so the DAST target and everything below it **stayed behind**. API-created documents decode fine, but an older or differently shaped one silently broke the deletion.
→ `ids_of()` reads only the `_id`s, raw, and deletes everything linked whatever the shape. `delete_session_data()` replaces three copies of the session cleanup. The cascade test keeps its old-shaped DAST target on purpose, as a regression test.
**CI: not in this PR (follow-up, backlog t61).** A \`mongo:7\` service container went away while the e2e binary ran, in the long check job, in a job of its own, and also with \`--test-threads=1\`. Mongo was reachable when the tests started, and the first binaries passed against it. The likely cause: in a memory-capped container, mongod sizes its WiredTiger cache from the host's RAM unless \`--wiredTigerCacheSizeGB\` is set (MongoDB docs). Whether the runner lets a service take that argument needs its own try. This PR leaves \`ci.yml\` unchanged.
**Checks:** `cargo fmt` and `clippy -D warnings` (agent) clean. All 21 agent integration tests pass (podman MongoDB), and lib tests are unchanged.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
The agent's integration tests were not in CI and had rotted: 10 of 21
failed on main. Most seeded data into <db> while the API reads the
per-tenant <db>_dev since the M7.2 tenant split; the rest asserted old
field names (repositories, critical), the old DAST type spelling
(webapp, now web_app) and 'total_findings counts resolved ones' (the
overview counts open findings only).
One was a real bug: deleting a target found its DAST targets and
pentest sessions as typed documents, and 'while let Some(Ok(..))'
stopped at the first that did not decode, so its downstream data was
left behind. The cascade now reads only the _ids, raw (ids_of), and
deletes everything linked whatever the document's shape; the session
cleanup is one helper. The cascade test keeps an old-shaped DAST target
on purpose.
- tests/common: TestServer::tenant_db_name(); all seeding uses it
- ci.yml: a mongo:7 service and 'Tests (agent integration)'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
As the last step of the long check job, the mongo service had gone by
the time the tests ran (server selection timeout; at cleanup the
container was already removed), so 17 of 21 failed on connect. The
nightly, with the same service, keeps it. A job of its own starts mongo
with it, waits until mongo:27017 answers (and says so if it does not),
and builds only the agent's tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
In their own job mongo was up when the tests began, and the first test
binaries passed against it, but it went away while the e2e binary ran
its 21 tests in parallel, each with its own database: the cache is
sized from the host's RAM while the job's memory is capped. Serial,
the binary takes about 10 s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
Mongo as a service container goes away during the e2e binary, also run
serially: in a memory-capped container mongod sizes its WiredTiger cache
from the host's RAM unless --wiredTigerCacheSizeGB is set. Running these
tests in CI is its own follow-up (backlog); this PR keeps the test and
cascade fixes, all 21 green against a local MongoDB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
sharang
merged commit 9d4e46c34f into main2026-10-30 08:28:14 +00:00
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.
Side finding from t47: the agent's integration tests aren't in CI and had rotted. 10 of 21 failed on main (run locally against MongoDB).
Causes
<db>_dev, but findings/stats/cascade tests still wrote into<db>. sbom/onboarding had already been fixed by hand. →TestServer::tenant_db_name(), used by every test that seeds data.repositories/critical/high→total_repositories/critical_findings/high_findings;target_typewebapp→web_app(the enum is snake_case; the API answered 422);total_findingsafter resolving: the overview counts open findings only (open, triaged, needs_review), so 0, not 1. The test comment said the opposite of the code.while let Some(Ok(..))stopped at the first one that didn't decode, so the DAST target and everything below it stayed behind. API-created documents decode fine, but an older or differently shaped one silently broke the deletion.→
ids_of()reads only the_ids, raw, and deletes everything linked whatever the shape.delete_session_data()replaces three copies of the session cleanup. The cascade test keeps its old-shaped DAST target on purpose, as a regression test.CI: not in this PR (follow-up, backlog t61). A `mongo:7` service container went away while the e2e binary ran, in the long check job, in a job of its own, and also with `--test-threads=1`. Mongo was reachable when the tests started, and the first binaries passed against it. The likely cause: in a memory-capped container, mongod sizes its WiredTiger cache from the host's RAM unless `--wiredTigerCacheSizeGB` is set (MongoDB docs). Whether the runner lets a service take that argument needs its own try. This PR leaves `ci.yml` unchanged.
Checks:
cargo fmtandclippy -D warnings(agent) clean. All 21 agent integration tests pass (podman MongoDB), and lib tests are unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4