fix: narrow OperationalError catch in delete_student to table-not-found only - #86
Open
clates wants to merge 4 commits into
Open
fix: narrow OperationalError catch in delete_student to table-not-found only#86clates wants to merge 4 commits into
clates wants to merge 4 commits into
Conversation
… fp precision, cascade deletes - Add null guards for progress_blob/plan_rules_blob in logic.py, main.py, agent.py (issues #77, #78, #79) — new students with NULL blobs no longer crash - Fix generate_weekly_plan to use datetime.now(UTC) instead of local time (issue #80) — prevents off-by-one day in week_of on non-UTC servers - Fix _get_grade_level to fall back to student metadata instead of literal 0 (issue #81) — first-time plan generation no longer fails with no-standards error - Round activity_bias in process/reverse_quantity_feedback to 6 decimal places (issue #82) — prevents floating-point drift across feedback cycles - Replace delete-then-insert with INSERT OR REPLACE in save_weekly_packet (issue #83) — eliminates duplicate-packet race condition under concurrent saves - Cascade-delete weekly_packets before deleting student profile in delete_student (issue #84) — packet_feedback no longer left as orphans after student deletion Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Adds two rules to prevent direct commits to main: - All changes must go through a PR, no exceptions - Automated analysis/fix workflows must create a branch before making changes, then open a PR rather than committing directly Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…l test - delete_student() now catches OperationalError when weekly_packets table doesn't exist (minimal test DBs only have student_profiles) - Update test_get_grade_level_defaults_to_zero to expect 1 (the new safe default) and add a second test covering the metadata_fallback path Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…nd only The broad `except sqlite3.OperationalError: pass` in delete_student silently swallowed disk-full, database-locked, and data corruption errors alongside the intended "no such table: weekly_packets" case. Narrow the handler to only suppress errors whose message contains "no such table", re-raising everything else so real failures surface immediately. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
except sqlite3.OperationalError: passindelete_studentwas introduced in PR#85 to handle the case whereweekly_packetsdoesn't exist in minimal test DBs.sqlite3.OperationalErroris a wide exception class that also covers disk-full errors, database-locked errors, corrupted database pages, and future typos in table names — all of which were silently swallowed withpass."no such table" in str(e)and re-raises any otherOperationalError, so real failures surface immediately rather than being hidden.Test plan
weekly_packets) still succeeds without errorOperationalError(e.g. "database is locked") is now propagated rather than suppressedpytest tests/ -k "delete" -vonce a Python 3.11+ environment is available🤖 Generated with Claude Code