Skip to content

refactor(toplevel): unchain the auto-tier path ternary in ui_index - #18785

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
refactor/simplify-toplevel
Oct 10, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
refactor/simplify-toplevel

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Make ui_index.load_index say plainly which auto-tier file it reads, without changing which file it reads.

src/kiro_crew/ui_index.py picks the auto-tier file inside load_index with a nested conditional expression: auto_path if auto_path is not None else (AUTO_INDEX_PATH if path is None else None). To see that the packaged auto tier is the default only when the caller named neither file, a reader has to unpack which else belongs to which if.

Why it matters

That default is a rule the docstring states and test_the_default_auto_file_is_the_dashboard_bundles pins: an explicit committed index (a test, a scratch build) is read with the auto tier the caller names, or none. As a nested ternary it is easy to misread as "AUTO_INDEX_PATH whenever auto_path is None", which is the one reading that would mix the packaged auto tier into a scratch index.

Not a goal

  • Changing which files load_index reads, how it caches them, or how the auto tier is validated.
  • Touching any other file (one module per PR; this is the toplevel sweep).

What changed (motivation → approach → change)

load_index picks its auto-tier file exactly as before, now written as a plain default instead of a nested ternary: start from the caller's auto_path, and use AUTO_INDEX_PATH only when both auto_path and path are None. That reads in the same order as the docstring. Run over every combination of None, an ordinary path, Path("") and Path(".") for both arguments, the old and new forms return the identical object in all 16 cases. mypy infers Path | None from the parameter, so no annotation is added.

This is the module-simplification detector's one actionable site in toplevel; the other four it lists are excluded (three in the keystone safety_override.py, one test-pinned in skills.py) and are left alone.

Before opening, eight read-only review subagents checked the diff from separate angles: AUTOSDE rules, behaviour preservation, import semantics, security keystone and boot path, comment and claim accuracy, local mirrors of the Codex and Claude review contracts, and the deterministic code-review.yml / PR Hygiene checks. The behaviour lens applied the claimed rewrite to origin/main's syntax tree and got HEAD's tree exactly. None of the eight found a code defect. The claim lens raised four wording findings against the commit message and this description; independent refuters upheld two, both fixed (the commit message implied a file is read in every case, when one case reads none; the test-file list counted two substring-only matches as references), and refuted two, left as written.

Backwards compatibility

Compatible: the same arguments select the same auto tier file as before, or none where they selected none, so the cache key and every find_ui / browse_ui answer are unchanged.

Removes nothing: one expression is restated; no path, key, reader or public name goes away.

Tests

No test change. The 24 test files that git grep -l -e ui_index -e find_ui -e load_index -- test selects pass on the Python 3.12 CI-parity venv: 1685 passed, 12 skipped. Two of them, test_cli_manifest_signature.py and test_spec_builder_routes_coverage.py, match only as a substring (upload_indexes, spec_builder's own _load_index) and add margin, not coverage. Among the rest, test_the_default_auto_file_is_the_dashboard_bundles covers both the default branch and the explicit-path branch, and test_find_ui_auto.py's two-file cases cover an explicit auto_path.

Gates run locally on the rebased head, all exit 0: flake8, isort --check-only, mypy src/kiro_crew, check_black_formatting.py, check_subprocess_encoding.py, check_sync_io_in_async.py, check_agent_sdk_boundary.py, check_comment_history.py, check_brand_name.py, check_harness_parity.py, docs_lint.py --test, docs-lint.sh, check_per_file_coverage.py --test and verify_vendor_manifest.py. scripts/scrub-lint.sh does not exist on main and semgrep is not installed on this host, so neither ran here; CI's SAST job runs semgrep. Backend-only diff: nothing under website/, .github/ or scripts/ changes, so CI reports only_backend=true and the frontend suites are not affected.

Manual verification

N/A — unit coverage sufficient: every branch of the rewritten default is exercised by test_find_ui_auto.py, and the change is one local expression with no I/O of its own.

Screenshots / video

Why no screenshot: backend-only restatement of one Python expression; nothing renders differently.

Related Issues

Part of #16523

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

Contributed under the project's Apache-2.0 license.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 10, 2026 08:07
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 72212ad2e7a233ab0159f05175cbabf588348624 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 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] 72212ad

Description read

[DESCRIPTION-READ] f78861f98210d4f6893fbc6396afa4f0a8645b3f9f4d9c005ea582c302c19dea

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 10, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 72212ad2e7a233ab0159f05175cbabf588348624 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 72212ad

Verdict parsed from the review's SHA-scoped output markers for commit 72212ad2e7a233ab0159f05175cbabf588348624.

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

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 72212ad2e7a233ab0159f05175cbabf588348624 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 72212ad

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

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 72212ad2e7a233ab0159f05175cbabf588348624 — 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

Nothing to check.

What this change ships

Inventory (1 items) — 1 justified

Intent: let a reader of load_index see at once that the packaged auto tier is the default only when the caller names neither file. This is a FIX (readability refactor), not an ADDITION.

  1. load_index's auto-tier choice is now a plain default with an if, not a nested ternary. It picks the same file in every case. — justified

[FIRST-PRINCIPLES-REVIEWED] 72212ad

Description read

[DESCRIPTION-READ] 9f2ee264b664bf6d337370c9d7dfe2745b1b2aaceef22fee3b89372a78d88792

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.

@bolichen97

Copy link
Copy Markdown
Contributor Author

The red checks on fbf3e59b0e come from main, not from this diff, and all share one cause: the committed src/kiro_crew/docs/ui-index.generated.json is stale on main.

  • Build Wheel, Build Desktop (ubuntu-22.04), Build Desktop (ubuntu-22.04-arm) and E2E (stub ACP backend, offline) fail in the frontend build with gen-ui-index: src/kiro_crew/docs/ui-index.generated.json is stale. Run npm run gen:ui in website/ and commit the result.
  • Frontend Tests (1) fails src/uiLocations/uiIndex.test.ts > the committed index > projects every Settings control, joined by its stable id.
  • Coverage Gate fails closed on frontend-test=failure.

main's own Build push runs on 81e25da3d1 and on d3f462f23b (this PR's base) fail with the same stale-index line. This PR changes only src/kiro_crew/ui_index.py: no generated JSON and nothing under website/.

The stale index is tracked in #18749, and #18753 fixes it. Once that lands I'll rebase onto it, re-run the gates and push. I won't rerun or override this red in the meantime.

@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 10, 2026
load_index chose which auto tier file to read with a nested
conditional expression. Write it as a plain default instead: the
caller's auto_path, or AUTO_INDEX_PATH when neither auto_path nor path
was given. Every combination of arguments still picks the same auto
tier file as before, or no file where it picked none.
@bolichen97
bolichen97 force-pushed the refactor/simplify-toplevel branch from fbf3e59 to 72212ad Compare October 10, 2026 09:46
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto d32c084921. That commit (#18782) regenerates src/kiro_crew/docs/ui-index.generated.json, and main's CI push run on it passed. That clears the stale-index red described above. This PR's diff is the same one hunk in src/kiro_crew/ui_index.py. The gates and the 24 related test files pass again on the new head (72212ad2e7), and CI is re-running.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 10, 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.

Approved. One local expression restated; the new default picks the same auto-tier file as before in every case. All AI reviews pass on 72212ad, and no change request is open.

@KiroCrewCaptain
KiroCrewCaptain merged commit 07cf97c into main Oct 10, 2026
102 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the refactor/simplify-toplevel branch October 10, 2026 16:51
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 10, 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