fix(agent): cascade delete reads ids raw; integration tests run in CI #584

Merged
sharang merged 4 commits from fix/agent-integration-tests into main 2026-10-30 08:28:14 +00:00
4 Commits
Author SHA1 Message Date
Sharang ParnerkarandClaude Opus 5.5 721b0df7fc ci: leave the agent integration job out for now
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 15m42s
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
2026-10-30 09:12:25 +01:00
Sharang ParnerkarandClaude Opus 5.5 c34bfd8f92 ci: run the agent integration tests one at a time
CI / Agent integration (pull_request) Failing after 12m4s
CI / Check (pull_request) Canceled after 13m4s
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
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
2026-10-30 08:59:20 +01:00
Sharang ParnerkarandClaude Opus 5.5 3ef5c28a97 ci: agent integration tests in their own job with mongo
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Failing after 7m45s
CI / Check (pull_request) Successful in 14m32s
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
2026-10-30 08:34:24 +01:00
Sharang ParnerkarandClaude Opus 5.5 5424074d26 fix(agent): cascade delete reads ids raw; integration tests run in CI
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Failing after 18m34s
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
2026-10-29 22:36:09 +01:00