Skip to content

test(taskq): stop pinning the other task routes and cover child_record's read failures - #34259

Merged
javenciu merged 1 commit into
mainfrom
test/timeline-route-pins
Nov 10, 2026
Merged

javenciu merged 1 commit into
mainfrom
test/timeline-route-pins

Conversation

@javenciu

@javenciu javenciu commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: the task-timeline tests pin what the timeline route owns; the task route table is pinned where the task routes are tested.

Follow-up to #19942, from its review notes. test/test_taskq_timeline.py carried _BASE_GOLDEN, eight captured responses of the five existing task routes, and an exact equality on the task route table. Both pinned routes the timeline does not touch, so an unrelated later change to any of them turns this file red, though the route-table equality is also the only test that fails when a route is added to or dropped from /api/tasks. The failure paths of crew_log.resolve.child_record had no test: the one failure-path test replaces child_record itself, so its strict=True unit listing and its fold-read UnitSearchFailed were never exercised. The file was also 1,708 lines, past the 1,600-line point at which AGENTS.md asks a change to split a code file. And learn-cron-dashboard.md said only the two action routes are owner-gated, which the timeline route made untrue.

Why it matters

A pin on another route's bytes makes the next change to that route fail in a test file its author has no reason to open. An untested failure path is how "an unreadable stream never shows as empty" stops being true without a red test.

Not a goal

  • No change to any source file under src/.
  • No change to what the timeline renders, its bounds or its scrubbing.

What changed (motivation → approach → change)

Approach. Keep every behaviour test of the timeline; remove the captured responses of the other routes; move the exact route-table equality, unchanged, to the routes' own test file; drive the real child_record into failure the way test/test_subagent_panel_fold_replay.py does; move the source-tree scans to their own file.

  • test/test_taskq_timeline.py: _BASE_GOLDEN and test_every_existing_task_route_answers_byte_for_byte_as_before are removed. test_the_task_routes_are_the_old_set_plus_one_get becomes test_the_timeline_get_route_is_registered, which asserts that GET /api/tasks/{task_id}/timeline is registered. Four new tests patch session_ledger._excluded_units or crew_log.projection.fold_session to fail: child_record and read_child_entries raise UnitSearchFailed for a unit listing that fails and for a fold read that fails, and render_timeline reports the crew-log stream unavailable (read_failed) with no entries, never an empty ok stream, while the queue's lines still render. Each test first shows the same log read correctly. The file is 1,534 lines.
  • test/test_api_tasks.py: test_the_task_route_table_is_exactly_these_routes holds the exact six (method, path) pairs under /api/tasks, the same assertion the timeline file carried, next to test_routes_are_registered_in_order. Dropping the cancel route's registration fails it.
  • test/test_taskq_timeline_structure.py (new, 141 lines): the five source-tree scans, moved unchanged from the file above with their own tree_scan_ xdist group.
  • docs/system-specs/modules/learn-cron-dashboard.md: the owner-only sentence names the timeline route and its gate, require_owner_dashboard_request, which also refuses app tokens. The two action routes' facts are unchanged.
  • docs/system-specs/modules/taskq.md and the tests paragraph of learn-cron-dashboard.md: the coverage lines match the files.

Backwards compatibility

Compatible: tests and docs only. No route, key, field or default changes.

Removes nothing a user or caller can reach. The removed test pinned other routes' responses; the exact /api/tasks route table is still pinned, in test/test_api_tasks.py.

Tests

  • The four new failure tests pass on main's code and fail when child_record is changed to return an empty ChildRecord() instead of raising in either failure branch: two report DID NOT RAISE UnitSearchFailed, and the two rendered cases read no_record instead of read_failed. The other 136 tests pass under that change.
  • Both timeline files and test/test_api_tasks.py: 176 passed, three runs in a row at -n0, and three more with the repo's default -n auto --dist loadgroup and KIROCREW_TMP_RESIDUE_STRICT=1, as the new-test stability job runs them. With test_crew_log_resolver.py, test_api_tasks.py, test_dashboard_handlers_lazy_tasks.py, test_taskq_startup.py, test_chat_utils_facade.py, test_subagent_panel_fold_replay.py and test_tree_scan_budget.py at -n 4 --dist loadgroup: 354 passed.
  • flake8, isort, the black gate, the comment-history gate, scripts/check_file_line_cap.py, scripts/docs-lint.sh, and the 28 ratchet, xdist and tree-scan-budget test files (493 passed) pass. The whole backend suite on a merge with main passed on the first revision of this change, apart from tests that fail the same way on main in this environment.
  • Reproduce: python -m pytest test/test_taskq_timeline.py test/test_taskq_timeline_structure.py test/test_api_tasks.py -n0

Review round on ad9e792. GPT and Opus blocked the presence check that had replaced the route-table equality (a ratchet may only tighten): nothing else failed when a task route was added or dropped. The equality moves unchanged to test/test_api_tasks.py, and the timeline file keeps its presence check. The new-test stability job failed on both runs on test_the_route_finds_a_channel_or_cron_parents_log_with_no_tab_open[cron:job1-cron-job1], a case from #19942: the crew-log stream read absent (no_record) with cron-job1 among the slots tried. The four cases share one tmp path (each passed case's directory is removed, and the next case gets the same numbered name), and all of them created unit acp-1 under a different slot. The store's slot index reuses the headers it proved under a root with the same path, device and inode, as store_units.session_units_by_slot says (unit ids are fresh per ACP session in a gateway), so a re-created root that keeps its inode makes the case read acp-1 under the previous case's slot. That the CI runner's filesystem reuses the inode is inferred, not observed. A local run that keeps the root and its inode between the cases reproduces it, absent (no_record) with acp-1, and passes with one unit id per case, which the test uses.

Manual verification

N/A: tests and docs only.

Screenshots / video

N/A: no file under website/ changes.

Related Issues

Follow-up to #19942 (its review notes).

Pattern harvest

Not generalizable beyond the review note: a new route's tests pin the new route, not the bytes of routes the change does not touch.

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

@javenciu
javenciu requested review from a team and KiroCrewCaptain as code owners November 10, 2026 01:15
@javenciu
javenciu requested a review from Zedmor November 10, 2026 01:15
@javenciu
javenciu enabled auto-merge (squash) November 10, 2026 01:15
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 10, 2026
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 4cef26a70c55b81a69d96259fde94056f61a2d48 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 4cef26a70c55b81a69d96259fde94056f61a2d48 — 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 does not.

First-Principles-Verdict: PASS

Nothing blocks: this PR changes only tests and docs, removes no decision without saying why, and keeps the exact route-table pin, now in the route file's own tests.

Notes

  • Item 4 — duplicate of test/test_api_tasks.py::test_the_task_route_table_is_exactly_these_routes: that test's exact equality already fails whenever ("GET", "/api/tasks/{task_id}/timeline") is missing, so the new presence check proves nothing more. Subtraction: delete test_the_timeline_get_route_is_registered and the _tasks_routes helper from test/test_taskq_timeline.py.
  • Item 6 — symptom-level: the cause is in the source. The store's slot index trusts "a root with the same path, device and inode", so a re-created directory reads an earlier slot's headers. Giving each case its own unit id only hides that in one test, and ## Not a goal keeps src/ out of scope. Subtraction: none in this PR. The cause stays open beyond this test.

What this change ships

Inventory (7 items) — 5 justified

Intent: keep the timeline tests from failing when an unrelated task route changes, and test the read failures of child_record that had no test — a FIX (test hygiene).

  1. The captured byte-for-byte responses of the five other task routes are removed — justified
  2. The exact /api/tasks route-table equality moves to test_api_tasks.py — justified
  3. Four tests drive the real child_record into failure (unit listing, fold read) and check the stream shows as unavailable, never empty — justified
  4. The timeline file keeps a check that the timeline GET route is registered — duplicate of test_api_tasks route-table equality
  5. The source-tree scans move to test_taskq_timeline_structure.py to bring the file under the line cap — justified
  6. The cron/channel parent-log test uses one unit id per case — rides along, symptom-level
  7. The specs name the timeline route's owner gate and match the coverage lines to the files — justified

[FIRST-PRINCIPLES-REVIEWED] 4cef26a

Description read

[DESCRIPTION-READ] 438a5b3c349629933d5998547c29a56ecf4bb5e25b0afd03d2aac30a549cc1dc

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

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 4cef26a70c55b81a69d96259fde94056f61a2d48 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns: this change only touches tests and docs. The exact route-table pin moves unchanged to test_api_tasks.py, and the removed golden only pinned routes the timeline doesn't touch.

Notes

  • The flake fix (one unit id per case) works around the slot index reusing headers when a re-created root keeps its inode. That reuse can also happen to real users when a store is re-created at the same path, so it deserves a tracking issue rather than living only as a test comment.

[DESIGN-REVIEWED] 4cef26a

Description read

[DESCRIPTION-READ] c60e4a145bb9a73494a06c9473875508316c20d205bec736632a9f9fcf07f088

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 4cef26a70c55b81a69d96259fde94056f61a2d48 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 4cef26a

Verdict parsed from the review's SHA-scoped output markers for commit 4cef26a70c55b81a69d96259fde94056f61a2d48.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 4cef26a70c55b81a69d96259fde94056f61a2d48 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 4cef26a70c55b81a69d96259fde94056f61a2d48 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 4cef26a

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 4cef26a70c55b81a69d96259fde94056f61a2d48 false-positive: <reason, 20 to 500 characters>

@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 Nov 10, 2026
@javenciu
javenciu force-pushed the test/timeline-route-pins branch from ad9e792 to 4ea3a3c Compare November 10, 2026 02:40
@javenciu

Copy link
Copy Markdown
Contributor Author

span=f5e0895b9793

fixed 4ea3a3c: the exact six-pair equality is back, unchanged, as test_the_task_route_table_is_exactly_these_routes in test/test_api_tasks.py, next to test_routes_are_registered_in_order, so a route added to or dropped from /api/tasks fails a test again. The timeline file keeps test_the_timeline_get_route_is_registered and the resolve test beside it.
Dropping the /api/tasks/{task_id}/cancel registration from routes/system.py fails the new test; with the registration in place it passes in 3 of 3 runs.

@javenciu

Copy link
Copy Markdown
Contributor Author

span=12b7dfb4bf33

fixed 4ea3a3c: the unchanged exact-set assertion moves to the routes' own test file, test/test_api_tasks.py::test_the_task_route_table_is_exactly_these_routes, and the timeline file keeps only its presence check, test_the_timeline_get_route_is_registered.
With the cancel route's registration removed the new test fails; with it in place it passes in 3 of 3 runs.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 10, 2026
@javenciu
javenciu force-pushed the test/timeline-route-pins branch from 4ea3a3c to 4cef26a Compare November 10, 2026 03:37
@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 Nov 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.

Tier 1 auto-approve: test (5 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: test-only change: splits the timeline structure scans into their own file, drops the byte-for-byte pin on the other task routes, and adds tests for child_record read failures; the two spec edits only describe those tests and the existing route gate. Spec files changed as a ride-along (a minority of the diff on both file count and changed lines), not reviewed as a design decision: docs/system-specs/modules/learn-cron-dashboard.md, docs/system-specs/modules/taskq.md.

@javenciu
javenciu merged commit b5139f5 into main Nov 10, 2026
103 of 109 checks passed
@javenciu
javenciu deleted the test/timeline-route-pins branch November 10, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants