richardcase / richardcase/clowder
Do not overwrite corrupt daemon state during mutation
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 0
- Forks
- 0
- Avg merge
- 1h 14m
- Merged PRs (30d)
- 16
Description
Problem
JsonStore.load converts parse/read failures into an empty vector even when called by mutation paths. The next mutation can overwrite a corrupt state file and orphan previously recorded agents, projects, or profiles.
Evidence: https://github.com/richardcase/clowder/blob/b5492d5/crates/clowder-daemon/src/store.rs#L30-L63
Acceptance criteria
- Keep display/recovery reads tolerant.
- Refuse mutations when an existing state file is unreadable or invalid.
- Preserve the original bytes and surface a clear error.
- Add corruption and mutation regression tests.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in crates/clowder-daemon/src/store.rs at lines 30–63 and trace how JsonStore.load is used by display/recovery versus mutation paths. Add corruption and mutation regression tests that verify unreadable state blocks mutation, preserves the original bytes, and returns a clear error while tolerant reads still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100