Skip to content

fix: define missing exit code and fix list deletion during iteration#106

Merged
k-rister merged 2 commits into
masterfrom
fix-exit-code-and-sanitize
Jun 29, 2026
Merged

fix: define missing exit code and fix list deletion during iteration#106
k-rister merged 2 commits into
masterfrom
fix-exit-code-and-sanitize

Conversation

@k-rister

Copy link
Copy Markdown
Contributor

Summary

Two fixes, one per commit:

  • Define EC_OUTPUT_WRITE_FAIL: Used on the output file write error path but never defined. Caused NameError instead of a clean exit with code 7.

  • Fix sanitize_set list mutation during iteration: del obj[set_idx] inside for set_idx in range(0, len(obj)) skips elements after a deletion and risks IndexError. Replaced with a filter-and-collect pattern that builds a new list.

Closes #104

Test plan

  • All 59 existing tests pass (PYTHONPATH=. pytest tests/ -v)
  • Review that sanitize_set preserves the same filtering and role-defaulting behavior

🤖 Generated with Claude Code

k-rister and others added 2 commits June 27, 2026 10:43
EC_OUTPUT_WRITE_FAIL was used on the output file write error path
but never defined, causing a NameError instead of a clean exit
with a meaningful code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
del obj[set_idx] inside for set_idx in range(0, len(obj)) shrinks
the list while the index advances, causing elements after a
deleted one to be skipped and potential IndexError at the end.

Replace with a filter-and-collect pattern that builds a new list,
avoiding mutation during iteration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@k-rister k-rister self-assigned this Jun 27, 2026
@k-rister k-rister requested a review from a team June 27, 2026 15:45
@project-crucible-tracking project-crucible-tracking Bot moved this to In Progress in Crucible Tracking Jun 27, 2026
@k-rister

Copy link
Copy Markdown
Contributor Author

@rafaelfolco Do these bug fixes seem reasonable to you?

@k-rister k-rister merged commit 87e1431 into master Jun 29, 2026
38 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Crucible Tracking Jun 29, 2026
@k-rister k-rister deleted the fix-exit-code-and-sanitize branch June 29, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix: undefined EC_OUTPUT_WRITE_FAIL and list deletion during forward iteration

2 participants