Skip to content

fix(tests): repair whale-pass daemon-cli tests broken by #3455 - #3489

Merged
Sinity merged 1 commit into
masterfrom
fix/tests/whale-pass-daemon-cli
Jul 31, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/tests/whale-pass-daemon-cli

Conversation

@Sinity

@Sinity Sinity commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

Repairs test_maybe_run_raw_materialization_whale_pass_{runs_scoped_pass_and_emits_events,no_candidate_skips_writer} in tests/unit/daemon/test_daemon_cli.py, which fail on master both in isolation and file-scope with:

TypeError: <lambda>() got an unexpected keyword argument '_bootstrap'

raised from polylogue/config.py:2173 (resolve_archive_root -> load_polylogue_config(_bootstrap=bootstrap)).

Problem

#3455 ("refactor(config): delete two inert config keys and the whale off-switch") touched polylogue/config.py and this exact test file in the same commit, and the failing tests are named after that PR's whale-pass feature.

Which side was wrong, and why

Production is correct; the tests are the stale side. Diagnosis:

  • _maybe_run_raw_materialization_whale_pass (polylogue/daemon/cli.py:1265) calls archive_root() (from polylogue.paths) first.
  • Both tests' autouse _clear_polylogue_env fixture (tests/conftest.py:447) removes POLYLOGUE_ARCHIVE_ROOT, so archive_root()'s env fast path is empty and it falls through to config.resolve_archive_root(), which calls load_polylogue_config(_bootstrap=bootstrap).
  • Both tests monkeypatch polylogue.config.load_polylogue_config with a zero-argument lambda (originally added only to satisfy _resolve_raw_materialization_whale_blob_limit_bytes's separate zero-arg load_polylogue_config().raw_authority_whale_payload_bytes call) — it was never updated to accept the _bootstrap keyword the archive_root() fallback path actually needs.
  • Widening the lambda's signature to **kwargs would still fail: resolve_archive_root reads settings.archive_root off the return value, and a bare SimpleNamespace(raw_authority_whale_payload_bytes=None) has no such attribute.

Fix: patch polylogue.paths.archive_root / polylogue.paths.render_root directly — the exact seam ~20 other tests in this same file already use to sidestep this identical env-fallback path. This keeps load_polylogue_config's existing zero-arg patch scoped to the one call site it's actually meant for (_resolve_raw_materialization_whale_blob_limit_bytes).

This also resolves polylogue-010x: patching load_polylogue_config alone made these tests pass only when some other test's POLYLOGUE_ARCHIVE_ROOT override happened to leak into this test's environment (order-dependent). Patching archive_root() directly makes the archive root deterministic regardless of run order.

Solution

  • tests/unit/daemon/test_daemon_cli.py: both whale-pass tests now take a tmp_path fixture and monkeypatch.setattr("polylogue.paths.archive_root", ...) / render_root before invoking _maybe_run_raw_materialization_whale_pass.
  • No production code changed — archive_root()'s env-fallback behavior is correct as designed (per its own docstring, polylogue-4ma3).

Anti-vacuity

The production dependency exercised is the real archive_root() -> resolve_archive_root() -> load_polylogue_config(_bootstrap=...) fallback chain in polylogue/config.py and polylogue/paths/_roots.py; reverting this diff (restoring the zero-arg lambda) reproduces the original TypeError deterministically, both in isolation and file-scope.

Verification

python -m devtools test tests/unit/daemon/test_daemon_cli.py -k whale_pass   # 4 passed (isolation)
python -m devtools test tests/unit/daemon/test_daemon_cli.py                 # 113 passed (full file)
python -m devtools verify --quick                                            # exit 0

Ref polylogue-jsxj, polylogue-010x

Problem: test_maybe_run_raw_materialization_whale_pass_{runs_scoped_pass_
and_emits_events,no_candidate_skips_writer} fail on master with
TypeError: <lambda>() got an unexpected keyword argument '_bootstrap',
raised from config.py:2173 (resolve_archive_root ->
load_polylogue_config(_bootstrap=bootstrap)).

Diagnosis: production is correct, the tests are stale. Both tests
monkeypatch polylogue.config.load_polylogue_config with a zero-arg
lambda, intending to satisfy _resolve_raw_materialization_whale_blob_
limit_bytes's load_polylogue_config() call. But the autouse
_clear_polylogue_env fixture removes POLYLOGUE_ARCHIVE_ROOT, so
production's real archive_root() (called first, at daemon/cli.py:1265)
falls through its env fast path into resolve_archive_root(), which
calls load_polylogue_config(_bootstrap=bootstrap) -- a call shape the
tests' lambda was never updated to accept after #3455 touched this
same call chain and test file together. Widening the lambda to accept
**kwargs would require faking a full ResolvedSettings-like object with
an .archive_root attribute, so instead this patches archive_root()/
render_root() directly on polylogue.paths -- the seam every other test
in this file already uses for the identical env-fallback problem.

Also fixes polylogue-010x: patching load_polylogue_config alone left
these tests order-dependent (only passing when some other test's
POLYLOGUE_ARCHIVE_ROOT override happened to survive into this test's
env). Patching polylogue.paths.archive_root directly makes the tests
deterministic in isolation and in file-scope runs alike.

Verification:
  devtools test tests/unit/daemon/test_daemon_cli.py -k whale_pass -> 4 passed
  devtools test tests/unit/daemon/test_daemon_cli.py (full file) -> 113 passed

Ref polylogue-jsxj, polylogue-010x

Co-Authored-By: Claude <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1d7d4f8a-8a6a-4c6d-85d3-b391fba6913d

📥 Commits

Reviewing files that changed from the base of the PR and between 90d4df6 and 250e51d.

📒 Files selected for processing (1)
  • tests/unit/daemon/test_daemon_cli.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity
Sinity merged commit 9d81a13 into master Jul 31, 2026
3 checks passed
@Sinity
Sinity deleted the fix/tests/whale-pass-daemon-cli branch July 31, 2026 22:33
Sinity added a commit that referenced this pull request Aug 2, 2026
Problem: polylogue-t93b (daemon must converge whale raw components)
was dispatched for implementation, but the escalation-tier whale pass
was already fully implemented and merged (#3256, #3268, #3455, #3489)
prior to this session, per a same-day RECONCILE note already on the
bead.

What changed: independently re-verified the mechanism from source
(daemon/cli.py _maybe_run_raw_materialization_whale_pass,
storage/repair.py raw_materialization_whale_pass_candidate +
stream-safe gating), ran the relevant tests (test_repair.py -k
whale_pass, test_daemon_cli.py -k whale — 8 passed, covering the
synthetic-fixture convergence AC, the non-stream-safe-fails-safely AC,
and the bounded-commit-batch AC), and checked the live archive
read-only for witness codex:019f49d8's current state. Appended a
confirmation note: mechanism is done, witness has not converged yet
purely because the ordinary trickle conveyor has not reached
quiescence (whale pass only fires when quiescent), not because of a
code gap.

No production code changed. No PR opened — there was nothing to
change.

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant