Skip to content

fix(storage): survive unreadable artifact files and pin utf-8 i/o#296

Merged
plind-junior merged 1 commit into
testfrom
fix/resilient-listing-and-utf8-io
Jun 30, 2026
Merged

fix(storage): survive unreadable artifact files and pin utf-8 i/o#296
plind-junior merged 1 commit into
testfrom
fix/resilient-listing-and-utf8-io

Conversation

@plind-junior

Copy link
Copy Markdown
Collaborator

What changed

makes bulk artifact listing resilient to a single unreadable file, and pins
encoding="utf-8" on every text-mode file i/o under src/vouch/.

Why

vouch pending — and every bulk list_* path — crashed with a yaml
ReaderError when one proposal file held a control character: a single bad
file took down the whole listing. root cause: vouch's read_text /
write_text / open relied on the locale default encoding, so on a non-utf-8
locale (e.g. latin-1) non-ascii claim text was mangled into raw bytes the yaml
loader rejects — and writes could crash outright. the fix has two layers:
skip-and-warn on an unreadable file (defense in depth) plus pin utf-8
everywhere (the actual root cause).

What might break

nothing for existing .vouch/ users on a utf-8 system. on a non-utf-8 locale,
new writes are now correct utf-8; a file already corrupted by the old
locale-encoded write path is now skipped with a warning instead of crashing the
command (re-save it as utf-8 to recover it).

VEP

not a surface change — no VEP needed.

Tests

  • ruff + mypy clean; pytest green except the pre-existing
    test_example_screenshots svg-render check (unrelated, font-metric
    environmental — fails on main/test too)
  • new regression tests: a corrupt proposal/claim file is skipped and the
    listing still returns the good artifacts
  • CHANGELOG.md updated under ## [Unreleased]### Fixed

`vouch pending` — and every bulk `list_*` path — crashed with a yaml
ReaderError when a single proposal file held a control character: one
unreadable file took down the whole listing. add a `_load_or_skip` helper
that logs a warning and skips the bad file instead of aborting, applied
across proposals, claims, entities, relations, evidence, sessions, sources.

the control character traces back to vouch's own file i/o relying on the
locale default encoding: on a non-utf-8 locale (e.g. latin-1) read_text /
write_text / open mangle non-ascii into raw bytes the yaml loader rejects,
and can even crash on write. pin encoding="utf-8" on all text-mode pathlib
i/o under src/vouch.

adds regression tests for the resilient listing.
@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance cli command line interface auto-pr auto-pr orchestration review-ui browser review ui openclaw openclaw integration mcp mcp, jsonl, and http surfaces storage kb storage, migrations, schemas, and proposals retrieval context, search, synthesis, and evaluation embeddings embedding-backed retrieval sync sync, vault mirror, and diff flows tests tests and fixtures size: S 50-199 changed non-doc lines labels Jun 30, 2026
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e49493cb-659d-4ec5-8e11-181241df5e6a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/resilient-listing-and-utf8-io

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.

❤️ Share

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

@plind-junior plind-junior merged commit 660bb59 into test Jun 30, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-pr auto-pr orchestration cli command line interface docs documentation, specs, examples, and repo guidance embeddings embedding-backed retrieval mcp mcp, jsonl, and http surfaces openclaw openclaw integration retrieval context, search, synthesis, and evaluation review-ui browser review ui size: S 50-199 changed non-doc lines storage kb storage, migrations, schemas, and proposals sync sync, vault mirror, and diff flows tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant