Skip to content

fixup: include failed-to-parse str in error message#179

Merged
cole-h merged 2 commits intomainfrom
show-failed-to-parse-str
Mar 23, 2026
Merged

fixup: include failed-to-parse str in error message#179
cole-h merged 2 commits intomainfrom
show-failed-to-parse-str

Conversation

@cole-h
Copy link
Copy Markdown
Member

@cole-h cole-h commented Mar 23, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved error diagnostics: when an incoming event fails to parse, error logs now include the raw event payload as structured data (for easier troubleshooting). Operational behavior is unchanged — processing continues to the next event after logging.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 001ab3af-2d29-47eb-9ecd-6aae131bf56e

📥 Commits

Reviewing files that changed from the base of the PR and between 78e82d7 and 1d01e9b.

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • magic-nix-cache/src/pbh.rs
✅ Files skipped from review due to trivial changes (1)
  • magic-nix-cache/src/pbh.rs

📝 Walkthrough

Walkthrough

Error-handling log in the built-path event parser now appends the raw event_str payload to the error message when deserialization into BuiltPathResponseEventV1 fails; control flow remains unchanged (the loop continues).

Changes

Cohort / File(s) Summary
Error Logging Enhancement
magic-nix-cache/src/pbh.rs
Modified error log to include the raw event_str payload on deserialization failure for built-path events (one-line change).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 I nibbled logs beneath the starlit byte,

When parsing stumbled in the quiet night;
The raw string now hops into the view,
A carrot clue to help the debug crew.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: improving error logging by including the failed-to-parse string in the error message when JSON deserialization fails.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch show-failed-to-parse-str

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

@cole-h cole-h force-pushed the show-failed-to-parse-str branch from 0cd6072 to 41cad79 Compare March 23, 2026 17:23
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@magic-nix-cache/src/pbh.rs`:
- Line 99: The error log attempts to format event_str (a &[u8]) with "{}",
causing a type mismatch; change the tracing::error call to convert the byte
slice to a displayable string—e.g. use String::from_utf8_lossy(event_str) or
std::str::from_utf8_lossy(event_str)—so the message like "failed to decode
built-path response as BuiltPathResponseEventV1: {}" receives a proper &str;
update the tracing::error invocation accordingly where event_str is used.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 93881be1-2aab-4061-8e74-fd1c4e225bed

📥 Commits

Reviewing files that changed from the base of the PR and between 356fa10 and 0cd6072.

📒 Files selected for processing (1)
  • magic-nix-cache/src/pbh.rs

Comment thread magic-nix-cache/src/pbh.rs Outdated
@cole-h cole-h force-pushed the show-failed-to-parse-str branch from 41cad79 to aea6de4 Compare March 23, 2026 17:30
Comment thread magic-nix-cache/src/pbh.rs Outdated
@cole-h cole-h force-pushed the show-failed-to-parse-str branch from 78e82d7 to 1d01e9b Compare March 23, 2026 17:43
@cole-h cole-h enabled auto-merge March 23, 2026 17:50
@cole-h cole-h merged commit add1db7 into main Mar 23, 2026
10 checks passed
@cole-h cole-h deleted the show-failed-to-parse-str branch March 23, 2026 18:04
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.

2 participants