Repository navigation
test: isolate application restart recovery from the shared server suite - #2032
BlueHotDog wants to merge 3 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Marked draft while addressing a safety-review finding in the coordinator: the long-lived Postgrex maintenance pool is linked to the cleanup owner, so an abnormal connection/pool exit can terminate that owner before child/database cleanup. I am replacing that lifetime with short-lived native connections and a fresh bounded teardown connection, with real failure-path checks. This is not a finding about the approved LLM mock or the restart assertions. Please do not merge this head while the cleanup revision is in progress. |
|
The coordinator safety finding is addressed in f067307. It traps exits before startup, unlinks and monitors short-lived maintenance pools, retires the create pool before the child starts, and uses a fresh bounded cleanup connection after child termination/reaping. Independent read-only review found the prior P2 addressed and no new material findings. Real native failure checks, signal/child-failure checks, precommit (1,092 regular tests), lint, strict compile and source-comment checks pass. I am marking the PR ready for review; fresh exact-head Codex review and remote CI remain separate gates. No merge or auto-merge is being performed. |
|
The standard-entry-point integration gap is fixed in b13298c. Normal test and test-record commands invoke the private phase internally; precommit and check inherit it through test. test-coverage exports native private-BEAM coverage and merges it through ExCoveralls while still running ordinary tests. The standalone target/help and redundant CI step are removed. Actual test, test-coverage and precommit runs each passed 1,092 ordinary tests plus one private restart test exactly once. test-record was dry-run only. Independent review verified the Make paths and actual ExCoveralls import behavior with no material findings. Marking ready for fresh exact-head review; CI remains a separate gate and no merge is being performed. |
Summary
Move the full
:frontman_servershutdown/recovery scenario out of the shared server test VM without removing it from the existing developer or CI workflows. Related: the CI failures on #2017; this is a separate test-infrastructure fix.Existing commands include both phases
make -C apps/frontman_server test: ordinary tests, then restart recovery in its private process/database.make -C apps/frontman_server test-coverage: private restart test with native coverdata export, then ordinary tests through ExCoveralls, which imports the private data before writingcover/cobertura.xml.make -C apps/frontman_server precommitandcheck: inherit both phases through their existingtestinvocation/dependency, exactly once.make -C apps/frontman_server test-record: retains ordinary recording, then runs the restart scenario with its approved existing LLM mock.There is no advertised standalone target or additional manual workflow. CI's existing
make -C apps/frontman_server test-coverageruns everything once; the previously added redundant CI step has been removed. Each phase propagates failures.Isolation and assertions
Every private invocation creates a cryptographically unique PostgreSQL database, migrates it, starts the real application in a separate BEAM, then destroys the entire disposable database. Caller/default database names, partitions and suffixes cannot select this database. No worker-specific cleanup or shared queue assertions are changed; the shared suite no longer changes Repo sandbox mode or stops the application.
Only the explicitly approved existing LLM-provider mock and its response fixtures are used. Repo, PostgreSQL, Oban, task APIs, Swarm runtime, and full application stop/start remain real. PaperTiger is disabled in the private VM; this scenario makes no Stripe or mail calls.
Preserved assertions: pending interactive approval; undispatched serial write; parked runtime; actual termination-generated
Interrupted by restart; exhausted fifth-turn allowance; rejection of a new turn; real API approval resolution; persisted model selection; reconstructed result ordering; completion; one turn; no write replay. The actual activationSyncResendContactOban job is asserted present and disappears with its disposable database—not through manual job deletion.Resource lifecycle and P2 fix
The coordinator traps exits before opening pools, covering the
start_link/unlink race. Each native maintenance pool is immediately unlinked/monitored, short-lived, and terminated/reaped with a finite timeout. The create pool ends before the child starts. After the child terminates/is reaped, cleanup opens a fresh native connection, drops only the successfully created database, and verifies absence. Rejected CREATE never enters database cleanup. Operational exceptions/exits produce operation/database-specific diagnostics and fail the command.Runtime is bounded at 120 seconds, each test at 30 seconds, and connection/query/reaping operations have finite timeouts. Catchable signals invoke cleanup; the shell disables Erlang's interactive Ctrl-C break handler. Host termination or SIGKILL of the coordinator cannot guarantee cleanup. If PostgreSQL cleanup is unavailable, the command reports failure and the named owned database needs removal after availability is restored; it never substitutes global job deletion.
Coverage behavior
Uses the installed ExCoveralls 0.18.5 APIs and native Erlang coverdata, with no new dependencies or coverage framework. Its source/help explicitly confirms
--import-coverimports after running ordinary tests; it does not skip the suite. The child instruments the same compiled application path and exports after its final real application stop. A unique temporary export directory prevents stale imports and is removed on completion/failure. The old Cobertura report is removed before either phase starts, so a failed private run cannot leave a stale success report.Validation of current integration revision
Toolchain: Elixir 1.20.0 / OTP 29, Node 24.9.0 and Yarn 4.18.0; real local PostgreSQL. Standard Make commands were run with fresh, owned disposable ordinary-validation databases because the default local test database already contains an old leaked activation job. That row was not deleted or edited.
make -C apps/frontman_server test TEST_ARGS='--seed 131551': 1,092 ordinary + 1 private passed, exactly once each.make -C apps/frontman_server test-coverage: repeated success, 1,092 ordinary + 1 private passed, exactly once each. Latest ordinary seed 343247; private seed 142660. Actual finalcover/cobertura.xmlparses as XML.FrontmanServer.Tasksline 427 (Interrupted by restart) and the preserved-approval branch at line 445. The combined XML includes the restart branch (line 427: seven hits). This checks real exported line data, not a fabricated coverage percentage.make -C apps/frontman_server precommit: 1,092 ordinary + 1 private passed, exactly once each; ordinary seed 598913. Compile/format/Credo passed.make -n -C apps/frontman_server check,precommit,test-record, andtest-coverage: each contains the private invocation exactly once.test-recordwas dry-run only—no recording/network LLM calls were made.make testfail without entering the private phase. The temporary test was removed; source test assertions remain unchanged.make testandmake test-coveragereturn nonzero and drop the private database. Coverage failure also removes its temporary export directory and leaves no stale report. A subsequent successful standard coverage run produced the final valid report.lint,strict-compile, supported-Nodemake check-source-comments, and diff check passed.Earlier real isolation/P2 regression evidence
pg_stat_activityshowed no maintenance session while the real child application ran, and distinct native backend PIDs for create and cleanup.Existing full-suite warnings/failure-path logs remain visible; no warnings are suppressed. No production behavior, dependencies, PHP/WordPress files, or plans changed.
skip-changelogis appropriate for this test-only chore. PR stays draft for parent review; no merge, auto-merge, force push, signing bypass, state promotion, or duplicate Codex request.