Skip to content

fix(depot): add ltx decode diagnostics#4953

Merged
NathanFlurry merged 1 commit intomainfrom
depot-ltx/decode-diagnostics
May 5, 2026
Merged

fix(depot): add ltx decode diagnostics#4953
NathanFlurry merged 1 commit intomainfrom
depot-ltx/decode-diagnostics

Conversation

@NathanFlurry
Copy link
Copy Markdown
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Copy Markdown
Member Author

NathanFlurry commented May 4, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 4, 2026

Code Review: fix(depot): add ltx decode diagnostics

Overview

This PR improves error diagnostics when LTX blob decoding fails by including the source key (hot path only), blob length, and hex dumps of the first/last 64 bytes in the error context. It is a small, focused diagnostic improvement with no behavior changes.


Code Quality

  • Adding context inside .with_context(|| ...) closures is correct. The closure is lazy and only evaluated on failure, so the hex formatting cost is zero on the happy path.
  • Using saturating_sub for tail_start correctly avoids underflow on short blobs.
  • The crate::compaction::shared::hex_lower full-path references work, but per the project convention, imports should be added at the top of the file rather than referenced inline inside functions.

Potential Issues

Head/tail overlap on short blobs: When len <= 64, both head_n == len and tail_start == 0, so the head and tail hex strings will be identical: the entire blob printed twice. This is redundant noise in the error message. Consider collapsing to a single blob= field when the blob is short enough to fit in one window, or only emitting the tail when tail_start > head_n.

Asymmetric diagnostics: The hot-path (read.rs) includes source_key in the error context explicitly. The cold-path (read/cold.rs) already embeds object_key directly in the format string prefix. This appears intentional rather than an oversight.


Minor Style

  • The PR description checklist is entirely unchecked. A brief note on what scenario triggered this change would be useful context for reviewers and future history.

Assessment

The change is correct and valuable for debugging LTX decode failures in production. The only substantive concern is the duplicated head/tail hex output for blobs shorter than 64 bytes. Everything else is a minor style note. Good to merge once the overlap case is handled or explicitly accepted as-is.

@NathanFlurry NathanFlurry marked this pull request as ready for review May 5, 2026 11:25
Base automatically changed from udb-versionstamp/plain-set-byte-preserving to main May 5, 2026 14:58
@NathanFlurry NathanFlurry merged commit bed338f into main May 5, 2026
19 of 23 checks passed
@NathanFlurry NathanFlurry deleted the depot-ltx/decode-diagnostics branch May 5, 2026 14:58
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