Repository navigation
test: Assert structured event tokens instead of retired prose - #5107
Conversation
PRs #5072 (5eb2707) and #5073 (ab850e0) converted these modules to structured events. polylogue/logging.py:400 emit() writes to its own sinks and never touches stdlib logging, so caplog.text is empty by construction -- both tests were failing on an assertion that can no longer be true, not on behaviour. Assert the stable tokens and their declared fields instead, per CLAUDE.md ('Do not enforce natural-language wording'): - convergence_stages.py:308 emits daemon.stage.check_failed (probe_failed_assuming_work); the execute path reports through span.degraded, terminal event daemon.stage.execute.degraded. Use polylogue.logging.capture() and pin (stage, outcome, reason, error_type) for both. - lifecycle.py:287 emits daemon.lifecycle.signal_received. The integration test reads the daemon subprocess's own stream, so select the line carrying the token and assert it names SIGTERM, without pinning console or JSON rendering. The faulthandler assertion is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedNext included review available in 7 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
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. Comment |
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. |
Summary
Two tests grepped for prose sentences that the structured-logging wave
deleted. Both now assert the stable event token and its declared fields.
Which merged PR moved the ground
PRs #5072 (
5eb270707, "Convert the remaining daemon modules to structuredevents") and #5073 (
ab850e0b7, "Carry the correlation context into thederivation kernel") retired prose logging in these modules.
polylogue/logging.py:400emit()writes structured records to its ownsinks and never touches stdlib logging, so
caplog.textis empty byconstruction -- these were failing on an assertion that can no longer be true,
not on behaviour.
daemon/convergence_stages.py:308now emitsdaemon.stage.check_failed(
reason="probe_failed_assuming_work"), and the execute path reports throughspan.degraded("materialization_failed"), whose terminal event isdaemon.stage.execute.degraded.daemon/lifecycle.py:287now emitsdaemon.lifecycle.signal_received(
signal_name=SIGTERM).CLAUDE.md is explicit: "Do not enforce natural-language wording".
Solution
test_convergence_stage_reports_probe_and_materialization_failures_as_pending_work:drop
caplog, usepolylogue.logging.capture(), and assert the exact(stage, outcome, reason, error_type)tuple for each of the two events.test_sigterm_read_only_daemon_records_forensicsreads the daemonsubprocess's own stream, which may render console or JSON. It now selects
the line carrying
daemon.lifecycle.signal_receivedand asserts it namesSIGTERM. The"Current thread"faulthandler assertion is unchanged.Both assertions are on tokens and fields, which are the storage form; the
human sentence was always a rendering concern.
Verification
Anti-vacuity
check'sexceptreturn False, or drop theemitdegraded/materialization_failedterminal event disappearsemitfrominstall_signal_handlers(no line carries the token), or dropfaulthandler.dump_traceback(no stack dump)Residuals
Test-only change. The integration test still depends on the daemon's
configured renderer emitting the token in either format; it does not pin which
format, deliberately.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK