Skip to content

fix: skip archive directories in tasks.py recursive walk#37

Merged
benslockedin merged 1 commit intomainfrom
fix/tasks-archive-skip
Apr 10, 2026
Merged

fix: skip archive directories in tasks.py recursive walk#37
benslockedin merged 1 commit intomainfrom
fix/tasks-archive-skip

Conversation

@benslockedin
Copy link
Copy Markdown
Contributor

Summary

tasks.py walks recursively to find tasks.json files but doesn't skip archive/reference directories. Legacy files in these paths with incompatible schemas cause _read_json() to sys.exit(1), killing the entire save operation.

Changes

  • _all_task_files() — added _archive, _references, 01_Archive, raw to skip_dirs
  • _read_json() — added strict=False mode that returns None + prints a warning instead of exiting. Default remains strict=True for direct operations (add, done, edit)
  • _collect_all_tasks() + _find_task() — use strict=False and skip None results gracefully

Test plan

  • Run tasks.py list on a walnut with legacy tasks.json in archive paths — should list tasks, print warning for skipped files
  • Run tasks.py add on same walnut — should succeed
  • Run tasks.py done targeting a task in _kernel/tasks.json — strict mode still exits on malformed kernel file
  • Run tasks.py add on a walnut with no archive cruft — works exactly as before

Splits the minimal crash fix from #28. The v2→v3 migration subsystem remains in #28 for separate review.

Reviewed by: Patrick Brosnan (@patrickSupernormal) — original bug analysis in merge safety audit (fn-8-vly).

tasks.py walks recursively to find tasks.json files but hits legacy
files in archive/reference paths with incompatible schemas, killing
the save operation via sys.exit(1).

- Added _archive, _references, 01_Archive, raw to skip_dirs
- Added strict=False mode to _read_json() — returns None with
  warning instead of hard exit for bulk operations
- list/summary/find operations now gracefully skip malformed files
- Direct operations (add, done, edit) still hard-fail on bad data
@benslockedin benslockedin merged commit 2e3d77e into main Apr 10, 2026
1 check 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