Skip to content

Conversation

@ivanauth
Copy link
Contributor

Summary

Add a MustSafecast helper function to the spiceerrors package that panics on cast failure, complementing the existing Safecast function.

Fixes #2714

Changes

  • Add MustSafecast[I, O] function in pkg/spiceerrors/safecast.go
  • Panics with descriptive error when cast fails (for use in cases where failure indicates a programming error)
  • Update .gitignore to properly ignore __pycache__/ directories

Adds MustSafecast function following the MustBugf pattern:
- Panics in tests when conversion fails
- Returns zero value in production with warning log
- Replaces manual safecast error handling across codebase

Closes authzed#2714
@ivanauth ivanauth requested a review from a team as a code owner November 25, 2025 22:54
@github-actions github-actions bot added area/schema Affects the Schema Language area/datastore Affects the storage system area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Nov 25, 2025
@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.05%. Comparing base (b55a9f6) to head (3843b3f).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2730      +/-   ##
==========================================
+ Coverage   77.01%   77.05%   +0.05%     
==========================================
  Files         462      464       +2     
  Lines       49121    49181      +60     
==========================================
+ Hits        37825    37892      +67     
+ Misses       8509     8506       -3     
+ Partials     2787     2783       -4     

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ivanauth
Copy link
Contributor Author

The failing CRDB 25.2.0 consistency test doesn't look related to the MustSafecast changes. The error is a database timeout:

ERROR: query execution canceled (SQLSTATE 57014)

CRDB 25.3.0 passes, as do all other datastores. Seems like a CRDB 25.2.0-specific issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/datastore Affects the storage system area/schema Affects the Schema Language area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement MustSafecast function in spiceerrors and use across codebase

1 participant