Skip to content

refactor(dashboard): split cron.py handlers into cron_* owner modules - #21672

Merged
bolichen97 merged 1 commit into
mainfrom
refactor/linecap-s22-cron
Oct 19, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
refactor/linecap-s22-cron

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: src/kiro_crew/dashboard/handlers/cron.py drops from 4,101 lines to a 263-line facade, with every cron, cron-folder and lesson route behaving exactly as before.

The cron, cron-folder and lesson routes all lived in one 4,101-line module. That is over the repository's 2,000-line cap, and with 13 commits in the last seven days it is one of the hottest files a feature PR lands in.

Why it matters

A file over the cap blocks the line-cap guard from going strict, and a 4,000-line handler module is where review and merge conflicts concentrate. Splitting it by responsibility gives each route family an owner that new work can go to.

Not a goal

  • Changing what any route does, answers or audits.
  • Fixing the read-decide-write gap in the secret-grant handlers (tracked separately).
  • Splitting prompts.py; that is its own PR, cut in parallel.

What changed (motivation → approach → change)

The module is cut along its route families. cron.py stays the import and patch path for callers, the handlers package and tests, but becomes a kiro_crew._facade_mirror facade with no code of its own: a read of cron.<name> is served by the owner that binds it, and a write (monkeypatch.setattr, mock.patch) reaches every owner holding the name, as it reached the one module before.

Owner (dashboard/handlers/) Holds
cron_shared.py the busy, unreadable, invalid-id and audit-unavailable answers, the redacted grant map, which app is calling and the foreign-app refusal, _sel
cron_caller_session.py _recognize_session and the headless-mode refusal
cron_lesson_supersede.py the contradiction sweep that retires superseded lessons
cron_lessons.py POST/DELETE/GET /api/lessons and the lesson-store selection
cron_jobs.py job create, update, enable, delete and batch delete, the body cap, one-shot at, the job tab's chat folder, POST /api/crons/tools
cron_script_source.py GET /api/crons/{id}/script
cron_secret_grants.py PUT /api/crons/{job_id}/secrets and its one promotion path
cron_runs.py run, cancel, ack, to-chat and the run history
cron_board.py GET /api/crons and the cron-folder routes

Every unit moves byte for byte. At BASE one guard_owner_surface_routes call wrapped every route except the four member-scoped ones; now each owner makes that call over its own routes, so the same 19 routes stay owner surfaces. Path-keyed pins, baselines, citations and the owning spec follow the moved code.

Backwards compatibility

Compatible: every name cron.py bound at BASE still resolves on it to the same object (test/campaign_facade_inventories/kiro_crew.dashboard.handlers.cron.json), and every patch through it still reaches every reader (test/test_cron_handler_facade.py).

Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_tools -- cron -- registered from the handlers package, which re-exports the facade's served route (test_cron_handler_facade.py::test_every_route_keeps_the_guard_it_had)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_crons_create -- cron -- same re-export, still wrapped as an owner surface (test_cron_handler_facade.py::test_every_route_keeps_the_guard_it_had)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_delete -- cron -- same re-export (test_dashboard_cron_delete_handler.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_batch_delete -- cron -- same re-export (test_dashboard_cron_batch_delete_handler.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_update -- cron -- same re-export (test_cron_update_member_recapture.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_secret_grant -- cron -- same re-export (test_cron_secret_env.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_run -- cron -- same re-export (test_dashboard_cron_run_guard.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_cancel -- cron -- same re-export (test_cron_cancel.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_to_chat -- cron -- same re-export (test_dashboard_cron_to_chat_handler.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_enable -- cron -- same re-export (test_cron_handler_json_contract.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_ack -- cron -- same re-export (test_cron_handler_json_contract.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_history -- cron -- same re-export (test_dashboard_cron_path_id.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_history_detail -- cron -- same re-export (test_dashboard_cron_path_id.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_script_source -- cron -- same re-export (test_dashboard_cron_script_source.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_history_all -- cron -- same re-export (test_r16_cron_app_read_ownership.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_lessons_create -- cron -- same re-export, still unwrapped as a member-scoped route (test_lesson_write_outcome.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_lessons_delete -- cron -- same re-export, member-scoped (test_lessons_list_repo_scope.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_lessons -- cron -- same re-export, member-scoped (test_lessons_list_window.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_crons -- cron -- same re-export (test_cron_timezone_display.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_folders -- cron -- same re-export (test_dashboard_cron_folders.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_folders_create -- cron -- same re-export (test_dashboard_cron_folders.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_folders_update -- cron -- same re-export (test_dashboard_cron_folders.py)
Reader: src/kiro_crew/dashboard/server_runtime/mcp_routes.py:api_cron_folders_delete -- cron -- same re-export (test_dashboard_cron_folders.py)
Reader: src/kiro_crew/dashboard/handlers/memory.py:_recognize_session -- crew page -- from .cron import _recognize_session resolves through the facade to the owner's object (test_headless_memory_recognition.py)

Tests

  • test/test_cron_handler_facade.py (new). Every name the test trees patch through the facade reaches every module holding it, and the undo restores them. The owners are exactly the cron_*.py siblings, in layer order. The facade forwards no legacy table and defines no code. Every route keeps the guard it had: 19 wrapped once, the four member-scoped routes unwrapped. Every name served from outside the family stays visible to type checkers. One logger, named for the facade. _ChatFolderGone keeps the facade module. python -m kiro_crew.dashboard.handlers.cron still imports.
  • test/campaign_facade_inventories/kiro_crew.dashboard.handlers.cron.json (new, L52): 93 BASE public names, 69 re-bound by import; check_inventory.py reports no missing name.
  • Re-pointed pins (path or row only, assertions unchanged, each with a mutation proof that goes red when the construct is altered at its new home): test_json_object_body_guard.py (10 rows), test_persistence_writer_inventory.py, test_sqlite_compat_resolver.py, test_transcript_derivation_seam.py, test_dashboard_source_link_unlink_hydration.py (the _KNOWN_HYDRATION_SITES row, which test: split four 3,000-line test files by topic under the line cap #21245 moved there from test_dashboard_source_link_unlink.py). test_cron_create_config_off_loop.py now scans the facade joined with every owner (its universal half). test_cron_store_unreadable_boundaries.py carries its file-name exclusion to cron_secret_grants.py.
  • Local run (SD14: local-gate selects 1,926 backend + 838 frontend related files, over the ~600 floor, so the floor ran instead): 210 related and guard test files at -n 3, 14,854 passed, 19 skipped, 0 failed. Three files (test_dev_fleet_server_coverage.py, test_sensitive_change_review.py, test_file_line_cap.py) need a git checkout and were run in the worktree: 485 passed. mypy src/kiro_crew: no issues in 2,690 files. A wheel smoke imports every new module from an installed wheel. Per-file coverage of the new modules from that run: cron_shared 100%, cron_caller_session 100%, cron_lesson_supersede 100%, cron_script_source 100%, cron_lessons 97.1%, cron_board 95.0%, cron_runs 94.4%, cron_jobs 90.6%, cron_secret_grants 82.0%. After the rebase onto main 2c9c873f2f: 214 files at -n 3, 13,976 passed, 19 skipped, 1 failed. The failure is a 120 s timeout in test_session_allocation_bindings.py's whole-tree corpus scan, the known environment flake test_session_allocation_bindings facade-patch tree scan takes ~60s and times out at 120s on CI #21441, which is load-sensitive on this host: it takes 128 s on unmodified main and 139 s here, and passes on both with the timeout raised. After the refresh, gated on main 8335fa0164 (which carries that test's fix, test: read only the facade's own files in the session allocation patch scan #21640) and pushed on 462c24f32f with an identical -U0 patch, the 19 cron and pin test files pass: 1,121 passed, 0 failed, the session-allocation scan included. Per-file coverage of the owners: cron_shared, cron_caller_session, cron_lesson_supersede, cron_script_source 100%, cron_lessons 97.1%, cron_board 95.0%, cron_runs 94.4%, cron_jobs 90.6%, cron_secret_grants 82.0%.

Manual verification

N/A — a pure move. The route, patch-reach and guard behaviour is pinned by the unit tests above, and the related test files pass unchanged.

Related Issues

Part of #20192
Follow-up: #21358 (the two secret-grant handlers read, decide and write without the store probe; the file-name exclusion keeps BASE coverage until that lands)
Follow-up: #21320 (comment citations in files other scopes own, listed below)

Rows and baselines

  • .github/file-line-cap-baseline.txt: the dashboard/handlers/cron.py row is deleted, since the file ends under 2,000 lines (L45). No other row changes.
  • .github/docs-lint-baseline.txt: the line-ref triple for rfc-resumable-subagent-sessions.md dashboard/handlers/cron.py:141 is deleted. That citation now names the symbol (cron_lesson_supersede.py, _classify_contradiction).
  • error-code-baseline.json: the dashboard/handlers/cron.py bucket (missing_code 28, dynamic_status 5) is redistributed to cron_jobs.py 17/4, cron_runs.py 6/1 and cron_lessons.py 5 (test/test_error_code_contract.py --update). Totals 1046/18/38 are unchanged, and _compliant keeps main's value.

Move audit

move_audit.py --origin src/kiro_crew/dashboard/handlers/cron.py: 4131 -> 264 lines; moved 99.84% (python-ast); 71 of 72 units moved unchanged. _surface_lesson_saved and its call in api_lessons_create (#21872, which landed after this split was cut) move with the lesson routes into cron_lessons.py, byte for byte.

  • changed: the trailing guard_owner_surface_routes(...) call (6 lines). It is glue: each owner makes the call over its own routes.
  • The logger = logging.getLogger(__name__) binding becomes logging.getLogger("kiro_crew.dashboard.handlers.cron") in each owner (L25): one logger, the original name.
  • Comment-only edits (AST unchanged): two positional comments now name the owner they point to (cron_runs: the list GET, api_crons; cron_board: the helpers in cron_shared), and the moved section header in cron_jobs.py reads Cron jobs.
  • Glue: _ChatFolderGone.__module__ = "kiro_crew.dashboard.handlers.cron" (class __module__ rule).

Diff layout (L36)

cron.py is pure glue (no kept code). Default diff adds 237 lines, --minimal 235. The two re-shown lines are the blank lines of the facade's import header. L41 exception accepted by the Master for pure-glue facades. A layout search over 10 variants found no equal layout.

Baselined growth (L56 addendum 1b)

src/kiro_crew/security_posture.py: baseline row 3,181, main 3,409 lines, HEAD 3,415 (+6). NON_EGRESS_REDACTION_MODULES replaces the dashboard/handlers/cron.py row with the seven owners whose text carries the redactor calls (cron_board, cron_jobs, cron_lessons, cron_runs, cron_script_source, cron_secret_grants, cron_shared): exact-path rows the drift guard requires, no comment. The row stays as main has it.

Prose citations (L29)

Path-only corrections of comments, docstrings and docs that name where a moved definition lives:

  • src/kiro_crew/apps/routes.py:1547 comment: dashboard/handlers/cron.py -> cron_shared.py (the unreadable-store answer)
  • src/kiro_crew/dashboard/handlers/autonudge.py:1296 docstring: handlers/cron.py -> handlers/cron_shared.py (the 503 it mirrors)
  • src/kiro_crew/dashboard/handlers/core.py:4057 docstring: cron.py -> cron_shared.py (_invalid_path_id_response)
  • src/kiro_crew/dashboard/handlers/computer_use.py:155 docstring: cron.py -> cron_shared.py (the late-bound _sel() sibling list; refactor(dashboard): split prompts.py handlers into prompts_* owners #21549 re-pointed the prompts.py entry on the next line, refactor(dashboard): split handlers/sessions.py into sessions_parts #21532 the sessions.py one)
  • src/kiro_crew/dashboard/handlers/sessions_parts/history_reads.py:99-100 comment: handlers/cron.py -> handlers/cron_caller_session.py (the live-and-shared session prefixes; refactor(dashboard): split handlers/sessions.py into sessions_parts #21532 moved this comment out of sessions.py, and the bullet is rewrapped within its three lines)
  • src/kiro_crew/dashboard/handlers/_shared.py:3633 docstring: handlers/cron.py -> handlers/cron_lessons.py (api_lessons_create)
  • src/kiro_crew/mcp_tools/learn.py:332 and src/kiro_crew/taskrunner_parts/run_reporting.py:152 comments: dashboard/handlers/cron.py -> cron_lessons.py (api_lessons_create)
  • test/test_app_routes.py:262, :291: handlers/cron.py -> handlers/cron_shared.py
  • test/test_mcp_cron_thread_ts.py:287 docstring: dashboard/handlers/cron.py -> cron_jobs.py
  • test/test_ephemeral_sessions.py:473-474 and test/test_ephemeral_sessions_recognition.py:963 comments (test: split four session, knowledge and monitor test files by topic #21893 split the file): handlers/cron.py / cron.py's -> handlers/cron_lessons.py / cron_lessons.py's (the route reads cron_lessons' own _get_memory binding; the facade mirror carries the test's handlers.cron._get_memory patch to it)
  • test/test_dashboard_cron_to_chat_handler.py:1 docstring: (handlers/cron.py L169-L205) -> (handlers/cron_runs.py, api_cron_to_chat)
  • docs/request-for-change/rfc-resumable-subagent-sessions.md:146 (dashboard/handlers/cron.py:141 -> cron_lesson_supersede.py (_classify_contradiction); its line-ref baseline row is deleted) and docs/system-specs/modules/session.md:723 (-> cron_lesson_supersede.py)

References not edited (cost / owner)

  • src/kiro_crew/mcp_cron.py:2679, :3387 (dashboard/handlers/cron.py → cron_jobs.py) and :3076 (→ cron_board.py): S19's split target (refactor: split llm_helpers.py and mcp_cron.py into owner modules #21598, not merged yet); S19 re-points them when it lands second.
  • website/src/test/AutoNudgePopover.test.tsx:337 (prose handlers/cron.py): L50.
  • Module-name prose that still resolves through the facade is kept (handlers/cron._SCRIPT_SOURCE_MAX_BYTES in cron_script.py, dashboard.handlers.cron._lesson_jsonl_store in security/init.py).

CI path references

None: no workflow names dashboard/handlers/cron.py; AUTOSDE.yaml's dashboard/handlers/** globs already cover the owners.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@bolichen97

bolichen97 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 9aefb4f
  • What rule changed: none; security_posture.NON_EGRESS_REDACTION_MODULES re-keys its dashboard/handlers/cron.py row to the seven owners the cron handlers moved into, verbatim (cron_board, cron_jobs, cron_lessons, cron_runs, cron_script_source, cron_secret_grants, cron_shared).
  • Before -> after (what was allowed/blocked, now): the same redactor calls are classified the same way (non-egress, behind the dashboard handler sinks); only the module path that holds them changed, so the posture panel names the file the calls now live in.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a missing row would fail test_security_posture's drift guard in CI, never change runtime behaviour; the redaction code itself is byte-identical to BASE.
  • Evidence checked (which sandbox result proves it): test/test_security_posture.py passes on this head; the rows equal exactly the owners whose text matches its _REDACTOR_CALL_RE, and the cron.py facade matches nothing so its row is removed.
  • No regression:
    • Tools still work (which tools/commands were run, result): the cron, cron-folder and lesson route tests (210 related files, 14,854 passed) exercise every redacting route through the facade.
    • Backward compatible (old config / old data / old callers still work, how checked): every BASE name still resolves on the cron facade to the same object (campaign facade inventory test) and every patch through it reaches every owner (test_cron_handler_facade.py).
    • Existing tests (which suites passed on this head): test_security_posture.py, test_cron_handler_facade.py, test_facade_mirror_guards.py and the related cron and lesson suites.
  • How to undo: revert this commit; the rows return to the single dashboard/handlers/cron.py entry with the code.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 17, 2026 18:43
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security_posture.py

  • @bolichen97 posted a complete reasoning template for 9aefb4f.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 9aefb4fb3edcbe4e5ecd7b7744faa9d537f2ae0c 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 github-actions Bot added the readiness: checking Automated validation is still running label Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] 9aefb4f

Description read

[DESCRIPTION-READ] 2855316426d15f30dd4d332b99770a8bbdcb2a727e9bbabd590360265ebbfdf6

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

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 9aefb4fb3edcbe4e5ecd7b7744faa9d537f2ae0c — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Before merge, check that per-owner guard_owner_surface_routes wraps exactly the 19 routes the single BASE call wrapped, as test_every_route_keeps_the_guard_it_had claims.

What this change ships

Inventory (6 items) — 6 justified

Intent: a maintainer wants handlers/cron.py back under the 2,000-line cap with no change to route behaviour. This is a REFACTOR (neither FIX nor ADDITION).

  1. The cron, lesson and cron-folder routes now live in nine cron_* owner modules, and cron.py is a _facade_mirror facade. This is the existing pattern, used in 116 src files and 89 inventories. — justified
  2. Each owner applies the owner-surface guard to its own routes, where one call used to cover all of them. The same 19 are wrapped and the 4 member-scoped routes stay unwrapped. — justified
  3. cron.py is removed from the file-line-cap baseline, which the AGENTS.md cap rule requires. — justified
  4. The baseline rows for error codes, NON_EGRESS_REDACTION_MODULES, docs-lint and other path-keyed pins now point at the new owner files. — justified
  5. The comments and spec citations in session.md, learn-cron-dashboard.md, the feature map and the RFC's citation line now point at the new owners. — justified
  6. New test_cron_handler_facade.py and a facade inventory JSON pin that every name cron.py exported still resolves and every patch through it still reaches each owner. — justified

[FIRST-PRINCIPLES-REVIEWED] 9aefb4f

Description read

[DESCRIPTION-READ] 5a9fb1a4f087b603e83ec0e9e172e445887a2318a0a44607fc4ae19ed0c0bda2

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 9aefb4fb3edcbe4e5ecd7b7744faa9d537f2ae0c — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 9aefb4f

Verdict parsed from the review's SHA-scoped output markers for commit 9aefb4fb3edcbe4e5ecd7b7744faa9d537f2ae0c.

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

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 9aefb4fb3edcbe4e5ecd7b7744faa9d537f2ae0c and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 9aefb4f

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

@bolichen97
bolichen97 enabled auto-merge (squash) October 17, 2026 19:05
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 17, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Punchline: the seven cron_* NON_EGRESS rows leave out only owners with no redactor calls

rebutted: checked, and the condition holds. The security_posture.py list names exactly the seven owners whose text calls a redactor: cron_board (22 call sites), cron_runs (7), cron_lessons (6), cron_script_source (4), cron_jobs (3), cron_secret_grants (3), cron_shared (3).
The two owners it leaves out, cron_caller_session.py (session recognition and the headless refusal) and cron_lesson_supersede.py (the contradiction sweep), contain no redactor call, and neither does the cron.py facade.
test/test_security_posture.py's drift guard requires an exact-path row for every module that carries a redactor call and none for others, and it passes at this head.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main 462c24f for the refresh (MAIN_RED #4 fix #21640, MAIN_RED #5 fix #21792). The -U0 patch (hunk headers aside) and the line-cap rows are identical to 86857c4's. This head supersedes 86857c4. CI re-running.

@bolichen97
bolichen97 force-pushed the refactor/linecap-s22-cron branch from 86857c4 to b46d18c Compare October 18, 2026 09:32
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 18, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Punchline: the per-owner guard_owner_surface_routes calls still give the same 19 owner-surface routes

rebutted: checked, and the condition holds at this head. An AST count over BASE cron.py and the nine cron_* owners finds the same 23 api_* coroutines, and the same four member-scoped names (api_cron_tools in cron_jobs, the three lesson routes in cron_lessons), so the same 19 routes are wrapped.
server_runtime/mcp_routes.py registers exactly those 23 routes as handlers.<name>, and the handlers package re-exports the owners' wrapped objects, so the routing table serves the same 19 guarded routes.
test/test_cron_handler_facade.py::test_every_route_keeps_the_guard_it_had pins the per-route guard against BASE.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Punchline: the cron_secret_grants.py skip in the read-decide-write scan

rebutted: checked, the skip keeps exactly the coverage BASE had, as designed. At BASE the scan's path.name == "cron.py" test matched dashboard/handlers/cron.py as well as the service kiro_crew/cron.py, so the two grant handlers were never scanned.
After the split those two handlers sit in cron_secret_grants.py, and the skip names that file. The other eight cron_* owners are now scanned for the first time, and they pass.
The gap itself (two grant handlers that read, decide and write without the store probe) is reported and tracked as #21358, which the PR body lists under Related Issues. Its fix probes the handlers and drops this skip; a behaviour change is out of this refactor's goal.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Oct 18, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-s22-cron branch from b46d18c to ab5aa7b Compare October 18, 2026 13:41
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main 330812e for the refresh (L16 port of #21872: _surface_lesson_saved and its call move with the lesson routes into cron_lessons.py; cron.py now goes 4,131 -> 264 lines). The patch differs from b46d18c's; the READY range-diff lists the change. This head supersedes b46d18c. CI re-running.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 18, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Punchline: per-owner guard_owner_surface_routes still wraps the same 19 routes and leaves the 4 member-scoped ones unwrapped

rebutted: checked, and it holds at this head. An AST count over BASE cron.py and the nine cron_* owners finds the same 23 api_* coroutines with the same member-scoped set, so 19 are wrapped at both. The member-scoped set is api_cron_tools (cron_jobs) plus api_lessons, api_lessons_create and api_lessons_delete (cron_lessons).
test/test_cron_handler_facade.py::test_every_route_keeps_the_guard_it_had pins the per-route guard against BASE and passes at this head.
The #21872 port adds _surface_lesson_saved, a private helper and not a route, so the guarded set is unchanged.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main 310ad48 for the refresh (L16 port across #21893, which split test_ephemeral_sessions.py: the two comment re-points move to test_ephemeral_sessions.py:473-474 and test_ephemeral_sessions_recognition.py:963, byte for byte). The patch differs from c28f344's; the READY range-diff lists the change. This head supersedes c28f344. CI re-running.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 18, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Punchline: cron_caller_session.py and cron_lesson_supersede.py stay off NON_EGRESS_REDACTION_MODULES, and the other seven owners are on it

rebutted: checked, and that is deliberate. The list must name exactly the modules whose text calls a redactor, and test/test_security_posture.py's drift guard fails both on a missing row and on an extra one.
Redactor call sites per owner at this head: cron_board 22, cron_runs 7, cron_lessons 6, cron_script_source 4, cron_jobs 3, cron_secret_grants 3, cron_shared 3, which are the seven listed rows. cron_caller_session 0, cron_lesson_supersede 0, and the cron.py facade 0.
The two owners left off hold session recognition and the headless refusal, and the lesson contradiction sweep. Neither redacts anything, so a row for either would be an extra row the guard rejects.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Punchline: test_every_route_keeps_the_guard_it_had really counts 19 owner-surface routes and 4 member-scoped routes at BASE

rebutted: checked, it does. The test's frozen _ROUTES equals the 23 api_* coroutines BASE cron.py defines, and _MEMBER_SCOPED equals the member_scoped set of BASE's single guard_owner_surface_routes call (api_cron_tools, api_lessons, api_lessons_create, api_lessons_delete). Both were compared by AST against BASE 325bc3f.
At HEAD it asserts that the wrapped set is exactly _ROUTES - _MEMBER_SCOPED (19 routes), that no route is wrapped twice, and that the handlers package serves the same objects. It passes in this head's CI.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 18, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every review lane on the head is clean (only runner notices and PR Scope / Opus size warnings); held by the triage cron on size or path rules alone. Approved on the watch holder's request.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 19, 2026
dashboard/handlers/cron.py held every cron, cron-folder and lesson route
in 4,101 lines, over the 2,000-line cap. Each top-level unit moves
verbatim into one of nine sibling owners (cron_shared,
cron_caller_session, cron_lesson_supersede, cron_lessons, cron_jobs,
cron_script_source, cron_secret_grants, cron_runs, cron_board).
cron.py stays the import and patch path as a kiro_crew._facade_mirror
facade with no code of its own, so a patch of cron.<name> reaches
every owner that binds the name.

Each owner that defines routes runs guard_owner_surface_routes over its
own routes, with its share of the four member-scoped routes, so the same
19 routes stay owner surfaces. Every owner logs under the facade's
logger name, and _ChatFolderGone keeps the facade module.

Path-keyed pins, rows, citations and the owning spec follow the moved
code. The store-unreadable ratchet keeps excluding the grant handlers
by file name, as BASE did.

Part of #20192
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main b4efd2d for the refresh (L46 rows refresh after #21528: .github/docs-lint-baseline.txt row union). The -U0 patch (hunk headers aside) and the line-cap rows are identical to 72818cc's. This head supersedes 72818cc. CI re-running.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 19, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Punchline: per-owner guard_owner_surface_routes wraps exactly the 19 routes the single BASE call wrapped

rebutted: checked, it holds at this head. An AST count of BASE cron.py gives 23 api_* routes, with member_scoped = api_cron_tools, api_lessons, api_lessons_create, api_lessons_delete, so 19 are wrapped. The nine owners together give the same 23 and the same four.
The test's frozen _ROUTES and _MEMBER_SCOPED equal those BASE sets. At HEAD it asserts that the wrapped set is exactly the 19, that none is wrapped twice, and that the handlers package serves the same objects. It passes here and in this head's CI.
A runtime walk of __wrapped__ over the 23 routes handlers/__init__.py imports gives 19 at depth 1 and the four at depth 0. This refresh changed only a docs-lint baseline row, so no cron code moved since the heads where this was checked.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 19, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every review lane on the head is clean (only runner notices and PR Scope size warnings); held by the triage cron on size, path or checklist rules alone. Approved on the watch holder's request.

@bolichen97
bolichen97 merged commit 574cb18 into main Oct 19, 2026
107 of 108 checks passed
@bolichen97
bolichen97 deleted the refactor/linecap-s22-cron branch October 19, 2026 02:50
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 19, 2026
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.

2 participants