Repository navigation
refactor: move the effort-levels route out of agents.py under the line cap - #32123
Conversation
…e cap agents.py reached 2,002 lines on main, over the 2,000-line cap, so the line-cap ratchet fails every PR. GET /api/effort-levels moves whole into handlers/agents_effort_levels.py, a plain module outside the owner composition; agents.py binds the same object, so routes, the handlers package and callers keep their import path. No behavior change.
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the route moves whole, and both old import paths still point to the same function. No test or caller patches [DESIGN-REVIEWED] 5ed5d14 Description read[DESCRIPTION-READ] a7f07943f2281b167b3b758b78d75689abda04e6a49a6014c8f903f02f7218dd 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 Nothing blocks: this split is required by the AGENTS.md 2,000-line cap. It moves one route unchanged, keeps its import paths, and adds no new behaviour or settings. What this change shipsInventory (4 items) — 4 justifiedIntent: get the line-cap check passing again on every PR into main, by moving one route out of
[FIRST-PRINCIPLES-REVIEWED] 5ed5d14 Description read[DESCRIPTION-READ] 31418dfdf5917df856735c29f6a4b5899f97ac28c812cff2a2af4028a7e90c85 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: |
bolichen97
left a comment
There was a problem hiding this comment.
Approving 5ed5d14. The change moves api_effort_levels out of agents.py into the new agents_effort_levels.py, so agents.py drops under the line cap. I read the diff: the function body and docstring are the same on both sides, the facade imports the moved name (# noqa: F401, as its neighbours do) so agents.api_effort_levels is the same object, and the composition contract test now lists the sibling module and checks that binding. The feature map and the system spec paragraph are updated to name the new module.
No regex and no new restriction. Of the two checks that showed red, PR Hygiene failed at 05:27 and passed in a later run at 05:29, and the GPT 6.1 review was cancelled as an older duplicate and passed in its later run; the other 104 pass.
…e cap (#32123) agents.py reached 2,002 lines on main, over the 2,000-line cap, so the line-cap ratchet fails every PR. GET /api/effort-levels moves whole into handlers/agents_effort_levels.py, a plain module outside the owner composition; agents.py binds the same object, so routes, the handlers package and callers keep their import path. No behavior change. (cherry picked from commit a3fb5af)
Problem / Motivation
Goal: Bring
src/kiro_crew/dashboard/handlers/agents.pyback under the 2,000-line cap, so the line-cap ratchet stops failing every pull request into main.agents.pyis 2,002 lines on main since #31569 added two lines.scripts/check_file_line_cap.pyfails on every PR, so Backend Ratchets & Boundaries and Frontend Ratchets & i18n are red on PRs that never touch the file.Why it matters
Every PR into main shows two red required lanes it did not cause, and the 0.12.1 backport of #31569 (#32112) carries the same two lines to
release/0.12.0. This split lets both pass the cap.Not a goal
GET /api/effort-levelsor any other route.agents.py; only enough to get back under the cap..github/file-line-cap-baseline.txt.What changed (motivation → approach → change)
agents.pyis over the cap → AGENTS.md says to move whole definitions into a sibling module and keep the path callers import →GET /api/effort-levels(api_effort_levels) moves unchanged intohandlers/agents_effort_levels.py. That is a plain module outside the owner composition, likeagents_cc_model_rowsandagents_harness_effort.agents.pybinds the same object, so the route table, the handlers package and every import keep working.agents.pygoes from 2,002 to 1,979 lines.This route is the same on main and on
release/0.12.0, so the commit cherry-picks cleanly there.test/test_dashboard_agents_composition_contract.pyrecords the move._SIBLING_DEFSnames the plain-module definition, so "the base file's 120 definitions, each in one place" and "31 served handlers" still hold. A new test checks that the facade and the handlers package bind the sibling's own object. The owner spec (learn-cron-dashboard.md) anddocs/feature-map/README.mdname the new module.Backwards compatibility
Compatible:
kiro_crew.dashboard.handlers.agents.api_effort_levelsandkiro_crew.dashboard.handlers.api_effort_levelsare still bound, to the same function, and the route still serves the same body.Reader: src/kiro_crew/dashboard/routes/agents.py:register -- chat -- GET /api/effort-levels registers handlers.api_effort_levels, the same object; test_the_routes_and_the_package_reach_the_facade_objects
Reader: src/kiro_crew/dashboard/handlers/init.py:api_effort_levels -- chat -- the package re-export is the sibling's object; test_a_sibling_definition_is_the_facade_binding
Reader: test/test_acp_dynamic_config.py:api_effort_levels -- chat -- imports it from handlers.agents, still bound there; test_api_effort_levels_per_slot
Reader: src/kiro_crew/dashboard/handlers/agents.py:api_effort_levels -- release -- the move cherry-picks cleanly onto release/0.12.0 (git merge-tree, no conflict); the function is byte-identical on both branches
Tests
test_a_sibling_definition_is_the_facade_binding: the facade and the handlers package bind the sibling module's ownapi_effort_levels. A mutation that binds a copy inagents.pyinstead turns it red, and alsotest_every_base_definition_is_in_exactly_one_place.test_dashboard_agents_composition_contract.py,test_agents_endpoints_owner_auth.py,test_agent_import_hoist.py,test_remote_crew_capabilities.py,test_acp_dynamic_config.py,test_chat_handlers_composition_contract.py,test_chat_persistence_composition_contract.py,test_facade_mirror_guards.py,test_config_api.py: 679 passed.scripts/check_file_line_cap.py: 0 failures. isort, black, flake8, mypy, docs-lint, feature-map, comment-history, brand, harness-parity and flake-pattern ratchet pass.Manual verification
N/A — a move with no behavior change; the contract tests pin the binding and the route walk.
Related Issues
Closes #32122
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement