Repository navigation
fix(apps): reject non-string cron execution selectors - #16420
Conversation
A malformed command or script selector was silently erased during manifest parsing, changing the cron into a default-agent job. Record the type violation so validation rejects the manifest while preserving null as the supported absent spelling. Refs #9895
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check whether an app that is already installed with a non-string [DESIGN-REVIEWED] 1baae99 Description read[DESCRIPTION-READ] 56b3d9e6df901959a979e9bbbf23e5e3dec919f9bfa380ae5f5b8d43a4216e64 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS One case to check before merge: a non-string What this change shipsInventory (3 items) — 3 justifiedIntent: an app author whose cron manifest has a mistyped
[FIRST-PRINCIPLES-REVIEWED] 1baae99 Description read[DESCRIPTION-READ] e3918437b3d81fb140a385d20af3991d5f1ba6552e627250a6476dfceb9d9dbf That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Problem / Motivation
Goal: Reject a cron manifest whose
commandorscriptexecution selector is present but not a string, instead of silently discarding it and running the job as a default-agent message.An app manifest cron with a present non-string
commandorscriptselector is currently coerced to an empty string. The manifest then validates, and the scheduler sees neither execution selector, so the job falls through to the default-agent mode and runs itsmessageinstead of rejecting the corrupted input.Why it matters
A malformed non-string cron
commandorscriptis currently accepted and coerced into absence. The scheduler can then silently run the job in default-agent mode instead of rejecting corrupted manifest input, changing execution semantics rather than merely emitting a validation warning.Not a goal
nullstill means "selector absent", not an error.command/scriptmutual-exclusion rule beyond the type check at manifest-validation time.What changed (motivation → approach → change)
command: 7(orscript: 7) parses to an empty selector and runs as a default-agentmessagejob rather than being rejected.CronEntry.from_dictnormalizedcommand/scriptthrough_str_or_empty, which coerces any non-string (including a present7) to"", erasing the type error before validation runs._str_or_flaggedhelper (already used fortimezone), which records a present non-null non-string value as a cron type violation, and addcommand/scriptto_CRON_FIELD_JSON_TYPESso validation emits an actionable expected-type error. The null-means-absent path is preserved.Backwards compatibility
Breaking: a manifest that today supplies a present non-string
commandorscript(e.g. a number or object) is now rejected at validation instead of silently coerced to absent. Writer sweep on origin/main @ a36c1d7: no in-repo manifest or test writes a non-stringcommand/script; all app-bundle manifests undersrc/kiro_crew/apps/**/manifest.*use string or null selectors. A JSONnull(the generator's spelling of "absent") is unaffected.Readers of cron
command/scriptafter validation:src/kiro_crew/apps/manifest.py:CronEntry.from_dict— app install — still works: a string or null selector normalizes exactly as before; only a present non-string now flags.CronEntry.command/.scriptas strings) — cron — still works: it only ever sees validated string/empty selectors, which is unchanged for all currently-accepted input.Tests
test_cron_execution_selector_non_string_is_rejected[command|script]: a present7leaves the selector empty AND produces a wrong-JSON-type validation error (red before the fix: no error was raised).test_cron_null_execution_selector_remains_absent[command|script]: a JSONnullselector raises no error, locking in the null-means-absent convention.test/test_app_manifest.py: 235 passed.Manual verification
N/A — manifest parsing and the admission error are deterministic unit-level contracts covered by the tests above.
Related Issues
Closes #9895.
Pattern harvest
Rule candidate: review-prompt. Pattern: manifest execution selectors that are present and non-null must be type-checked before any normalization that can coerce them into absence (
_str_or_emptyerases the type error; use_str_or_flagged).Checklist
Contribution License Agreement