Repository navigation
test(cdc): non-CDC->CDC->drain->non-CDC lifecycle e2e + k8s permutation - #1348
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a Taskfile task and Bash wrapper to run a new Python e2e driver that exercises the CDC lifecycle (non-CDC → CDC eager/lazy → drain → restart) with DB/HTTP/CLI assertions, plus a Kubernetes permutation and tester helpers to run the same lifecycle on Kind; includes docs/specs and test wiring. ChangesCDC Lifecycle End-to-End Testing
Sequence Diagram(s)sequenceDiagram
participant Taskfile
participant BashWrapper
participant Deps
participant PythonDriver
participant NCPS
participant HTTP
participant DB
Taskfile->>BashWrapper: task test:cdc-lifecycle
BashWrapper->>Deps: nix run .#deps up --detached (PC port)
BashWrapper->>BashWrapper: wait ports ready (9000,5432,3306,6379)
BashWrapper->>PythonDriver: start driver (pass CLI args)
PythonDriver->>NCPS: start_ncps(clean?/cdc?/lazy?)
NCPS->>DB: record cdc_* keys / chunk tables
PythonDriver->>HTTP: fetch .narinfo, GET NAR bytes
PythonDriver->>NCPS: restart(cdc=True/False,lazy=...)
PythonDriver->>NCPS: run migrate-chunks-to-nar / fsck via run_cli
NCPS->>DB: migrate chunks → nar, clear cdc_* keys
PythonDriver->>Deps: EXIT trap -> process-compose down
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive end-to-end testing for the content-defined chunking (CDC) lifecycle (non-CDC -> CDC -> drain -> non-CDC). It adds a local Python-based e2e test driver (dev-scripts/test-cdc-lifecycle-e2e.py) with a corresponding Taskfile target, and extends the Kubernetes integration test suite (nix/k8s-tests) with a new multi-replica ha-s3-postgres-cdc-lifecycle permutation. Feedback on the changes focuses on improving robustness and error handling in the test scripts, specifically by replacing the deprecated preexec_fn with start_new_session=True in subprocess management, adding defensive guards when accessing Kubernetes ConfigMap data, and ensuring subprocess failures during chunk migration are explicitly caught with check=True.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
nix/k8s-tests/README.md (1)
306-306:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUpdate the expected output count from 12 to 13.
The troubleshooting command example shows the expected output as
12, but this PR adds a 13th permutation (ha-s3-postgres-cdc-lifecycle). Update the comment to reflect the new count.📝 Proposed fix
-# Should output: 12 +# Should output: 13🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@nix/k8s-tests/README.md` at line 306, Update the expected count in the troubleshooting example comment from "# Should output: 12" to "# Should output: 13" in the README entry that documents the command output; this reflects the new permutation "ha-s3-postgres-cdc-lifecycle" added by the PR so the example and comment are consistent with the updated permutations.dev-scripts/test-cdc-lifecycle-auto.sh (1)
1-56:⚠️ Potential issue | 🟠 Major | ⚡ Quick winBootstrap direnv before executing non-git commands.
This shell script runs several non-git commands (
cd,nix,python3) without first bootstrapping direnv. As per coding guidelines, non-interactive shell scripts matching**/*.shmust bootstrap direnv before any non-git command.🔧 Proposed fix
Add the direnv bootstrap block after the shebang and set flags:
#!/usr/bin/env bash set -euo pipefail + +# Bootstrap direnv in non-interactive shells +direnv status | grep -q "Found RC allowed 0" || direnv allow . && unset DIRENV_DIR DIRENV_FILE DIRENV_WATCHES DIRENV_DIFF && eval "$(direnv export bash)" # test-cdc-lifecycle-auto.sh — start the FIXED-port dev backendsAs per coding guidelines: Bootstrap direnv before any non-git command in non-interactive shells. Use:
direnv status | grep -q "Found RC allowed 0" || direnv allow . && unset DIRENV_DIR DIRENV_FILE DIRENV_WATCHES DIRENV_DIFF && eval "$(direnv export bash)". Seeenv-execution.md.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@dev-scripts/test-cdc-lifecycle-auto.sh` around lines 1 - 56, Add a direnv bootstrap block immediately after the shebang and before any non-git commands (before REPO_ROOT assignment and any calls to nix/run/python3) to satisfy the non-interactive shell guideline; implement the suggested check-and-allow flow (run direnv status check, direnv allow ., unset DIRENV_* vars, and eval direnv export bash) so the script boots direnv before it executes REPO_ROOT=..., nix run .#deps, and the final python3 dev-scripts/test-cdc-lifecycle-e2e.py "$@" invocation.Source: Coding guidelines
🧹 Nitpick comments (1)
dev-scripts/test-cdc-lifecycle-e2e.py (1)
606-608: 💤 Low valueConsider using
_for the unused return code.The
fsckreturn code is fetched but never checked. Use_to signal this is intentional.♻️ Proposed change
- rc, out = fsck(db, storage, repair=True) + _, out = fsck(db, storage, repair=True) with open(os.path.join(sdir, "fsck-repair.txt"), "w") as fp:🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@dev-scripts/test-cdc-lifecycle-e2e.py` around lines 606 - 608, The fsck call currently assigns the unused return code to rc which is never checked; change the assignment to use the canonical underscore for unused values (e.g., replace "rc, out = fsck(db, storage, repair=True)" with "_, out = fsck(db, storage, repair=True)") so it signals intent to ignore the return code while keeping the rest of the logic that writes out to the file using sdir and out intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@dev-scripts/test-cdc-lifecycle-auto.sh`:
- Around line 1-56: Add a direnv bootstrap block immediately after the shebang
and before any non-git commands (before REPO_ROOT assignment and any calls to
nix/run/python3) to satisfy the non-interactive shell guideline; implement the
suggested check-and-allow flow (run direnv status check, direnv allow ., unset
DIRENV_* vars, and eval direnv export bash) so the script boots direnv before it
executes REPO_ROOT=..., nix run .#deps, and the final python3
dev-scripts/test-cdc-lifecycle-e2e.py "$@" invocation.
In `@nix/k8s-tests/README.md`:
- Line 306: Update the expected count in the troubleshooting example comment
from "# Should output: 12" to "# Should output: 13" in the README entry that
documents the command output; this reflects the new permutation
"ha-s3-postgres-cdc-lifecycle" added by the PR so the example and comment are
consistent with the updated permutations.
---
Nitpick comments:
In `@dev-scripts/test-cdc-lifecycle-e2e.py`:
- Around line 606-608: The fsck call currently assigns the unused return code to
rc which is never checked; change the assignment to use the canonical underscore
for unused values (e.g., replace "rc, out = fsck(db, storage, repair=True)" with
"_, out = fsck(db, storage, repair=True)") so it signals intent to ignore the
return code while keeping the rest of the logic that writes out to the file
using sdir and out intact.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1653bb2c-baa0-4236-a3dd-11f250339672
📒 Files selected for processing (13)
Taskfile.ymldev-scripts/test-cdc-lifecycle-auto.shdev-scripts/test-cdc-lifecycle-e2e.pynix/k8s-tests/README.mdnix/k8s-tests/config.nixnix/k8s-tests/src/k8s_tests.pynix/k8s-tests/src/k8s_tests_tester.pyopenspec/changes/cdc-lifecycle-e2e-tests/.openspec.yamlopenspec/changes/cdc-lifecycle-e2e-tests/design.mdopenspec/changes/cdc-lifecycle-e2e-tests/proposal.mdopenspec/changes/cdc-lifecycle-e2e-tests/specs/cdc-lifecycle-e2e/spec.mdopenspec/changes/cdc-lifecycle-e2e-tests/specs/cdc-lifecycle-k8s-test/spec.mdopenspec/changes/cdc-lifecycle-e2e-tests/tasks.md
25505a6 to
217caae
Compare
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dev-scripts/test-cdc-lifecycle-auto.sh`:
- Around line 17-35: Add the direnv bootstrap check near the top of the script
(after the REPO_ROOT cd and before any non-git commands like nix or python are
run); specifically insert the provided direnv guard: run `direnv status | grep
-q "Found RC allowed 0" || direnv allow . && unset DIRENV_DIR DIRENV_FILE
DIRENV_WATCHES DIRENV_DIFF && eval "$(direnv export bash)"` so the environment
is allowed and exported before the script uses `nix run` or `process-compose`
(affects the global scope of this script where PC_PORT, cleanup(), trap, and
subsequent nix/process-compose calls execute).
In `@dev-scripts/test-cdc-lifecycle-e2e.py`:
- Around line 606-610: The fsck exit code (rc) returned by fsck(db, storage,
repair=True) is currently ignored so failures don't fail the phase; update the
post-fsck handling to check rc and fail the test when rc != 0 by raising an
exception or exiting non-zero (e.g., assert or sys.exit) before
writing/continuing to after/total_nar_count and the log; reference the rc
variable and the fsck(db, storage, repair=True) call so the check happens
immediately after that call and before subsequent steps that assume success.
In `@nix/k8s-tests/src/k8s_tests_tester.py`:
- Around line 1348-1385: The _serve_check function currently only tests
test_hashes[0], which may not be a chunked NAR; update _serve_check (and its
callers in Phase B) to accept or select a proven chunked hash instead of always
using test_hashes[0]: either add a parameter like chunked_hash to _serve_check
and pass the chunked hash captured in Phase A (or stored on the tester object),
or have _serve_check query the test_data (e.g., a new "chunked_narinfo_hash" or
"chunked_hash" key) and use that value when present; ensure the code paths that
call _serve_check in Phase B pass the chunked hash so the port-forward GETs
validate an actually chunked NAR.
- Around line 1328-1346: The subprocess.run call invoking kubectl in the code
block (the call that assigns to result) doesn't enforce failure on non-zero
exit; change it to ensure the test fails when the command fails by either adding
check=True to the subprocess.run invocation or immediately checking
result.returncode and raising an exception (include result.stdout and
result.stderr in the exception message) so the function (the block that runs
"/bin/ncps migrate-chunks-to-nar") fails fast on non-zero return codes.
In `@openspec/changes/cdc-lifecycle-e2e-tests/tasks.md`:
- Line 51: The status line for "7.4 Archive before merge" incorrectly states
tasks 6.2/6.3 are unimplemented while the checklist shows them implemented;
reconcile these by updating the status text to match the checklist: if 6.2 and
6.3 are implemented, change "unimplemented (6.2/6.3)" to "implemented
(6.2/6.3)"; if they are actually unimplemented, revert the checklist marks for
6.2/6.3 to not-implemented so the archive note is accurate. Ensure you edit the
"7.4 Archive before merge" note and the corresponding checklist entries (tasks
6.2 and 6.3) so both reflect the same implementation state.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8e502480-4eef-410e-9db1-3beef3230966
📒 Files selected for processing (13)
Taskfile.ymldev-scripts/test-cdc-lifecycle-auto.shdev-scripts/test-cdc-lifecycle-e2e.pynix/k8s-tests/README.mdnix/k8s-tests/config.nixnix/k8s-tests/src/k8s_tests.pynix/k8s-tests/src/k8s_tests_tester.pyopenspec/changes/cdc-lifecycle-e2e-tests/.openspec.yamlopenspec/changes/cdc-lifecycle-e2e-tests/design.mdopenspec/changes/cdc-lifecycle-e2e-tests/proposal.mdopenspec/changes/cdc-lifecycle-e2e-tests/specs/cdc-lifecycle-e2e/spec.mdopenspec/changes/cdc-lifecycle-e2e-tests/specs/cdc-lifecycle-k8s-test/spec.mdopenspec/changes/cdc-lifecycle-e2e-tests/tasks.md
✅ Files skipped from review due to trivial changes (4)
- openspec/changes/cdc-lifecycle-e2e-tests/.openspec.yaml
- openspec/changes/cdc-lifecycle-e2e-tests/design.md
- openspec/changes/cdc-lifecycle-e2e-tests/proposal.md
- nix/k8s-tests/README.md
🚧 Files skipped from review as they are similar to previous changes (3)
- Taskfile.yml
- nix/k8s-tests/src/k8s_tests.py
- nix/k8s-tests/config.nix
217caae to
021b8f6
Compare
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (1)
nix/k8s-tests/src/k8s_tests_tester.py (1)
1283-1313: ⚡ Quick winPreserve
kubectl rolloutoutput on restart failures.If Line 1287 or Line 1299 fails,
_test_cdc_lifecycle()only surfaces a genericLifecycle error: ..., so the rollout reason is lost. CatchCalledProcessErrorhere and include the captured stdout/stderr in the returnedTestResult.Suggested change
def _rollout_restart_and_wait(self, deployment_config: dict) -> TestResult: """Restart the ncps Deployment and wait for pods to be ready again.""" name = deployment_config["name"] namespace = deployment_config["namespace"] - subprocess.run( - [ - "kubectl", - "rollout", - "restart", - f"deployment/ncps-{name}", - "-n", - namespace, - ], - check=True, - capture_output=True, - ) - subprocess.run( - [ - "kubectl", - "rollout", - "status", - f"deployment/ncps-{name}", - "-n", - namespace, - "--timeout=180s", - ], - check=True, - capture_output=True, - ) + try: + subprocess.run( + [ + "kubectl", + "rollout", + "restart", + f"deployment/ncps-{name}", + "-n", + namespace, + ], + check=True, + capture_output=True, + text=True, + ) + subprocess.run( + [ + "kubectl", + "rollout", + "status", + f"deployment/ncps-{name}", + "-n", + namespace, + "--timeout=180s", + ], + check=True, + capture_output=True, + text=True, + ) + except subprocess.CalledProcessError as e: + output = (e.stdout or "") + (e.stderr or "") + return TestResult( + "Pods", + False, + f"kubectl rollout failed for ncps-{name}", + details=output.strip(), + ) # Reuse the pod-readiness gate so subsequent checks see ready pods. return self._test_pods(deployment_config)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@nix/k8s-tests/src/k8s_tests_tester.py` around lines 1283 - 1313, In _rollout_restart_and_wait, wrap the two subprocess.run calls that perform "kubectl rollout restart" and "kubectl rollout status" in a try/except that catches subprocess.CalledProcessError and returns a TestResult containing a clear lifecycle error message plus the captured stdout and stderr from the exception (use e.stdout/e.stderr) so the kubectl failure reason is preserved; on success continue to call and return self._test_pods(deployment_config) as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dev-scripts/test-cdc-lifecycle-e2e.py`:
- Around line 483-486: The test currently only asserts NAR presence and length
(using fetch_nar_bytes, check(len(nar) > 0, and state["baseline_nar_len"]) which
misses content corruption; compute a strong digest (e.g. SHA-256) of the
returned bytes from fetch_nar_bytes, store it in state (e.g.
state["baseline_nar_digest"]) and thereafter replace/augment length-based checks
with exact digest equality checks after each phase
(eager/lazy/drain/restart/fsck) where fetch_nar_bytes is called; update the
other occurrences that currently store or compare len(nar) to instead compute
and compare the digest (use the same digest key names for each phase like
baseline_nar_digest, eager_nar_digest, lazy_nar_digest, etc.) and keep the
existing chunked_nar_count checks unchanged.
- Around line 376-385: The migrate_chunks_to_nar function currently swallows
non-zero exits for dry-run mode; change its error handling so any non-zero
return code from run_cli("migrate-chunks-to-nar", ...) raises a RuntimeError
(include rc and out) even when dry_run is True so phase_drain() will fail on a
broken --dry-run path; update the conditional around rc != 0 (and the error
text) in migrate_chunks_to_nar to always raise on failure and keep returning out
otherwise.
- Around line 668-672: The cleanup block currently swallows all exceptions from
stop_ncps(state.get("srv"), state.get("f")); change it to catch Exception as e,
log the exception (include context like which srv/f failed) and fold the error
into result["error"] (create result["error"] if missing, e.g. append or
concatenate a short message and the exception string) so failures during cleanup
are visible to logs and the overall test result; update the finally block around
stop_ncps to perform these steps and preserve the original exception flow if
needed.
In `@nix/k8s-tests/src/k8s_tests_tester.py`:
- Around line 178-190: The CDC topology checks are incorrectly nested inside the
cdc_lifecycle guard; move the block that calls
_test_cdc_topology(deployment_config), appends topology_result to results, and
calls _print_test_result(topology_result) so it executes unconditionally (after
the lifecycle block), leaving the existing
_test_cdc_lifecycle(deployment_config) call and its result handling intact;
_test_cdc_topology already self-skips for single-replica/no-data cases, so this
change ensures eligible deployments exercise the phantom/cross-replica
assertions.
- Around line 1588-1628: The current _test_cdc_topology() uses test_hashes[0]
and treats states == {None} as success, which lets the topology test pass when
every replica reports the hash missing; change the logic in _test_cdc_topology()
so that a uniform "None" set is treated as failure (return a failing TestResult)
OR revalidate the object via the Service before declaring success: call the
existing HTTP recheck path (reuse _test_http_endpoints() or a dedicated service
GET) for the same test_hashes[0]; if the service confirms absence, still fail
the CDC topology test, otherwise proceed with the existing presence-agreement
checks. Ensure you update the branch that currently returns success for states
== {None} to instead either perform the revalidation or return a failure and
reference symbols _test_cdc_topology, _test_http_endpoints, _pod_presence_ok,
test_hashes, and TestResult.
In
`@openspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/specs/cdc-lifecycle-e2e/spec.md`:
- Around line 9-10: The WHEN line references the wrong entrypoint (task
test:deps:start); update the harness invocation to the actual lifecycle driver
by replacing any mention of task test:deps:start with the fixed-port wrapper
entrypoint task test:cdc-lifecycle (and/or nix run .#deps) so the scenario
describes invoking the e2e driver via task test:cdc-lifecycle (or nix run
.#deps), and verify any other occurrences in this spec (e.g., the lifecycle
entrypoint wording) are updated to match that actual wiring to avoid a
non-reproducible run path.
In `@openspec/specs/cdc-lifecycle-e2e/spec.md`:
- Around line 15-16: The spec's canonical scenario references the wrong task
entrypoint; update the WHEN/THEN lines to use the implemented fixed-port driver
entrypoint (replace references to "task test:deps:start" with "task
test:cdc-lifecycle") and ensure the requirement phrase about "ensure that each
instruction is followed for each code segment you review" remains verbatim and
consistent with the implemented task wiring (check the task name used by the
lifecycle flow and any surrounding text mentioning the wrapper/fixed-port deps
to match "task test:cdc-lifecycle").
---
Nitpick comments:
In `@nix/k8s-tests/src/k8s_tests_tester.py`:
- Around line 1283-1313: In _rollout_restart_and_wait, wrap the two
subprocess.run calls that perform "kubectl rollout restart" and "kubectl rollout
status" in a try/except that catches subprocess.CalledProcessError and returns a
TestResult containing a clear lifecycle error message plus the captured stdout
and stderr from the exception (use e.stdout/e.stderr) so the kubectl failure
reason is preserved; on success continue to call and return
self._test_pods(deployment_config) as before.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a0c17d0c-d0d8-4759-a733-7147bee4ea6e
📒 Files selected for processing (15)
Taskfile.ymldev-scripts/test-cdc-lifecycle-auto.shdev-scripts/test-cdc-lifecycle-e2e.pynix/k8s-tests/README.mdnix/k8s-tests/config.nixnix/k8s-tests/src/k8s_tests.pynix/k8s-tests/src/k8s_tests_tester.pyopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/.openspec.yamlopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/design.mdopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/proposal.mdopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/specs/cdc-lifecycle-e2e/spec.mdopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/specs/cdc-lifecycle-k8s-test/spec.mdopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/tasks.mdopenspec/specs/cdc-lifecycle-e2e/spec.mdopenspec/specs/cdc-lifecycle-k8s-test/spec.md
✅ Files skipped from review due to trivial changes (2)
- openspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/.openspec.yaml
- nix/k8s-tests/README.md
🚧 Files skipped from review as they are similar to previous changes (4)
- dev-scripts/test-cdc-lifecycle-auto.sh
- Taskfile.yml
- nix/k8s-tests/src/k8s_tests.py
- nix/k8s-tests/config.nix
d510e49 to
3d06e81
Compare
Address PR #1348 review (gemini-code-assist, coderabbitai): - e2e driver: use start_new_session=True instead of preexec_fn=os.setsid; fail the cross-cutting phase when 'fsck --repair' exits non-zero. - auto.sh: bootstrap direnv before nix/python (env-execution rule) so it works standalone, not only under 'task'. - k8s tester: guard ConfigMap data before reading config.yaml; raise when the in-pod migrate-chunks-to-nar exec returns non-zero; drive Phase B's drain-mode serve check with a DB-proven chunked narinfo hash instead of an arbitrary test hash. Threads: PRRT_kwDONV6tZs6Hofcm, PRRT_kwDONV6tZs6Hofco, PRRT_kwDONV6tZs6Hofcp, PRRT_kwDONV6tZs6HohVZ, PRRT_kwDONV6tZs6HohVa, PRRT_kwDONV6tZs6HohVb, PRRT_kwDONV6tZs6HohVc Co-Authored-By: Claude Opus 4.8 <[email protected]>
Address PR #1348 re-review (coderabbitai): - e2e driver: fail on non-zero migrate-chunks-to-nar --dry-run exit; assert NAR content identity via sha256 of decompressed bytes (catches same-size corruption) across lazy/drain/restart/fsck rereads; surface cleanup stop_ncps() failures into result instead of swallowing them. - k8s tester: run multi-replica topology checks for every deployment (not only cdc-lifecycle) since _test_cdc_topology self-skips ineligible ones; treat 'NAR absent on all replicas' as a failure (it was served earlier). - specs: point the harness-invocation scenario at the fixed-port 'task test:cdc-lifecycle' entrypoint instead of the random-port 'task test:deps:start'. Threads: PRRT_kwDONV6tZs6HooDa, PRRT_kwDONV6tZs6HooDb, PRRT_kwDONV6tZs6HooDc, PRRT_kwDONV6tZs6HooDe, PRRT_kwDONV6tZs6HooDf, PRRT_kwDONV6tZs6HooDg, PRRT_kwDONV6tZs6HooDi Co-Authored-By: Claude Opus 4.8 <[email protected]>
021b8f6 to
7e1f709
Compare
3d06e81 to
f61201e
Compare
Address PR #1348 review (gemini-code-assist, coderabbitai): - e2e driver: use start_new_session=True instead of preexec_fn=os.setsid; fail the cross-cutting phase when 'fsck --repair' exits non-zero. - auto.sh: bootstrap direnv before nix/python (env-execution rule) so it works standalone, not only under 'task'. - k8s tester: guard ConfigMap data before reading config.yaml; raise when the in-pod migrate-chunks-to-nar exec returns non-zero; drive Phase B's drain-mode serve check with a DB-proven chunked narinfo hash instead of an arbitrary test hash. Threads: PRRT_kwDONV6tZs6Hofcm, PRRT_kwDONV6tZs6Hofco, PRRT_kwDONV6tZs6Hofcp, PRRT_kwDONV6tZs6HohVZ, PRRT_kwDONV6tZs6HohVa, PRRT_kwDONV6tZs6HohVb, PRRT_kwDONV6tZs6HohVc Co-Authored-By: Claude Opus 4.8 <[email protected]>
Address PR #1348 re-review (coderabbitai): - e2e driver: fail on non-zero migrate-chunks-to-nar --dry-run exit; assert NAR content identity via sha256 of decompressed bytes (catches same-size corruption) across lazy/drain/restart/fsck rereads; surface cleanup stop_ncps() failures into result instead of swallowing them. - k8s tester: run multi-replica topology checks for every deployment (not only cdc-lifecycle) since _test_cdc_topology self-skips ineligible ones; treat 'NAR absent on all replicas' as a failure (it was served earlier). - specs: point the harness-invocation scenario at the fixed-port 'task test:cdc-lifecycle' entrypoint instead of the random-port 'task test:deps:start'. Threads: PRRT_kwDONV6tZs6HooDa, PRRT_kwDONV6tZs6HooDb, PRRT_kwDONV6tZs6HooDc, PRRT_kwDONV6tZs6HooDe, PRRT_kwDONV6tZs6HooDf, PRRT_kwDONV6tZs6HooDg, PRRT_kwDONV6tZs6HooDi Co-Authored-By: Claude Opus 4.8 <[email protected]>
7e1f709 to
69fc398
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
♻️ Duplicate comments (1)
nix/k8s-tests/src/k8s_tests_tester.py (1)
1377-1391:⚠️ Potential issue | 🟠 Major | ⚡ Quick winFail Phase B when no chunk-backed narinfo can be identified.
If
_chunked_narinfo_hash()returnsNone,_serve_check()falls back totest_hashes[0], so the drain-mode check can still pass without ever exercising a chunk-backed NAR. That reintroduces a false-green on the core lifecycle assertion.Suggested fix
chunked_hash = self._chunked_narinfo_hash(deployment_config) + if not chunked_hash: + return TestResult( + "CDC Lifecycle", + False, + "Phase A: could not identify a chunk-backed narinfo for drain-mode validation", + ) details.append( f"Phase A: {chunks[0]} chunks, cdc_enabled present" + (f", chunked narinfo {chunked_hash}" if chunked_hash else "") )Also applies to: 1467-1486
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@nix/k8s-tests/src/k8s_tests_tester.py` around lines 1377 - 1391, The drain-mode serve check currently falls back to test_hashes[0] when no chunk-backed narinfo is found, allowing a false-positive; update _serve_check to call self._chunked_narinfo_hash(deployment_config) when narinfo_hash is None and, if that helper returns None, return False (fail Phase B) instead of using test_hashes[0]; apply the same change to the other occurrence around the 1467-1486 block so both code paths require a chunk-backed narinfo and only use test_hashes as a secondary non-drain fallback.
🧹 Nitpick comments (1)
dev-scripts/test-cdc-lifecycle-e2e.py (1)
500-519: ⚡ Quick winDeduplicate Phase 0 before the state contract drifts further.
phase_baseline()and the inline baseline block inrun_lifecycle()already disagree on what Phase 0 records: this helper still writesbaseline_nar_len, while later phases consumebaseline_digest. If someone reusesphase_baseline()later, Phase 2 will fail onstate["baseline_digest"]. Please route Phase 0 through one implementation or delete the stale helper.Also applies to: 693-704
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@dev-scripts/test-cdc-lifecycle-e2e.py` around lines 500 - 519, phase_baseline() is out of sync with run_lifecycle(): it writes state["baseline_nar_len"] while later phases expect state["baseline_digest"], causing Phase 2 to fail; update phase_baseline (the phase_baseline function) to populate state["baseline_digest"] (e.g., set state["baseline_digest"] = h or compute the digest from the fetched nar) and remove or stop relying on state["baseline_nar_len"], or alternatively delete the stale helper and funnel Phase 0 through the single implementation used in run_lifecycle so both places use the same state key.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dev-scripts/test-cdc-lifecycle-e2e.py`:
- Around line 632-642: The presence sweep currently iterates only over
("baseline","baseline_hash") and ("eager","eager_hash") and omits the lazy
upload recorded by phase_cdc_lazy() in state["lazy_hash"]; update the loop in
dev-scripts/test-cdc-lifecycle-e2e.py to include the lazy pair (e.g.
("lazy","lazy_hash")) so the same fetch_narinfo -> parse_narinfo ->
http_head/http_get checks run for the lazy NAR as well, ensuring
head_status/get_status and body length assertions are applied to
state["lazy_hash"] just like baseline_hash and eager_hash.
- Around line 605-614: The test currently reads the boot log once after
restart() and may race with startup writes; change the assertion to poll the
log_path for the drain-completion text within a short timeout (e.g., loop for a
few seconds with small sleep intervals), reopening/reading the file each
iteration and breaking when "drain" (case-insensitive) is found, then call
check(...) only after the loop to fail if the message never appears; update the
section around restart(...), log_path and the final check to use this polling
logic so the test reliably waits for drain completion.
In `@nix/k8s-tests/src/k8s_tests_tester.py`:
- Around line 1421-1422: The broad "except Exception: return False" blocks at
the shown try/except sites must not swallow transport/port-forward/request setup
errors; change them to either catch only expected semantic-validation exceptions
or remove the except entirely so the exception bubbles up (or log and re-raise).
Specifically, update the try/except around the port-forward/request setup (the
two blocks at the locations shown) to avoid returning False on generic
Exception—use specific exception types (e.g., subprocess.CalledProcessError,
requests.exceptions.RequestException) if you need to handle transport errors,
otherwise re-raise the exception so the failing TestResult reflects the real
infrastructure error.
---
Duplicate comments:
In `@nix/k8s-tests/src/k8s_tests_tester.py`:
- Around line 1377-1391: The drain-mode serve check currently falls back to
test_hashes[0] when no chunk-backed narinfo is found, allowing a false-positive;
update _serve_check to call self._chunked_narinfo_hash(deployment_config) when
narinfo_hash is None and, if that helper returns None, return False (fail Phase
B) instead of using test_hashes[0]; apply the same change to the other
occurrence around the 1467-1486 block so both code paths require a chunk-backed
narinfo and only use test_hashes as a secondary non-drain fallback.
---
Nitpick comments:
In `@dev-scripts/test-cdc-lifecycle-e2e.py`:
- Around line 500-519: phase_baseline() is out of sync with run_lifecycle(): it
writes state["baseline_nar_len"] while later phases expect
state["baseline_digest"], causing Phase 2 to fail; update phase_baseline (the
phase_baseline function) to populate state["baseline_digest"] (e.g., set
state["baseline_digest"] = h or compute the digest from the fetched nar) and
remove or stop relying on state["baseline_nar_len"], or alternatively delete the
stale helper and funnel Phase 0 through the single implementation used in
run_lifecycle so both places use the same state key.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ab3552e2-b1ff-4bc0-bcbf-e9a7642af845
📒 Files selected for processing (15)
Taskfile.ymldev-scripts/test-cdc-lifecycle-auto.shdev-scripts/test-cdc-lifecycle-e2e.pynix/k8s-tests/README.mdnix/k8s-tests/config.nixnix/k8s-tests/src/k8s_tests.pynix/k8s-tests/src/k8s_tests_tester.pyopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/.openspec.yamlopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/design.mdopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/proposal.mdopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/specs/cdc-lifecycle-e2e/spec.mdopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/specs/cdc-lifecycle-k8s-test/spec.mdopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/tasks.mdopenspec/specs/cdc-lifecycle-e2e/spec.mdopenspec/specs/cdc-lifecycle-k8s-test/spec.md
✅ Files skipped from review due to trivial changes (4)
- openspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/design.md
- openspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/proposal.md
- openspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/.openspec.yaml
- nix/k8s-tests/README.md
🚧 Files skipped from review as they are similar to previous changes (4)
- Taskfile.yml
- nix/k8s-tests/config.nix
- nix/k8s-tests/src/k8s_tests.py
- dev-scripts/test-cdc-lifecycle-auto.sh
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (3)
nix/k8s-tests/src/k8s_tests_tester.py (3)
1470-1486:⚠️ Potential issue | 🟠 Major | ⚡ Quick winFail Phase A if no narinfo-backed chunked hash can be found.
chunks > 0is not enough here. When_chunked_narinfo_hash()returnsNone,_serve_check()silently falls back totest_hashes[0], so Phase B can pass without ever exercising drain-mode serving from a known-chunked NAR.Suggested change
chunked_hash = self._chunked_narinfo_hash(deployment_config) + if not chunked_hash: + return TestResult( + "CDC Lifecycle", + False, + "Phase A: no narinfo-backed chunked NAR found; drain-mode serve check would not exercise chunked serving", + ) details.append( - f"Phase A: {chunks[0]} chunks, cdc_enabled present" - + (f", chunked narinfo {chunked_hash}" if chunked_hash else "") + f"Phase A: {chunks[0]} chunks, cdc_enabled present, chunked narinfo {chunked_hash}" )🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@nix/k8s-tests/src/k8s_tests_tester.py` around lines 1470 - 1486, Phase A currently records "chunks > 0" as success even when _chunked_narinfo_hash(deployment_config) returns None, which allows Phase B to pass using a fallback hash; change the Phase A logic in the block using _chunked_narinfo_hash, chunks and deployment_config so that if chunks > 0 but chunked_hash is falsy you immediately return a failing TestResult for "CDC Lifecycle" with a clear message ("Phase A: no narinfo-backed chunked hash found") instead of proceeding; this ensures _serve_check(deployment_config, chunked_hash) always gets a real chunked hash when chunks were detected.
190-193:⚠️ Potential issue | 🟠 Major | ⚡ Quick winKeep topology behind a proven service baseline.
_test_cdc_topology()now treats{None}as a real regression becausetest_hashes[0]was “served earlier via the Service”, but this call still happens even when_test_http_endpoints()already failed. That turns an existing service/storage outage into a second, misleading topology failure. Either skip topology when that service precondition was not met, or revalidate the hash through the Service inside_test_cdc_topology()before using the all-absent branch.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@nix/k8s-tests/src/k8s_tests_tester.py` around lines 190 - 193, The topology test is being run even when the Service baseline may have failed, causing a misleading second failure; update the call site or the _test_cdc_topology implementation to guard against that: either (A) at the call site, only invoke _test_cdc_topology(deployment_config) if the HTTP/service baseline from _test_http_endpoints() succeeded, or (B) inside _test_cdc_topology(), revalidate the served hash via the Service (e.g., attempt to read test_hashes[0] through the Service endpoint) before treating {None} as a real regression and fallback to the "all-absent" branch; pick one approach and implement the corresponding conditional check so topology is only evaluated when the service baseline is confirmed.
1421-1422:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDon’t collapse setup errors into semantic CDC failures.
These
except Exception: return Falseblocks turn port-forward startup failures,kubectlerrors, and request setup problems into plain “did not serve” / “phantom presence” results. Let unexpected transport errors bubble so the outerTestResultreports the real infrastructure failure.Also applies to: 1598-1599
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@nix/k8s-tests/src/k8s_tests_tester.py` around lines 1421 - 1422, The broad "except Exception: return False" swallows infrastructure/transport errors; replace those catches (both occurrences) with either no catch (let exceptions propagate) or narrow catches for only the expected semantic failure types (e.g., specific validation or timeout exceptions), and re-raise or log and re-raise unexpected errors so kubectl/port-forward/subprocess/k8s client failures surface. Locate the two occurrences of "except Exception: return False" in k8s_tests_tester.py and change them to either remove the handler or to catch targeted exceptions (for example requests.exceptions.RequestException, subprocess.CalledProcessError, kubernetes.client.exceptions.ApiException) and only return False for the truly expected CDC/semantic failure cases while allowing other exceptions to bubble up.Source: Linters/SAST tools
🧹 Nitpick comments (1)
dev-scripts/test-cdc-lifecycle-e2e.py (1)
500-519: ⚡ Quick winCollapse the duplicated Phase 0 setup into one code path.
phase_baseline()and the inline baseline block inrun_lifecycle()have already drifted: the helper storesbaseline_nar_len, while later phases consumebaseline_digest. Keeping both copies makes the baseline assertions easy to update in only one place.Also applies to: 685-705
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@dev-scripts/test-cdc-lifecycle-e2e.py` around lines 500 - 519, Duplicate baseline setup exists between phase_baseline() and an inline block in run_lifecycle(); consolidate them by making phase_baseline() the single source of truth: have phase_baseline() compute and store both the baseline hash/digest (state["baseline_digest"] or update existing state["baseline_hash"]) and the baseline NAR length (state["baseline_nar_len"]), and ensure it performs the same checks currently duplicated (cdc keys, narinfo fetch, nar length, chunked_nar_count). Then remove the inline baseline code in run_lifecycle() and replace it with a call to phase_baseline(state, db, storage, sdir), updating any later phases to read state["baseline_digest"] (or the chosen consistent key) instead of the old duplicated value so there is one canonical baseline value and assertions only live in phase_baseline().
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dev-scripts/test-cdc-lifecycle-e2e.py`:
- Around line 627-669: The test never actually deletes a narinfo to exercise the
"non-destructive purge" invariant; add a step that removes one of the two
references to a shared NAR (e.g. call the existing deletion helper for the
"eager" narinfo using state["eager_hash"] or a suitable
delete_narinfo()/remove_narinfo() function), then assert the deleted narinfo is
gone (fetch_narinfo(state["eager_hash"]) is None or appropriate 404) while the
surviving reference (fetch_narinfo(state["baseline_hash"]), http_head/http_get
on the NAR path, and served_nar_digest(parse_narinfo(...))) still serves the
bytes and matches state["baseline_digest"]; run fsck/repair again if necessary
and re-check the surviving NAR content unchanged.
---
Duplicate comments:
In `@nix/k8s-tests/src/k8s_tests_tester.py`:
- Around line 1470-1486: Phase A currently records "chunks > 0" as success even
when _chunked_narinfo_hash(deployment_config) returns None, which allows Phase B
to pass using a fallback hash; change the Phase A logic in the block using
_chunked_narinfo_hash, chunks and deployment_config so that if chunks > 0 but
chunked_hash is falsy you immediately return a failing TestResult for "CDC
Lifecycle" with a clear message ("Phase A: no narinfo-backed chunked hash
found") instead of proceeding; this ensures _serve_check(deployment_config,
chunked_hash) always gets a real chunked hash when chunks were detected.
- Around line 190-193: The topology test is being run even when the Service
baseline may have failed, causing a misleading second failure; update the call
site or the _test_cdc_topology implementation to guard against that: either (A)
at the call site, only invoke _test_cdc_topology(deployment_config) if the
HTTP/service baseline from _test_http_endpoints() succeeded, or (B) inside
_test_cdc_topology(), revalidate the served hash via the Service (e.g., attempt
to read test_hashes[0] through the Service endpoint) before treating {None} as a
real regression and fallback to the "all-absent" branch; pick one approach and
implement the corresponding conditional check so topology is only evaluated when
the service baseline is confirmed.
- Around line 1421-1422: The broad "except Exception: return False" swallows
infrastructure/transport errors; replace those catches (both occurrences) with
either no catch (let exceptions propagate) or narrow catches for only the
expected semantic failure types (e.g., specific validation or timeout
exceptions), and re-raise or log and re-raise unexpected errors so
kubectl/port-forward/subprocess/k8s client failures surface. Locate the two
occurrences of "except Exception: return False" in k8s_tests_tester.py and
change them to either remove the handler or to catch targeted exceptions (for
example requests.exceptions.RequestException, subprocess.CalledProcessError,
kubernetes.client.exceptions.ApiException) and only return False for the truly
expected CDC/semantic failure cases while allowing other exceptions to bubble
up.
---
Nitpick comments:
In `@dev-scripts/test-cdc-lifecycle-e2e.py`:
- Around line 500-519: Duplicate baseline setup exists between phase_baseline()
and an inline block in run_lifecycle(); consolidate them by making
phase_baseline() the single source of truth: have phase_baseline() compute and
store both the baseline hash/digest (state["baseline_digest"] or update existing
state["baseline_hash"]) and the baseline NAR length (state["baseline_nar_len"]),
and ensure it performs the same checks currently duplicated (cdc keys, narinfo
fetch, nar length, chunked_nar_count). Then remove the inline baseline code in
run_lifecycle() and replace it with a call to phase_baseline(state, db, storage,
sdir), updating any later phases to read state["baseline_digest"] (or the chosen
consistent key) instead of the old duplicated value so there is one canonical
baseline value and assertions only live in phase_baseline().
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5eb9118a-6c2d-4fcd-9a46-922bd8377f23
📒 Files selected for processing (15)
Taskfile.ymldev-scripts/test-cdc-lifecycle-auto.shdev-scripts/test-cdc-lifecycle-e2e.pynix/k8s-tests/README.mdnix/k8s-tests/config.nixnix/k8s-tests/src/k8s_tests.pynix/k8s-tests/src/k8s_tests_tester.pyopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/.openspec.yamlopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/design.mdopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/proposal.mdopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/specs/cdc-lifecycle-e2e/spec.mdopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/specs/cdc-lifecycle-k8s-test/spec.mdopenspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/tasks.mdopenspec/specs/cdc-lifecycle-e2e/spec.mdopenspec/specs/cdc-lifecycle-k8s-test/spec.md
✅ Files skipped from review due to trivial changes (4)
- openspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/.openspec.yaml
- openspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/proposal.md
- openspec/changes/archive/2026-06-06-cdc-lifecycle-e2e-tests/design.md
- nix/k8s-tests/README.md
🚧 Files skipped from review as they are similar to previous changes (4)
- Taskfile.yml
- nix/k8s-tests/src/k8s_tests.py
- nix/k8s-tests/config.nix
- dev-scripts/test-cdc-lifecycle-auto.sh
Add a successor to test-migration-e2e.py that exercises the full CDC lifecycle, driven by restarting ncps with/without the CDC serve flags (drain mode is decided at boot by initCDCDrainMode). Local driver (dev-scripts/test-cdc-lifecycle-e2e.py + the auto wrapper and 'task test:cdc-lifecycle'): brings up the fixed-port nix run .#deps stack and asserts DB + serving invariants at each phase plus the upload-presence and fsck-repair cross-cutting checks. Results land under the already-gitignored .e2e-results/cdc/. K8s topology (nix/k8s-tests): new ha-s3-postgres-cdc-lifecycle permutation gated on a cdc-lifecycle marker feature, with _test_cdc_lifecycle driving the same phases on a Kind cluster (ConfigMap CDC flip + rollout restart, in-pod migrate-chunks-to-nar reusing the pod's --config). Includes the OpenSpec change artifacts (proposal/specs/design/tasks).
Address PR #1348 review (gemini-code-assist, coderabbitai): - e2e driver: use start_new_session=True instead of preexec_fn=os.setsid; fail the cross-cutting phase when 'fsck --repair' exits non-zero. - auto.sh: bootstrap direnv before nix/python (env-execution rule) so it works standalone, not only under 'task'. - k8s tester: guard ConfigMap data before reading config.yaml; raise when the in-pod migrate-chunks-to-nar exec returns non-zero; drive Phase B's drain-mode serve check with a DB-proven chunked narinfo hash instead of an arbitrary test hash. Threads: PRRT_kwDONV6tZs6Hofcm, PRRT_kwDONV6tZs6Hofco, PRRT_kwDONV6tZs6Hofcp, PRRT_kwDONV6tZs6HohVZ, PRRT_kwDONV6tZs6HohVa, PRRT_kwDONV6tZs6HohVb, PRRT_kwDONV6tZs6HohVc Co-Authored-By: Claude Opus 4.8 <[email protected]>
Address PR #1348 re-review (coderabbitai): - e2e driver: fail on non-zero migrate-chunks-to-nar --dry-run exit; assert NAR content identity via sha256 of decompressed bytes (catches same-size corruption) across lazy/drain/restart/fsck rereads; surface cleanup stop_ncps() failures into result instead of swallowing them. - k8s tester: run multi-replica topology checks for every deployment (not only cdc-lifecycle) since _test_cdc_topology self-skips ineligible ones; treat 'NAR absent on all replicas' as a failure (it was served earlier). - specs: point the harness-invocation scenario at the fixed-port 'task test:cdc-lifecycle' entrypoint instead of the random-port 'task test:deps:start'. Threads: PRRT_kwDONV6tZs6HooDa, PRRT_kwDONV6tZs6HooDb, PRRT_kwDONV6tZs6HooDc, PRRT_kwDONV6tZs6HooDe, PRRT_kwDONV6tZs6HooDf, PRRT_kwDONV6tZs6HooDg, PRRT_kwDONV6tZs6HooDi Co-Authored-By: Claude Opus 4.8 <[email protected]>
69fc398 to
d0419e3
Compare
Address PR #1348 re-review (coderabbitai) + code scanning: - poll for the drain-completion log line instead of a single race-prone read - include the lazy upload in the HEAD/GET presence sweep - assert migrate-chunks-to-nar --dry-run actually reports drain candidates - k8s tester: let port-forward/request transport errors propagate so the TestResult shows the real infra error, not a false 'did not serve'/'phantom' - redact the S3 secret-access-key before logging the CLI command (CodeQL clear-text logging) - docstring: state the non-destructive-purge invariant is unit-tested, not exercised here (real packages never share a NAR) Co-Authored-By: Claude Opus 4.8 <[email protected]>
Summary
Adds end-to-end test infrastructure for the full CDC lifecycle (successor to
test-migration-e2e.py):dev-scripts/test-cdc-lifecycle-e2e.py+task test:cdc-lifecycle(auto-wrapper brings up the fixed-portnix run .#depsstack). Drives non-CDC -> CDC (eager+lazy) -> drain -> non-CDC by restarting ncps, asserting DB + serving invariants per phase plus cross-cutting checks (upload presence; fsck no-data-loss).ha-s3-postgres-cdc-lifecycle(nix/k8s-tests) gated on acdc-lifecyclemarker, with a_test_cdc_lifecyclephase script (ConfigMap CDC flip + rollout restart; in-podmigrate-chunks-to-nar).This driver caught the CDC serving bug fixed below it in the stack (#1346); after that fix the full lifecycle passes end-to-end. Depends on the image fix (#stacked) for in-cluster pod start.
Test plan
task fmt/lint/testgreen; k8s permutation generates/lists/installscdc-lifecycle-e2e-testsarchived before merge (6.2/6.3 + in-cluster run pending)