Skip to content

Report malformed tree entries as object corruption - #670

Open
betacatsling wants to merge 3 commits into
treeverse:mainfrom
betacatsling:fix/malformed-tree-errors
Open

betacatsling wants to merge 3 commits into
treeverse:mainfrom
betacatsling:fix/malformed-tree-errors

Conversation

@betacatsling

@betacatsling betacatsling commented Sep 12, 2026

Copy link
Copy Markdown

Tree.load() classifies JSON decoding failures as corrupt objects but lets malformed list entries escape as KeyError, AttributeError, TypeError or ValueError. Callers such as _try_load() then stop instead of trying another database.

Translate those entry-deserialization errors into ObjectFormatError, preserving the cause. Tests cover malformed entry structures and a real two-database fallback from a corrupt manifest to a valid copy. All five regressions fail on the unchanged base.

Validation on Linux/Python 3.12: 196 tests passed, 32 skipped; Ruff format/lint, project mypy and diff checks passed. No remote storage calls were used. AI assistance was used for implementation and verification.

Prerequisite and revalidation: this branch now includes the shared CLI compatibility fix in #672 (4551489) followed by the original focused patch. This lets a fresh [tests,cli] installation run without external Click. The common change is separately reviewable and will disappear from this PR's diff once #672 is merged.

Revalidated the combined branch on Python 3.12 / Typer 0.27.2 with external Click absent: 202 passed / 32 skipped, mypy passed, and full source/test lint plus formatting passed with the repository-pinned Ruff 0.15.2. The benchmark workflow's base-branch step still needs #672 merged to main; it runs before the PR's code.

Fixes #669.

@github-project-automation github-project-automation Bot moved this to Backlog in DVC Sep 12, 2026
@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.33%. Comparing base (e38c8c2) to head (27a678e).
⚠️ Report is 72 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #670      +/-   ##
==========================================
+ Coverage   72.42%   74.33%   +1.90%     
==========================================
  Files          67       66       -1     
  Lines        5132     5431     +299     
  Branches      605      624      +19     
==========================================
+ Hits         3717     4037     +320     
+ Misses       1227     1198      -29     
- Partials      188      196       +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@betacatsling
betacatsling force-pushed the fix/malformed-tree-errors branch from b2ad403 to 27a678e Compare September 12, 2026 06:57
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.

Malformed directory entries prevent fallback to a valid object database

1 participant