Skip to content

engine: storage_err renders the whole error chain, not just the caption - #8

Merged
Morgandri1 merged 1 commit into
mainfrom
sdk/storage-err-preserves-cause
Sep 9, 2026
Merged

engine: storage_err renders the whole error chain, not just the caption#8
Morgandri1 merged 1 commit into
mainfrom
sdk/storage-err-preserves-cause

Conversation

@Morgandri1

Copy link
Copy Markdown
Owner

Summary

PM hit this live on the wheel-dev board: wheel write reports/x answered {"code":"invalid","message":"writing t_reports/x"} with no indication of the real cause. Every function in tables.rs wraps its sqlite call in .with_context(|| "verb noun") — "writing t_reports/x", "reading t_reports/x", etc — and storage_err (the single chokepoint for ls/read/write/rm/query on table nodes) rendered the error with e.to_string(), which for anyhow::Error prints only the outermost .with_context() layer. The cause sat one level down and never reached the caller.

  • storage_err: format!("{e:#}") instead of e.to_string() — walks the whole anyhow chain.
  • ApiError: added #[derive(Debug)] (harmless; needed so a test can inspect the rendered message without going through IntoResponse).
  • Added the_message_names_the_cause_the_context_was_wrapping, proving both the caption and the cause survive.

Root cause of the table itself sometimes going missing is a separate, already-tracked issue (ADVERSARY 034 / QA BUG-022 — journal-mode write-proofing); this PR only fixes that the error message swallowed the diagnosis once it happened.

Test plan

  • cargo test -p wheel-engine — 268 passed
  • cargo clippy -p wheel-engine --all-targets -- -D warnings — clean
  • cargo fmt -p wheel-engine -- --check — clean

@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

Deployment failed for project wheel with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/morgandri1s-projects?upgradeToPro=build-rate-limit

@Morgandri1
Morgandri1 force-pushed the sdk/storage-err-preserves-cause branch from 2824156 to ca6fb91 Compare September 6, 2026 17:48
Every tables.rs function wraps its sqlite call in .with_context(|| "verb
noun") -- "writing t_reports/x", "reading t_reports/x" -- so the real
cause sits one level down. storage_err rendered it with e.to_string(),
which for anyhow::Error prints only the outermost context, so the
caption reached the caller and the cause ("no such table: t_reports")
never did. PM hit exactly this live on the reports table.

format!("{e:#}") walks the whole chain instead. Added ApiError: Debug
(harmless, and the test needs a way to inspect the rendered message
without reaching through IntoResponse) and a unit test proving both the
caption and the cause survive.
@Morgandri1
Morgandri1 force-pushed the sdk/storage-err-preserves-cause branch from ca6fb91 to decb67a Compare September 9, 2026 19:55
@Morgandri1
Morgandri1 merged commit 93ea407 into main Sep 9, 2026
8 checks passed
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