fix: read governance debug log tail in binary mode#7295
Conversation
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
feature_governance_cl.py was opening debug.log in text mode but seeking with a binary offset. The fully safe fix is to read the tail in binary mode, seek using a binary offset, then decode the resulting bytes afterward for the string match. This preserves the existing 100 KiB tail scan while avoiding invalid mixed-mode seek behavior in Python text I/O. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
45d3b21 to
0293c6d
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe governance test's log-verification helper now opens the debug log in binary mode, seeks to the last 100 KiB, reads raw bytes, decodes them with UTF-8 using replacement for invalid sequences, and then searches the decoded string for the existing Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 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. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsTimed out fetching pipeline failures after 30000ms 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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
|
✅ Review complete (commit 0293c6d) |
thepastaclaw
left a comment
There was a problem hiding this comment.
Code Review
I re-checked the diff directly and did not find a correctness issue to block this PR. The patch fixes the original mixed-mode seek bug by computing the tail offset and performing the seek in the same stream mode that is later read, and the helper rename to debug_log_size() makes the adjacent test-framework call sites explicit about that contract.
Reviewed commit: 0293c6d
Summary
feature_governance_cl.pylog tail polling to seekdebug.login binary mode
for the stream mode
the expected governance tip message
Context
This is a follow-up for a valid review finding from merged PR #7258:
#7258 (comment)
Upstream
developcurrently opensdebug.login text mode but computesthe seek position with a binary offset. The final fix here uses a fully
binary tail read and decodes afterward, which avoids both mixed-mode seek
problems and text-stream offset arithmetic.
Validation
python3 -m py_compile test/functional/feature_governance_cl.pyshipI did not run
feature_governance_cl.pyend-to-end because this worktreedoes not have built
dashd/test binaries available, and building DashCore would be disproportionate for this narrowly scoped Python
functional-test fix.