2code icon indicating copy to clipboard operation
2code copied to clipboard

Task 1: Verify the open gap issues against the tip

Open AkaraChen opened this issue 2 months ago • 0 comments

Summary

Audit every open gap issue from phases 1–2 against the current tip of task-10-launch-adopt (PR #457) and close or fix each one, as required by parent plan #458. This is verification and issue hygiene first. A production behavior change is allowed only when a named gap is still a real defect on this tip — proven by a file/line or a failing test, then fixed with a test. No "probably fixed".

Herdr is the profile authority. sqlite profiles is not source of truth (the table is DROPped). projects / project_groups / checkout_notes stay in 2code sqlite. Local PTY, TWOCODE_RUNTIME, and mapping tables are already gone on this stack — do not re-add them. Do not change interaction. Do not start Task 2 (docs sweep) or Task 3 (line-count tracking).

This is #458 Task 1, not #394 Task 1 (#395) and not #436 Task 1 (#437). Do not implement or close those task tickets here.

Dependencies: Parent plan #458. Prerequisites: none on this plan. Stack on task-10-launch-adopt (PR #457). Open task tickets from #394 / #436 and every exceeds the ... line estimate (tracking) issue (the #442-class) are out of scope — Task 3 owns the trackers.

Work to complete

  1. Enumerate the gap set (not tasks, not trackers) Treat every open issue that is a gap from phases 1–2 as in scope. That set is at least:

    • #446 Local-flag delete of unmapped leftover extras
    • #447 leftover_sqlite_id pinning New Tab pty_sessions.profile_id
    • #454 terminal AGENTS.md KEY PATTERNS still describe sqlite history restore
    • #431 DeleteProjectDialog and data-flow.md still describe delete/git-only teardown
    • #416 replace_profile_workspace leaves session workspace_id stale
    • #413 projection ignores pane.exited, layout.updated, tab.moved
    • #403 delete_profile / delete_project bypass RuntimeRouter ownership
    • #407 Herdr contract docs still say Task 4 must detach / bootstrap race untested
    • Platform-only leftovers: #396, #399, #401
    • Capability leftovers: #397, #398 Exclude: parent plans (#394, #436, #458), every Task N: … implementation ticket, and every exceeds the ... line estimate (tracking) issue.
  2. For each gap, search this tip and decide once Search the named code path on task-10-launch-adopt. Then exactly one of:

    • Gone: comment with the exact file/line or test that proves the old defect cannot happen, then close. No "landed on a previous branch" without a quote from this tip.
    • Still real: fix it on this branch with a test (or a source-string assertion when the gap is docs-only). No TODO, no swallowed error, no comment-only "fix".
    • Cannot verify on this Linux builder (macOS/Windows-only, e.g. #396, #399, #401): leave open and post one comment saying why. Do not fake a Windows named-pipe or macOS attach probe. Starting-point hints (must be re-checked, not copied as the closing comment):
    • #446 / Local-flag delete: production asserts TWOCODE_RUNTIME absent in runtime.rs; LocalAdapter is gone. Close only if the live delete_profile path cannot git worktree remove a Herdr-open checkout.
    • #447 / leftover sqlite UUID: herdr.rs asserts leftover_sqlite_id absent; pty_sessions is DROPped. Close only if New Tab / list use live pane_id and profile_id is workspace_id.
    • #416 / stale mapping workspace_id: runtime_mapping.rs is gone; production asserts replace_profile_workspace absent. Close as superseded by dropped mapping tables, not by re-adding them.
    • #403 / Local teardown bypass: delete_with_runtime is forget/retain (forget_project_session, no worktree.remove). Profile delete goes through Herdr worktree.remove / workspace.close. Close the Local-kill defect; do not re-add Local PTY teardown tests.
    • #454 / KEY PATTERNS: still stale in src/features/terminal/AGENTS.md and src/features/terminal/CLAUDE.md ("Fetch closed session history from DB" / restoreFrom). WHERE TO LOOK already says restoration.ts reattaches live pane_id. This is still real — fix it here. Keep the two copies in sync. Do not rewrite the rest of docs/ (Task 2).
    • #407 / contract rows: docs/herdr-integration.md already records sidecar detach, but the Later-task Subscriptions row still says subscribe→snapshot→drain is "not separately race-tested" while runtime_sync.rs has bootstrap_applies_events_that_arrive_during_snapshot and disconnect_rebuilds_and_drops_stale_events. Update only the stale gap rows named by #407. Do not bump the v0.9.0 pin. Do not claim a live Herdr race unless this task adds one.
    • #431 / delete copy: backend project delete is forget/retain (project_delete_is_forget_retain). Keep the existing Delete Project click/label. Update docs/data-flow.md Deletion Flow (the paragraph named in #431) so it no longer says teardown_script → git worktree remove + git branch -D → delete a profiles row. Named interaction exception: if m.confirmDeleteProject() still claims irreversible destruction of checkouts / Herdr workspaces, correct only that false claim so the old Delete click is honest about catalog-forget + retain. Do not add a forget-vs-delete chooser. Do not rewrite the whole PTY lifecycle section of data-flow.md (Task 2).
    • #413 / ignored events: RuntimeProjection::apply_event still falls through pane.exited / layout.updated / tab.moved to Ignored, and agent_events_do_not_apply_exited_layout_or_tab_moved asserts that. Client-mode flattens splits as extra tabs and rebuilds from session.snapshot. If that explicit ignore plus snapshot rebuild is enough that exited/missing panes cannot linger as live tabs, close with those quotes and state the ignore is intentional. If a proven defect remains (a live tab for an exited/closed pane, or a moved tab stuck at the old index in the GUI), fix it with a test. Do not reconstruct BSP layout. Do not change the flattened-split interaction.
    • #397 / no create-time startup command: upstream v0.9.0 limit; this stack already uses post-create pane.send_input. Leave open with a comment that it is not a 2code defect on this tip. Do not invent a create-time argv field.
    • #398 / live agent CLIs unverified: idle unknown is tested; live Claude/Codex was never probed. Leave open unless this Linux tip now has a live-agent test. Do not launch a real agent CLI just to close the issue. Do not re-enable the local detector as the lifecycle authority.
    • #396 / #399 / #401: leave open; one comment each that this Linux builder cannot execute Windows attach, Windows named-pipe JSON, or macOS Unix-socket/terminal session attach.
  3. Closing comments are the review surface Every closed gap must quote evidence from this tip (path + line, or test name). Every left-open gap must have one new comment with the decision and why. Do not close #394/#436 task tickets. Do not close tracking issues. Do not push. Do not open a PR.

Likely files and directories

  • Verify / possibly quote: src-tauri/crates/service/src/runtime.rs, src-tauri/crates/service/src/runtime/herdr.rs, src-tauri/crates/service/src/runtime_sync.rs, src-tauri/crates/service/src/profile.rs, src-tauri/crates/service/src/project.rs, src-tauri/src/handler/profile.rs, src-tauri/src/handler/project.rs.
  • Fix if still stale (named gaps): src/features/terminal/AGENTS.md, src/features/terminal/CLAUDE.md (#454); docs/herdr-integration.md Later-task Subscriptions / Gaps rows (#407); docs/data-flow.md Profile deletion flow only (#431); messages/en.json + messages/zh.json only if the Delete confirm text falsely claims checkout destruction (#431 named exception).
  • Tests: colocated source-string / behavior tests next to the code you change. Do not add a second events.subscribe. Do not revive runtime_mapping.rs / pty_sessions / Local.
  • Do not change: sidecar pin, Settings runtime toggle (gone), Git/file-tree/notes/tab UI, lib.rs naming HerdrRuntimeSync, flattened-split mapping, Diesel schema.

Estimated changes: 50–250 lines total, additions plus deletions, including tests; excluding generated files, lockfile churn and binary artifacts. Most of the work is GitHub comments. Material scope growth (new layout engine, live-agent probe harness, Windows/macOS runners) should become a separate issue.

Acceptance criteria

  • [ ] Every in-scope gap issue is either closed with a comment quoting file/line or test evidence from this tip, or left open with one comment explaining why (still real and unfixed? Linux-unverifiable? upstream capability?).
  • [ ] #446, #447, #416, and #403 are not left open as if Local / mapping tables / pty_sessions still existed, unless this tip still has that path.
  • [ ] #454 KEY PATTERNS no longer describe sqlite restoreFrom history restore; AGENTS.md and CLAUDE.md in that directory stay in sync; restore is reattach of a live Herdr pane_id.
  • [ ] #407’s stale Task-4-detach / untested-bootstrap-race claims are either gone from docs/herdr-integration.md or quoted as already accurate on this tip. v0.9.0 pin unchanged. Task 1 live-probe claims are not inflated.
  • [ ] #431’s named deletion-flow docs no longer describe sqlite profiles + git-only teardown as current behavior. Delete Project click/label remains unless the confirm string claimed checkout destruction (named exception only).
  • [ ] #413 is either closed as an intentional ignore backed by tests + snapshot rebuild, or fixed with a test. No BSP layout. Flattened splits stay extra tabs.
  • [ ] #396, #399, #401 stay open with a Linux-cannot-verify comment. #397 / #398 stay open unless this tip now has evidence that closes them; they are not "fixed" by inventing create-time argv or re-enabling the local detector.
  • [ ] No production behavior change that this phase did not need. No Local / TWOCODE_RUNTIME / sqlite profiles authority. projects still round-trip in sqlite. No second events.subscribe. lib.rs still does not name HerdrRuntimeSync.
  • [ ] Tests: cargo test --workspace from src-tauri (or cargo test --workspace --exclude code where GTK is unavailable) if Rust code or manifests change. Frontend lint/typecheck/tests if frontend/messages scope is introduced. bun run typegen if IPC signatures change; do not edit src/generated/ by hand.
  • [ ] No push. No pull request.

Out of scope

  • Parent-plan Task 2 (full docs/ + src-tauri/AGENTS.md sweep) and Task 3 (line-count tracking issues).
  • Closing or implementing #394 / #436 task tickets (#395–#434, #437–#455 except the gap numbers listed above).
  • Reintroducing Local PTY, TWOCODE_RUNTIME, sqlite profiles, or mapping tables.
  • Changing the Herdr-only runtime decision, the v0.9.0 pin, or GUI exit / server stop behavior.
  • Reconstructing split layout, adding a Settings runtime toggle, or redesigning Delete / New Profile / tabs.
  • Remote Herdr machines. Windows/macOS live probes on this Linux builder.
  • Opening a pull request.

Standing constraints

  • No production behavior change unless a real defect is proven on this tip. Quote the evidence.
  • A gap may be closed only with evidence from the current tip. No "probably fixed".
  • If a gap is still real, fix it for real — no TODO, no swallowed error, no comment-only fix.
  • Do not touch the Local→Herdr runtime decision. Do not re-add sqlite profiles as an authority. projects stay in 2code sqlite.
  • Never let Local and Herdr own the same worktree (Local is already removed; do not bring it back).
  • Do not change interaction unless the old UX cannot be backed by Herdr. The only named exception in this task is #431 confirm copy if it currently claims checkout/worktree destruction.
  • One task; stack on task-10-launch-adopt. Do not push. Do not open a PR.

Why this is next

#458 has three tasks. None are done. Task 1 is the gap audit; Tasks 2–3 depend on knowing which gaps are actually still open. The open gap issues themselves are the subject of this task, not in-flight replacements for it.

AkaraChen avatar Sep 16 '26 18:09 AkaraChen