Repository navigation
fix(s10): tolerate stray or corrupted task files in TaskStore.list - #662
Open
shuhuNB515 wants to merge 1 commit into
Open
shuhuNB515 wants to merge 1 commit into
shuhuNB515 wants to merge 1 commit into
Conversation
TaskStore.list loaded every glob match unconditionally, so one unexpected file in .tasks/ broke everything downstream: - a hand-created task_notes.json -> ValueError: Invalid task ID from every list_tasks call; - one truncated task_*.json -> json.JSONDecodeError raised from complete_task's ready_before scan *before* the status flip, leaving the board stuck: no task could ever be completed again. Skip unparseable files with a warning instead, mirroring the policy s12 already applies to saved cron jobs (s12_cron_scheduler/code.py:415-417). Both failure modes were reproduced against the chapter module before and after the change. The embedded s10 source in the web registry is synced. Fixes shareAI-lab#635
This branch has not been deployed
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.
Fixes #635
Problem
TaskStore.list(s10_task_system/code.py:194-199) loads every glob match unconditionally:One unexpected file in
.tasks/poisons everything downstream. Both modes reproduced against the chapter module before this change:task_notes.json→ValueError: Invalid task ID: 'task_notes'from everylist_taskscall.task_dead….json→json.JSONDecodeErrorraised insidecomplete_task'sready_beforescan before the status flip — the target task stayedin_progressand no task on the board could be completed afterwards.This is not hypothetical: the "Try It" section invites users to inspect
.tasks/, and a Ctrl-C mid-write can leave a partial file behind.Fix
Per-file
try/exceptwith a skip + warning, mirroring the policy s12 already applies to saved cron jobs (s12_cron_scheduler/code.py:415-417):(
json.JSONDecodeErrorsubclassesValueError.) A few lines, same shape as the existing s12 precedent — no new machinery.Verification
Ran the real chapter module in a temp workspace, before/after:
task_notes.json+ truncatedtask_….jsonpresent →list()returns only the valid tasks with a[task] skipped invalid saved task: …warning each;claim_task+complete_taskcomplete successfully despite the corrupt sibling (previously impossible);python3 -m pytest tests/— 503 passed, 118 subtests passed.web/src/data/generated/versions.jsonsynced.Disclosed AI assistance: found and fixed during an AI-assisted review; both failure modes reproduced and re-verified after the fix, and I stand behind the change.