Skip to content

test(apps): declare permissions.cron in the cron timeout manifest fixture - #19307

Closed
chenmingwei23 wants to merge 1 commit into
mainfrom
fix/app-cron-manifest-permission-fixture
Closed

chenmingwei23 wants to merge 1 commit into
mainfrom
fix/app-cron-manifest-permission-fixture

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: make main green again, so every open pull request stops failing a backend shard for a reason that has nothing to do with its own diff.

Three cases in test/test_app_cron_timeout_manifest.py fail on an unmodified main:

TestDeclaredTimeoutsReachTheJob::test_app_json_pair_registers_with_exact_values
TestDeclaredTimeoutsReachTheJob::test_absent_fields_keep_the_scheduler_default
TestInvalidValuesAreRefusedLikeTheSdk::test_a_valid_pair_passes_both

assert _manifest(_script_cron(timeout=60, timeout_secs=65)).validate() == []
E  Left contains one more item:
   'crons is declared but permissions.cron is not: add "cron": true under "permissions" in app.json'

Two changes landed eight minutes apart and the second was written against the shape the first had just retired. b5cc2f3534 (#19231) made permissions.cron required whenever a manifest declares crons, and fixed every fixture that existed at that moment. c469d966dd (#19191) then added this file, whose _manifest helper builds a manifest with crons and no such grant. So every assertion in those three cases reads the permission refusal instead of the timeout rule it was written to check.

Why it matters

The failure is in backend shard 1, which every pull request runs, so a red main reads as a red PR. It cost real time tonight: a documentation-only pull request that changes two Markdown files carried this same failure and looked like its own fault until the test was run against a clean main in a detached worktree.

It also hides what the file is for. These three cases exist to pin that a declared timeout and timeout_secs reach the registered job. While the manifest is refused for an unrelated reason, they assert nothing about timeouts at all, so the rule they protect is currently unguarded.

Not a goal

What changed (motivation -> approach -> change)

The rule is right and the fixture is stale, so the fixture is what moves.

_manifest now declares "permissions": {"cron": True} alongside the crons entry it already carried, which makes it the "otherwise valid manifest that schedules this cron" its callers assume. A docstring says why that grant is part of being valid here, so the next reader does not take it for incidental boilerplate and drop it.

Every other case in the file was checked for the same shape; the cases that build a manifest through other helpers already satisfy the rule, so _manifest is the only one that needed the grant.

Tests

Run with a scratch KIROCREW_HOME, because the suite refuses to run against the live data home:

$ KIROCREW_HOME=<scratch> .venv/bin/python -m pytest test/test_app_cron_timeout_manifest.py -q -p no:randomly -n 2
before:  3 failed, 25 passed
after:  28 passed

Neighbouring app-manifest tests, to show the grant did not disturb anything that reads the same manifest shape:

$ KIROCREW_HOME=<scratch> .venv/bin/python -m pytest <app manifest neighbours> -q -n 2
492 passed, 2 skipped

Gates, run with the repository's own venv binaries:

$ .venv/bin/black --check test/test_app_cron_timeout_manifest.py   # exit 0
$ .venv/bin/isort --check test/test_app_cron_timeout_manifest.py   # exit 0
$ .venv/bin/flake8 test/test_app_cron_timeout_manifest.py          # exit 0
$ comment-history gate                                             # passed

Manual verification: reproduced the failure first on a detached worktree at unmodified origin/main before touching anything, so the fix is measured against a known-red baseline rather than against a working tree.

Backwards compatibility

Nothing to break. The diff is one test file. No wire contract, route, tool, field, default or public function is added, renamed, or removed, and no manifest a user wrote is affected: the grant is added to a fixture, not to a validation path. A manifest in the wild that declares crons without permissions.cron is refused exactly as #19231 decided it should be.

Related Issues

Fixes the main breakage introduced between #19231 and #19191. Unblocks backend shard 1 on every open pull request, including #19287 and #19292, which both carry this failure.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality (this restores three existing cases to actually testing their subject; no new case is needed)
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

…ture

The timeout tests build a manifest whose crons is non-empty, and
AppManifest.validate refuses that manifest unless permissions declares the
cron grant, so the three assertions that read validate() as empty read the
missing-grant refusal instead. The fixture declares the grant, which is what
an app shipping these crons must declare to install.
@chenmingwei23
chenmingwei23 requested review from a team and KiroCrewCaptain as code owners October 12, 2026 06:46
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 11a13c7512c4cd08b6f54779ca3511f8f507e068 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision 11a13c7512c4cd08b6f54779ca3511f8f507e068 ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Advisory — does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 11a13c7512c4cd08b6f54779ca3511f8f507e068 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] 11a13c7

Description read

[DESCRIPTION-READ] 95991a2e3b35469c7844cf38decc0c242647ee71d1547cc13bf566fb75d9a44a

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 11a13c7512c4cd08b6f54779ca3511f8f507e068 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 11a13c7

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 11a13c7512c4cd08b6f54779ca3511f8f507e068: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 11a13c7512c4cd08b6f54779ca3511f8f507e068 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 11a13c7

Verdict parsed from the review's SHA-scoped output markers for commit 11a13c7512c4cd08b6f54779ca3511f8f507e068.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 11a13c7512c4cd08b6f54779ca3511f8f507e068: <one-sentence reason>

@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 12, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Closing as superseded: #19280 landed the identical fix at 06:52:47Z, adding the same "permissions": {"cron": True} line to the same _manifest helper. main (395106a) now runs this file at 28 passed. The only remaining difference here was docstring wording, which is not worth a PR of its own. We arrived at the same diff independently, from the same reading of #19231 and #19191.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 12, 2026
@bolichen97
bolichen97 deleted the fix/app-cron-manifest-permission-fixture branch November 6, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant