Skip to content

feat(idd-all-chain): multi-root + DFS/BFS traversal + per-root halt (#46)#82

Open
kiki830621 wants to merge 6 commits into
mainfrom
idd/46-multi-root-traversal-idd-all-chain
Open

feat(idd-all-chain): multi-root + DFS/BFS traversal + per-root halt (#46)#82
kiki830621 wants to merge 6 commits into
mainfrom
idd/46-multi-root-traversal-idd-all-chain

Conversation

@kiki830621
Copy link
Copy Markdown
Contributor

Refs #46

Summary

/idd-all-chain 從 single-root 擴展為 multi-root forest orchestrator,加入 DFS/BFS traversal mode 與 per-root verify FAIL halt 語意。Spawn manifest schema v1 → v2 hard-break(no v1 clients in the wild)。

What changed (10 BREAKING + feature items per proposal)

  • Multi-root invocation: /idd-all-chain #44 #45 #50 接受 ≥2 個 root issue;N=1 行為 byte-equivalent backward compat
  • Traversal mode: default DFS(rich subtree first)+ opt-in --bfs(fairness)
  • BREAKING: manifest schema v1 → v2 — root_issue: introot_issues: [int]、top-level 加 traversal、每 spawn entry 加 root_id
  • Cap redesign: chain_max_depth 2 → 3(per-root),chain_max_issues 5 → 10(global)
  • Verify FAIL halt scope: Option C — per-root continue(非 global halt)
  • Branch naming: N=1 idd/chain-<N>-<slug>(backward compat);N>1 idd/chain-multi-<hash8>-<root1-slug>
  • DFS implementation: 真的改 queue order(push-front)而非只標 label
  • PR title format: N=1 chain: <title>;N>1 chain (multi-root): N issues — <root#1 title>
  • Phase 4 forest tree: per-root status icons + per-root PASS/FAIL summary + filed-only-not-chained list
  • 4 sub-skills propagation: idd-implement / idd-verify / idd-plan / idd-diagnose 的 manifest-append.sh 呼叫加第 9 個 arg root_id

Spectra change directory

openspec/changes/multi-root-traversal-idd-all-chain/:

  • proposal.md — Why / What Changes / Capabilities / Impact
  • design.md — 7 Decisions (D1 schema v2 hard-break, D2 DFS=push-front, D3 caps, D4 per-root halt, D5 branch hash8, D6 PR title, D7 forest tree) + Implementation Contract + Risks
  • specs/idd-all-chain/spec.md — 3 MODIFIED + 1 ADDED Requirement(forest tree)
  • specs/idd-spawn-manifest/spec.md — 3 MODIFIED Requirements(schema v2)
  • tasks.md — 15 tasks across 7 groups

Cluster overview

# Commit Group Scope
1 823de66 spectra propose change directory (6 artifacts)
2 ed9682d schema manifest-append.sh v2 + spawn-manifest.md v2 + 4 unit tests pass
3 49b2cc0 chain-skill idd-all-chain SKILL.md Phase 0/1/2/3/4 multi-root rewrite
4 e1babe2 sub-skills 4 sub-skills pass root_id (9th arg, env var fallback)
5 cd3d43c docs chain-flow.md DFS/BFS algorithm + per-root halt + caps + branch naming
6 2d7c7fc tasks mark smoke tests 7.1/7.2 as [~] first-real-use validation

Task state

Acceptance coverage

  • Algorithm correctness: bash logic in idd-all-chain/SKILL.md Phase 1/2 visible in diff for review
  • Unit tests pass (commit ed9682d): manifest-append.sh 8-args→exit2, 9-args→exit0 with root_id written, v1 manifest→exit1, bad root_id→exit2
  • Branch naming deterministic (verified in commit 49b2cc0): N=1 yields idd/chain-99-...; N=3 with roots {44,45,50} yields idd/chain-multi-c3d62b8a-... (hash reproducible)
  • First-real-use track: per feature: idd-verify orchestration playbook (subagent_type guidance + recovery protocol) #52 precedent — first /idd-all-chain #A #B #C invocation after merge serves as smoke for orchestration end-to-end

Verify

/idd-verify --pr <THIS-PR>

The 6-AI ensemble can review the algorithm logic, schema contract, and IDD discipline (no auto-close trailers, IDD checklist conventions for [~]+reason).

Pending review

  • Spectra change proposed (analyzer: 0 Critical / 0 Warning / 1 Suggestion)
  • Spec deltas validated (spectra validate passed)
  • Schema v2 helper + 4 sub-skills + chain shell consistent
  • Backward compat preserved (N=1 byte-equivalent to v2.55.0+)
  • Pending: human review of cluster diff + /idd-close #46 after merge — per IDD discipline; no Closes #46 trailer (must run idd-close skill to enforce closing summary + checklist gate)

🤖 Generated by /spectra-apply + /idd-implement on PR path. Do NOT add 'Closes #46' — IDD discipline requires manual /idd-close #46 after merge to enforce checklist gate + post Closing Summary comment.

Add Spectra change directory:
- proposal.md (Why / What Changes / 10 BREAKING & feature items)
- design.md (7 Decisions D1-D7 + Implementation Contract + Risks)
- specs/idd-all-chain/spec.md (3 MODIFIED + 1 ADDED forest tree)
- specs/idd-spawn-manifest/spec.md (3 MODIFIED — schema v2 hard-break)
- tasks.md (15 tasks across 7 groups + Design decisions coverage map)

Analyzer: 0 Critical / 0 Warning / 1 Suggestion
Validation: passed

Refs #46
manifest-append.sh:
- bump EXPECTED_SCHEMA_VERSION from 1 to 2
- accept 9th positional arg `root_id` (integer > 0, must be in root_issues array)
- emit root_id in spawn entry JSON
- migration hint on v1 manifest detection

spawn-manifest.md:
- top-level: `root_issue: <int>` → `root_issues: [<int>, ...]` + `traversal: "dfs"|"bfs"`
- spawn entry: add `root_id: <int>` (required)
- example switches to multi-root sample (roots [28, 44], DFS)
- chain context detection: schema_version=2 instead of 1

Unit tests pass:
- 8 args → exit 2 (usage)
- 9 args + v2 fixture manifest → exit 0, root_id written
- v1 manifest under v2 helper → exit 1 (schema mismatch)
- root_id not in root_issues → exit 2 (validation)

Covers tasks 1.1, 1.2 (D1: Schema v2 hard-break)
Refs #46
…Refs #46)

Phase 0:
- accept ≥1 root issue + optional --bfs flag
- branch naming: N=1 backward compat 'idd/chain-<N>-<slug>',
  N>1 'idd/chain-multi-<hash8>-<root1-slug>' with hash16 collision fallback
- check-diagnosis-readiness.sh now called variadic across all roots
- AskUserQuestion aggregates not-ready roots in one prompt
- proceed-anyway PATCH iterates per not-ready root

Phase 1:
- QUEUE seeded with sorted roots
- per-root DEPTH_MAP and ROOT_ID_MAP for subtree tracking
- FAIL_ROOTS associative array
- caps bumped: CHAIN_MAX_DEPTH 2→3, CHAIN_MAX_ISSUES 5→10

Phase 2:
- DFS = push-spawn-to-front, BFS = push-spawn-to-back
- per-root depth cap (max-depth=3 per subtree) + global max-issues=10
- verify FAIL = halt that root's subtree (D4 Option C), purge same-root pending
  from QUEUE, continue other root subtrees, commits preserved
- export IDD_CHAIN_CURRENT_ROOT_ID so sub-skills can propagate root_id to manifest

Phase 3:
- PR title dispatch: N=1 'chain: <title>', N>1 'chain (multi-root): N issues — <root#1 title>'
- cluster overview table adds root_id column
- Refs lists all roots first then chained spawns (dedup)

Phase 4:
- forest tree printout per root subtree with status icons ✓/✗/⊘
- per-root PASS/FAIL/SKIPPED summary block
- filed-only-not-chained list

Top-of-file caps + 鐵律 + Failure modes table updated for multi-root.

Covers tasks 2.1, 3.1, 3.2, 3.3, 4.1, 4.2 (D2, D3, D4, D5, D6, D7)
Refs #46
All four spawning sub-skills now pass the 9th positional arg `root_id`
to scripts/manifest-append.sh per v2 schema:

- idd-implement Step 5.7 (sister bug sweep)
- idd-verify Phase 4 (follow-up findings triage)
- idd-plan Step 2.5 (tangential observations)
- idd-diagnose Step 3.6 (sister concern surfacing)

root_id is derived from:
1. IDD_CHAIN_CURRENT_ROOT_ID env var (set by idd-all-chain Phase 2 before
   each /idd-all --in-chain invocation), or
2. Fallback to current issue's #NNN — covers single-root chain or
   root-self-spawn case

When chain context is inactive (manifest file absent), helper exits 0
silently and behavior is identical to baseline (additive change).

Covers tasks 5.1, 5.2, 5.3, 5.4 (D1: Schema v2 hard-break)
Refs #46
…ion (Refs #46)

Update reference doc for v2.60+ multi-root chain semantics:

- Cluster branch naming: dispatch N=1 vs N>1 with hash8 + hash16 fallback
- Chain state: add ROOT_ID_MAP, FAIL_ROOTS, FAILED_AT, TRAVERSAL fields
- Caps: chain_max_depth 2→3 (per-root), chain_max_issues 5→10 (global)
- NEW section 'Traversal mode (DFS vs BFS)' explaining push-front vs push-back
  with example queue order table
- Loop algorithm: pseudo-code shows traversal dispatch, per-root halt logic
  (FAIL_ROOTS + same-root queue purge), root_id_map inheritance, env var
  IDD_CHAIN_CURRENT_ROOT_ID propagation to sub-skills
- Failure mode table: per-root halt rows + manifest schema mismatch rows +
  missing-9th-arg row
- PR title + body schema split for N=1 vs N>1; cluster overview table adds
  root_id column; details summary shows root_id

Covers task 6.1 (D1, D2, D3, D4, D5, D6, D7 all referenced)
Refs #46
…n track (Refs #46)

Mark tasks 7.1 and 7.2 as [~] (skipped with reason) per IDD checklist
convention (per plugins/issue-driven-dev/CLAUDE.md):

- 7.1 Single-root + multi-root happy path smoke tests
- 7.2 Multi-root edge cases smoke tests (verify FAIL, depth-cap, issues-cap)

Reason: no test fixture repo for orchestration testing exists in this
codebase (consistent with #52 idd-verify orchestration validation track —
orchestration tests cannot mock GitHub API / git operations without
significant fixture infrastructure investment).

Acceptance criteria covered through:
- Deterministic unit-test snippets in commit 49b2cc0 (branch naming for
  N=1/N=3 with hash8 reproducibility check)
- 4 unit tests in commit ed9682d (manifest-append.sh arg-count + schema +
  root_id validation)
- First real /idd-all-chain invocation after merge serves as acceptance
  for the orchestration algorithm (DFS push-front, per-root halt, caps)

Refs #46
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.

feature: /idd-all-chain accept multiple root issues with DFS/BFS traversal (default DFS)

1 participant