Repository navigation
Reject non-array events and targets files with a one-line error - #88
Merged
Merged
Conversation
events-ingest and plan-recipe --targets looped directly over the parsed JSON, so a number or string crashed with a TypeError traceback and an object was iterated by its keys into a misleading validation failure. Both now require a JSON array and exit 1 with one line, before any database is created. Closes Juneo-Lab#71
EonHao
approved these changes
Nov 22, 2026
EonHao
left a comment
Contributor
There was a problem hiding this comment.
Thanks, @kratos0718. Approving.
What I checked:
- Both call sites now read through
read_json_arrayinsidecli_errors, so a number, string, or object exits 1 with oneError:line instead of a traceback or a misleading validation failure. events-ingestrejects the file beforeingest_eventsruns, so a bad input no longer leaves an emptyevents.sqlitebehind.- The six new cases fail on
mainand pass here. The full suite, Ruff, mypy, andmkdocs build --strictpass locally with this branch merged together with #86 and #87.
This was referenced Nov 22, 2026
Merged
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.
Closes #71
Behavior
events-ingestandplan-recipe --mode explicit --targetslooped directly overread_json(...). A number or string crashed withTypeError: '...' object is not iterableand a traceback, and an object was iterated by its keys, ending in "specification validation failed".Both now read the file through a small
read_json_arrayhelper next tocli_errors, the same checkevaluate-decisionsdoes for its bindings, and exit 1 with one line:plan-recipereportsError: Targets file must be a JSON array. The file is checked beforeingest_eventsruns, so no database is created.Validation
test_commands_reject_non_array_json_inputscovers both commands with number, string and object input (6 cases): exit code 1, exactly oneError:line,SystemExitrather than a traceback, and noevents.sqlite. All 6 fail without the change.pytest: 334 passed, 24 skipped.ruff check,ruff format --checkandmypy srcpass.mkdocs build --strictbecause mkdocs isn't in the default environment; no docs page changed.Compatibility and data
No schema, API or data changes. Valid array inputs behave as before.
Checklist
ruff check,ruff format --check,mypy src,pytest --cov-fail-under=80, andmkdocs build --strictpass. (all butmkdocs, see above)CHANGELOG.mdis updated for user-visible changes; docs are updated for changed commands or contracts.