@ccoalm/ccl-skills 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/SKILL.md +4 -3
  2. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/references/staged-review-contract.md +18 -0
  3. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/review_gate.py +178 -4
  4. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/test_review_gate.sh +127 -0
  5. package/dist/assets/marketplace/plugins/ccl-skills/skills/defect-diagnosis/SKILL.md +2 -1
  6. package/dist/assets/marketplace/plugins/ccl-skills/skills/go-microservice-dev/SKILL.md +1 -1
  7. package/dist/assets/marketplace/plugins/ccl-skills/skills/llm-inference-integration/SKILL.md +1 -0
  8. package/dist/assets/marketplace/plugins/ccl-skills/skills/nodejs-service-dev/SKILL.md +11 -1
  9. package/dist/assets/marketplace/plugins/ccl-skills/skills/nodejs-service-dev/references/async-lifecycle-and-performance.md +16 -0
  10. package/dist/assets/marketplace/plugins/ccl-skills/skills/nodejs-service-dev/references/source-map.md +1 -0
  11. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-rd-workflow/SKILL.md +1 -1
  12. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-rd-workflow/references/delivery-lifecycle.md +1 -1
  13. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-rd-workflow/references/dispatch-owner-skills.md +9 -1
  14. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-rd-workflow/references/problem-resolution-and-learning.md +2 -0
  15. package/dist/assets/marketplace/plugins/ccl-skills/skills/python-service-dev/SKILL.md +1 -1
  16. package/dist/assets/marketplace/plugins/ccl-skills/skills/release-coordination/references/tag-and-prod-pipeline-gate.md +9 -0
  17. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/SKILL.md +9 -9
  18. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/dual-track-review-gate.md +7 -23
  19. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/external-practice-controls.md +16 -0
  20. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/extraction-quickstart.md +1 -1
  21. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/rule-consolidation.md +2 -0
  22. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/source-register.md +29 -0
  23. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/source-to-skill-extraction.md +2 -2
  24. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/validation-and-landing.md +2 -0
  25. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/check-ccl-skills.sh +5 -0
  26. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/contract-anchors.tsv +1 -0
  27. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/impact-chain-gate.rb +35 -6
  28. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/review_ledger_binding.py +817 -0
  29. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_check_ccl_impact_chain_refscripts.sh +81 -1
  30. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_check_ccl_regressions.sh +3 -0
  31. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_review_ledger_binding.sh +521 -0
  32. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_routing_pointer_integrity.sh +41 -1
  33. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_validate_extraction_review_state.sh +116 -9
  34. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/validate_extraction_review_state.py +123 -32
  35. package/dist/assets/marketplace/plugins/ccl-skills/skills/test-artifact-management/SKILL.md +1 -1
  36. package/dist/assets/marketplace/plugins/ccl-skills/skills/testing-strategy/SKILL.md +9 -8
  37. package/dist/assets/release.json +47 -37
  38. package/package.json +1 -1
@@ -133,10 +133,30 @@ check_absent() { # <file> <token> <label> — file must exist AND token absent;
133
133
  fi
134
134
  }
135
135
 
136
+ check_line_all() { # <file> <selector> <label> <req...> — EVERY <req> must sit on
137
+ # ONE line that matches <selector>. Filtering the matched lines through each req in
138
+ # turn is what binds them to the same line: asserting each req against the whole set
139
+ # of matched lines lets two reqs pass on two different lines, so a contract that says
140
+ # "both owners on that line" would be satisfied while no line carries both.
141
+ # -e is required: a selector starting with "-" is otherwise parsed as an option.
142
+ local file="$1" sel="$2" label="$3"; shift 3
143
+ local out req
144
+ out=$(grep -F -e "$sel" "$file" 2>/dev/null)
145
+ if [ -z "$out" ]; then
146
+ echo "FAIL: $label missing ($file :: no line matches '$sel')" >&2; fail=1; return
147
+ fi
148
+ for req in "$@"; do
149
+ out=$(printf '%s\n' "$out" | grep -F -e "$req")
150
+ if [ -z "$out" ]; then
151
+ echo "FAIL: $label missing ($file :: one line matching '$sel' must also contain '$req')" >&2; fail=1; return
152
+ fi
153
+ done
154
+ }
155
+
136
156
  # Self-pin: an emptied or truncated suite must fail, not pass. Update EXPECTED
137
157
  # when adding/removing checks deliberately (same diff). Runs FIRST: a truncated
138
158
  # tail removes real checks and the count goes red.
139
- EXPECTED_CHECKS=21
159
+ EXPECTED_CHECKS=24
140
160
  actual_checks=$(grep -cE '^check([_a-z]+)? ' "$0")
141
161
  if [ "$actual_checks" -ne "$EXPECTED_CHECKS" ]; then
142
162
  echo "FAIL: suite self-pin: expected $EXPECTED_CHECKS checks, found $actual_checks" >&2
@@ -176,6 +196,22 @@ check "$ROOT/skills/product-rd-workflow/SKILL.md" "must go to that language's de
176
196
  # no-owner fallback be deleted while the suite stays green, which is exactly the
177
197
  # routing hole (a CLI in a language with no dev owner) this rule closes.
178
198
  check "$ROOT/skills/product-rd-workflow/SKILL.md" "no such dev owner stays with \`terminal-cli-dev\` as the default CLI owner" "product-rd coordinator CLI carve-out (no-owner fallback branch, incl. destination)"
199
+ # A routing-bank case cannot guard this: a multi-stage Node request selects
200
+ # product-rd-workflow from its own wording and stays green even when the
201
+ # coordinator omits the Node owner from its dispatch map. Pin the map itself —
202
+ # both the stack enumeration and the CLI carve-out list — or the omission that
203
+ # sent Node deliveries to a coordinator with no owner to dispatch to recurs
204
+ # invisibly, with the no-owner fallback above silently reclaiming Node CLIs.
205
+ check_line_all "$ROOT/skills/product-rd-workflow/SKILL.md" "- Development routing:" "product-rd Development-routing line carries the Node owner in BOTH the stack enumeration and the CLI carve-out" "\`nodejs-service-dev\` for Node.js services" "\`python-service-dev\`, \`nodejs-service-dev\`)"
206
+ # Node has no *-architecture sibling by decision, so the technical-design gate
207
+ # must name where its architecture decisions go; without this the gate lists
208
+ # only the Go and Python architecture owners and Node design work has no owner.
209
+ # Naming the vacuum is not naming a destination: both owners must sit on that
210
+ # line, or the gate can declare Node has no architecture sibling and stop there.
211
+ # The positive ownership clause is pinned too: keeping only the two owner tokens
212
+ # while deleting "run this gate here" would leave the architecture decision ownerless,
213
+ # since nodejs-service-dev is named there as the IMPLEMENTATION owner, not the gate.
214
+ check_line_all "$ROOT/skills/product-rd-workflow/references/delivery-lifecycle.md" "For Node.js backend, worker, or CLI/tooling architecture" "product-rd design gate owns the Node architecture decision and names both downstream owners on that line" "run this gate here" "\`platform-*\` owners" "\`nodejs-service-dev\` for the Node-side implementation contract"
179
215
  # Both legs of the skip clause are pinned: an unanchored leg can be deleted while
180
216
  # the reciprocal trigger anchor above stays green, and the eval fixtures assert
181
217
  # terminal-cli-dev must NOT receive either request.
@@ -187,6 +223,10 @@ check_frontmatter_present "$ROOT/skills/terminal-cli-dev/SKILL.md" "Node.js CLI
187
223
  # implementation) — the gap two independent reviewer lanes hit.
188
224
  check_frontmatter_present "$ROOT/skills/terminal-cli-dev/SKILL.md" "command/subcommand/flag/help contract (owned here even when nothing is rendered)" "terminal-cli-dev owns the non-rendered CLI contract"
189
225
  check "$ROOT/skills/product-rd-workflow/SKILL.md" "command/subcommand/flag/help contract, which it owns even when nothing is rendered" "product-rd mirrors CLI-contract ownership"
226
+ # testing-strategy must not re-claim language-stack CLI test IMPLEMENTATION: that
227
+ # claim collided with the CLI carve-out every stack dev owner and the coordinator
228
+ # carry, so the line is scoped to the interface contract it actually owns.
229
+ check_line_all "$ROOT/skills/testing-strategy/SKILL.md" "- Use \`terminal-cli-dev\` for" "testing-strategy scopes terminal-cli-dev to the interface contract, not language-stack CLI implementation" "terminal interface contract"
190
230
  check_frontmatter_present "$ROOT/skills/platform-release-engineering/SKILL.md" "上线范围确认 / 合并 main / 打 tag" "rollout description prod-release skip"
191
231
  check "$ROOT/skills/app-cross-platform-dev/agents/openai.yaml" "React Native" "app-cross-platform-dev openai overlay RN parity"
192
232
 
@@ -145,6 +145,7 @@ def make_fixture(
145
145
  closeout=None,
146
146
  unmatched=0,
147
147
  open_last=False,
148
+ succession=False,
148
149
  ):
149
150
  if receipt_findings is None:
150
151
  receipt_findings = [[finding(1)], []]
@@ -166,11 +167,15 @@ def make_fixture(
166
167
  receipt_hashes = []
167
168
  receipt_refs = []
168
169
  for index, findings in enumerate(receipt_findings, start=1):
169
- mode = "review" if index == 1 else "challenge"
170
+ # With a succession the LAST round opens a second chain: its own chain
171
+ # arithmetic restarts at one while its lane position keeps counting.
172
+ is_succession = succession and index == rounds
173
+ chain_position = 1 if is_succession else index
174
+ mode = "challenge" if is_succession else "review" if index == 1 else "challenge"
170
175
  status = "findings" if findings else "passed"
171
- remaining = 2 - index
176
+ remaining = 2 - chain_position
172
177
  if status == "findings":
173
- state = "post_review_budget" if index == 2 else "findings_pending"
178
+ state = "post_review_budget" if chain_position == 2 else "findings_pending"
174
179
  else:
175
180
  state = "reviewed"
176
181
  receipt = {
@@ -179,16 +184,27 @@ def make_fixture(
179
184
  "status": status,
180
185
  "findings": copy.deepcopy(findings),
181
186
  "review_chain_tracked": True,
182
- "review_chain_id": "extraction-chain",
183
- "autonomous_review_index": index,
187
+ "review_chain_id": (
188
+ "extraction-succession" if is_succession else "extraction-chain"
189
+ ),
190
+ "autonomous_review_index": chain_position,
184
191
  "autonomous_review_budget": 2,
185
192
  "autonomous_reviews_remaining": remaining,
186
193
  "autonomous_review_allowed": remaining > 0,
187
- "challenge_index": 0 if index == 1 else index - 1,
194
+ "challenge_index": 1 if is_succession else 0 if index == 1 else index - 1,
188
195
  "challenge_budget": budget,
189
- "prior_review_result_sha256": list(receipt_hashes),
190
- "candidate_sha256": CANDIDATE,
191
- "packet_sha256": CANDIDATE,
196
+ "prior_review_result_sha256": [] if is_succession else list(receipt_hashes),
197
+ "predecessor_chain_id": "extraction-chain" if is_succession else None,
198
+ "predecessor_result_sha256": (
199
+ receipt_hashes[-1] if is_succession and receipt_hashes else None
200
+ ),
201
+ "predecessor_candidate_sha256": OTHER_CANDIDATE if is_succession else None,
202
+ "candidate_sha256": (
203
+ OTHER_CANDIDATE if succession and not is_succession else CANDIDATE
204
+ ),
205
+ "packet_sha256": (
206
+ OTHER_CANDIDATE if succession and not is_succession else CANDIDATE
207
+ ),
192
208
  "review_scope": copy.deepcopy(scope),
193
209
  "review_scope_sha256": scope_sha,
194
210
  "wording_only_proof_sha256": None,
@@ -504,6 +520,97 @@ run("review-only", review_only["ledger"], 1, "ready requires at least one tracke
504
520
  over_budget = make_fixture("over-budget", receipt_findings=[[], [], []])
505
521
  run("over-budget", over_budget["ledger"], 1, "exceeds the wrapper budget")
506
522
 
523
+ # Chain succession. A fix that edits the reviewed owner package ends its chain, so
524
+ # the landing candidate can only be challenged in a succeeding chain. The lane then
525
+ # spans two chains and three rounds, and the succession round is the only one that
526
+ # binds what actually lands.
527
+ succession_ready = make_fixture(
528
+ "succession-ready", receipt_findings=[[finding(1)], [], []], succession=True
529
+ )
530
+ run("succession-ready", succession_ready["ledger"], 0, "closeout_state=ready_for_human_decision")
531
+
532
+ # The failure this whole mechanism exists to make visible: the fix batch moved the
533
+ # candidate and no round ever inspected what lands.
534
+ succession_absent = make_fixture(
535
+ "succession-absent",
536
+ receipt_findings=[[finding(1)], []],
537
+ receipt_mutators={
538
+ 1: lambda row: row.update(
539
+ candidate_sha256=OTHER_CANDIDATE, packet_sha256=OTHER_CANDIDATE
540
+ ),
541
+ 2: lambda row: row.update(
542
+ candidate_sha256=OTHER_CANDIDATE, packet_sha256=OTHER_CANDIDATE
543
+ ),
544
+ },
545
+ )
546
+ run("succession-absent", succession_absent["ledger"], 1, "does not bind the ledger candidate")
547
+
548
+ # A succession whose predecessor saw the same candidate reviewed nothing new.
549
+ succession_unmoved = make_fixture(
550
+ "succession-unmoved",
551
+ receipt_findings=[[finding(1)], [], []],
552
+ succession=True,
553
+ receipt_mutators={
554
+ 1: lambda row: row.update(candidate_sha256=CANDIDATE, packet_sha256=CANDIDATE),
555
+ 2: lambda row: row.update(candidate_sha256=CANDIDATE, packet_sha256=CANDIDATE),
556
+ 3: lambda row: row.update(predecessor_candidate_sha256=CANDIDATE),
557
+ },
558
+ )
559
+ run(
560
+ "succession-unmoved",
561
+ succession_unmoved["ledger"],
562
+ 1,
563
+ "must bind a candidate the wrapper chain never saw",
564
+ )
565
+
566
+ succession_foreign_terminal = make_fixture(
567
+ "succession-foreign-terminal",
568
+ receipt_findings=[[finding(1)], [], []],
569
+ succession=True,
570
+ receipt_mutators={3: lambda row: row.update(predecessor_result_sha256="f" * 64)},
571
+ )
572
+ run(
573
+ "succession-foreign-terminal",
574
+ succession_foreign_terminal["ledger"],
575
+ 1,
576
+ "does not bind the succeeded chain's terminal receipt",
577
+ )
578
+
579
+ succession_self = make_fixture(
580
+ "succession-self",
581
+ receipt_findings=[[finding(1)], [], []],
582
+ succession=True,
583
+ receipt_mutators={3: lambda row: row.update(review_chain_id="extraction-chain")},
584
+ )
585
+ run("succession-self", succession_self["ledger"], 1, "succeeds its own chain")
586
+
587
+ succession_misplaced = make_fixture(
588
+ "succession-misplaced",
589
+ receipt_findings=[[finding(1)], [], []],
590
+ succession=True,
591
+ receipt_mutators={
592
+ 2: lambda row: row.update(predecessor_chain_id="extraction-chain"),
593
+ },
594
+ )
595
+ run(
596
+ "succession-misplaced",
597
+ succession_misplaced["ledger"],
598
+ 1,
599
+ "must be the lane's final round",
600
+ )
601
+
602
+ succession_over_lane = make_fixture(
603
+ "succession-over-lane",
604
+ receipt_findings=[[finding(1)], [], [], []],
605
+ succession=True,
606
+ )
607
+ run(
608
+ "succession-over-lane",
609
+ succession_over_lane["ledger"],
610
+ 1,
611
+ "controller_receipts must contain one to 3 ordered Agent rounds",
612
+ )
613
+
507
614
  missing_complete = make_fixture("missing-complete")
508
615
  missing_complete["ledger"]["completion_receipt"] = None
509
616
  run("missing-complete", missing_complete["ledger"], 1, "requires a completion receipt")
@@ -35,6 +35,12 @@ KNOWN_REVIEW_STATES = EXTERNAL_REVIEW_STATES | {"self_reviewed"}
35
35
  # future budget change lands in exactly one place.
36
36
  WRAPPER_CHALLENGE_BUDGET = 1
37
37
  WRAPPER_AUTONOMOUS_ROUNDS = WRAPPER_CHALLENGE_BUDGET + 1
38
+ # A fix that edits the reviewed owner package ends its chain by construction, so
39
+ # the post-fix candidate is challenged in ONE succeeding chain rather than inside
40
+ # the ended one. The lane therefore spans at most two chains: the wrapper-budget
41
+ # chain plus a single succession challenge bound to the landing candidate.
42
+ LANE_MAX_CHAINS = 2
43
+ LANE_MAX_ROUNDS = WRAPPER_AUTONOMOUS_ROUNDS + 1
38
44
  DISPOSITIONS = {
39
45
  "fixed",
40
46
  "source_refuted",
@@ -304,8 +310,10 @@ def validate_controller_receipts(
304
310
  payload: dict[str, Any], ledger_dir: Path
305
311
  ) -> tuple[list[dict[str, Any]], list[str], dict[str, list[str]], str, str]:
306
312
  refs = payload["controller_receipts"]
307
- if not isinstance(refs, list) or not 1 <= len(refs) <= 3:
308
- fail("controller_receipts must contain one to three ordered Agent rounds")
313
+ if not isinstance(refs, list) or not 1 <= len(refs) <= LANE_MAX_ROUNDS:
314
+ fail(
315
+ f"controller_receipts must contain one to {LANE_MAX_ROUNDS} ordered Agent rounds"
316
+ )
309
317
  if payload["autonomous_round"] != len(refs) or type(payload["autonomous_round"]) is not int:
310
318
  fail("autonomous_round must equal the ordered controller receipt count")
311
319
 
@@ -313,16 +321,20 @@ def validate_controller_receipts(
313
321
  receipt_hashes: list[str] = []
314
322
  finding_hashes: dict[str, list[str]] = {}
315
323
  chain_id: str | None = None
324
+ final_chain_id: str | None = None
316
325
  scope_hash: str | None = None
326
+ candidates: list[str] = []
327
+ succession_index: int | None = None
317
328
  ledger_candidate = sha256(
318
329
  payload["candidate_sha256"], "ledger.candidate_sha256"
319
330
  )
320
331
  for expected_index, value in enumerate(refs, start=1):
321
- # A caller supplying more receipts than the wrapper can mint would
332
+ # A caller supplying more receipts than the lane can mint would
322
333
  # otherwise claim a negative remaining count and reach completion
323
- # validation as a ready-state budget bypass.
324
- if expected_index > WRAPPER_AUTONOMOUS_ROUNDS:
325
- fail("controller chain exceeds the wrapper budget")
334
+ # validation as a ready-state budget bypass. The wrapper bound still
335
+ # governs each chain; the lane bound governs their sum.
336
+ if expected_index > LANE_MAX_ROUNDS:
337
+ fail("controller chain exceeds the lane budget")
326
338
  ref = exact_object(
327
339
  value, {"sequence", "file", "sha256"}, f"controller_receipts[{expected_index - 1}]"
328
340
  )
@@ -339,7 +351,28 @@ def validate_controller_receipts(
339
351
  receipt = decode_json(raw, label=f"controller receipt {expected_index}")
340
352
  if receipt.get("schema_version") != 3 or type(receipt.get("schema_version")) is not int:
341
353
  fail(f"controller receipt {expected_index} schema_version must be 3")
342
- expected_mode = "review" if expected_index == 1 else "challenge"
354
+ # A succession round opens a second chain, so its own chain arithmetic
355
+ # restarts at one while its lane position keeps counting. Classify first;
356
+ # every expectation below reads the chain position, not the lane index.
357
+ predecessor_chain = receipt.get("predecessor_chain_id")
358
+ is_succession = predecessor_chain is not None
359
+ if is_succession:
360
+ if expected_index != len(refs):
361
+ fail("a succession round must be the lane's final round")
362
+ if expected_index != WRAPPER_AUTONOMOUS_ROUNDS + 1:
363
+ fail("a succession round may only follow a spent wrapper chain")
364
+ succession_index = expected_index
365
+ chain_position = 1
366
+ else:
367
+ # Only a succession round may sit past the wrapper chain. Without this
368
+ # the caller claims a negative remaining count and reaches completion
369
+ # validation as a ready-state budget bypass.
370
+ if expected_index > WRAPPER_AUTONOMOUS_ROUNDS:
371
+ fail("controller chain exceeds the wrapper budget")
372
+ chain_position = expected_index
373
+ expected_mode = (
374
+ "challenge" if is_succession else "review" if expected_index == 1 else "challenge"
375
+ )
343
376
  if receipt.get("mode") != expected_mode:
344
377
  fail(f"controller receipt {expected_index} must have mode {expected_mode}")
345
378
  if receipt.get("status") not in {"passed", "findings"}:
@@ -349,15 +382,24 @@ def validate_controller_receipts(
349
382
  current_chain = bounded_text(
350
383
  receipt.get("review_chain_id"), f"controller receipt {expected_index}.review_chain_id", 120
351
384
  )
352
- if chain_id is None:
385
+ if is_succession:
386
+ if current_chain == chain_id:
387
+ fail(
388
+ f"controller receipt {expected_index} succeeds its own chain"
389
+ )
390
+ final_chain_id = current_chain
391
+ elif chain_id is None:
353
392
  chain_id = current_chain
393
+ final_chain_id = current_chain
354
394
  elif current_chain != chain_id:
355
395
  fail(f"controller receipt {expected_index} review_chain_id changed")
356
- if receipt.get("autonomous_review_index") != expected_index or type(
396
+ if receipt.get("autonomous_review_index") != chain_position or type(
357
397
  receipt.get("autonomous_review_index")
358
398
  ) is not int:
359
399
  fail(f"controller receipt {expected_index} autonomous_review_index is not contiguous")
360
- expected_challenge_index = 0 if expected_index == 1 else expected_index - 1
400
+ expected_challenge_index = (
401
+ 1 if is_succession else 0 if expected_index == 1 else expected_index - 1
402
+ )
361
403
  if receipt.get("challenge_index") != expected_challenge_index or type(
362
404
  receipt.get("challenge_index")
363
405
  ) is not int:
@@ -368,7 +410,7 @@ def validate_controller_receipts(
368
410
  receipt.get("autonomous_review_budget")
369
411
  ) is not int:
370
412
  fail(f"controller receipt {expected_index} autonomous_review_budget must be {WRAPPER_AUTONOMOUS_ROUNDS}")
371
- expected_remaining = WRAPPER_AUTONOMOUS_ROUNDS - expected_index
413
+ expected_remaining = WRAPPER_AUTONOMOUS_ROUNDS - chain_position
372
414
  if receipt.get("autonomous_reviews_remaining") != expected_remaining or type(
373
415
  receipt.get("autonomous_reviews_remaining")
374
416
  ) is not int:
@@ -376,7 +418,8 @@ def validate_controller_receipts(
376
418
  if receipt.get("autonomous_review_allowed") is not (expected_remaining > 0):
377
419
  fail(f"controller receipt {expected_index} autonomous_review_allowed is invalid")
378
420
  prior = receipt.get("prior_review_result_sha256")
379
- if prior != receipt_hashes:
421
+ expected_prior = [] if is_succession else receipt_hashes
422
+ if prior != expected_prior:
380
423
  fail(f"controller receipt {expected_index} prior_review_result_sha256 is not the complete ordered prefix")
381
424
  candidate = sha256(
382
425
  receipt.get("candidate_sha256"), f"controller receipt {expected_index}.candidate_sha256"
@@ -386,13 +429,10 @@ def validate_controller_receipts(
386
429
  )
387
430
  if packet != candidate:
388
431
  fail(f"controller receipt {expected_index} packet_sha256 must equal candidate_sha256")
389
- # Every counted round must have inspected the exact final candidate;
390
- # a chain whose review round saw an earlier candidate is not a review
391
- # of the candidate this ledger closes out.
392
- if candidate != ledger_candidate:
393
- fail(
394
- f"controller receipt {expected_index} does not bind the ledger candidate"
395
- )
432
+ # Which candidate a round must bind depends on its phase, and the phase
433
+ # split is only known once every round is loaded, so this is settled
434
+ # after the loop rather than here.
435
+ candidates.append(candidate)
396
436
  current_scope_hash = validate_scope(receipt, f"controller receipt {expected_index}")
397
437
  if scope_hash is None:
398
438
  scope_hash = current_scope_hash
@@ -425,7 +465,7 @@ def validate_controller_receipts(
425
465
  fail(f"controller receipt {expected_index} has unknown controller review_state {state}")
426
466
  expected_state = (
427
467
  "post_review_budget"
428
- if receipt["status"] == "findings" and expected_index == WRAPPER_AUTONOMOUS_ROUNDS
468
+ if receipt["status"] == "findings" and chain_position == WRAPPER_AUTONOMOUS_ROUNDS
429
469
  else "findings_pending"
430
470
  if receipt["status"] == "findings"
431
471
  else "reviewed"
@@ -439,9 +479,38 @@ def validate_controller_receipts(
439
479
  receipt_hashes.append(receipt_hash)
440
480
  finding_hashes[receipt_hash] = current_findings
441
481
 
442
- if chain_id is None or scope_hash is None:
482
+ if chain_id is None or scope_hash is None or final_chain_id is None:
443
483
  fail("controller receipt chain is empty")
444
- return receipts, receipt_hashes, finding_hashes, chain_id, scope_hash
484
+
485
+ # Phase binding. Without a succession every counted round must have inspected
486
+ # the exact final candidate. With one, the wrapper chain reviewed the candidate
487
+ # the fix batch then moved, and the succession round is the only round that can
488
+ # bind what actually lands — which is the whole point of running it.
489
+ if succession_index is None:
490
+ for position, value in enumerate(candidates, start=1):
491
+ if value != ledger_candidate:
492
+ fail(f"controller receipt {position} does not bind the ledger candidate")
493
+ else:
494
+ succession = receipts[-1]
495
+ succeeded_candidate = sha256(
496
+ succession.get("predecessor_candidate_sha256"),
497
+ "succession receipt.predecessor_candidate_sha256",
498
+ )
499
+ if candidates[-1] != ledger_candidate:
500
+ fail("the succession round does not bind the ledger candidate")
501
+ if succeeded_candidate == ledger_candidate:
502
+ fail("a succession round must bind a candidate the wrapper chain never saw")
503
+ for position, value in enumerate(candidates[:-1], start=1):
504
+ if value != succeeded_candidate:
505
+ fail(f"controller receipt {position} does not bind the succeeded candidate")
506
+ if succession.get("predecessor_chain_id") != chain_id:
507
+ fail("the succession round does not name the chain it succeeds")
508
+ if sha256(
509
+ succession.get("predecessor_result_sha256"),
510
+ "succession receipt.predecessor_result_sha256",
511
+ ) != receipt_hashes[-2]:
512
+ fail("the succession round does not bind the succeeded chain's terminal receipt")
513
+ return receipts, receipt_hashes, finding_hashes, final_chain_id, scope_hash
445
514
 
446
515
 
447
516
  def validate_completion_receipt(
@@ -485,18 +554,24 @@ def validate_completion_receipt(
485
554
  receipt.get("autonomous_review_budget")
486
555
  ) is not int:
487
556
  fail(f"completion receipt autonomous_review_budget must be {WRAPPER_AUTONOMOUS_ROUNDS}")
488
- if receipt.get("autonomous_review_index") != len(receipts) or type(
557
+ # The completion checkpoint binds the final external round, so its chain
558
+ # arithmetic is that round's — which is the succeeding chain's when a fix
559
+ # batch ended the wrapper chain, not the lane's round count.
560
+ final_index = final.get("autonomous_review_index")
561
+ if receipt.get("autonomous_review_index") != final_index or type(
489
562
  receipt.get("autonomous_review_index")
490
563
  ) is not int:
491
564
  fail("completion receipt autonomous_review_index does not match the final round")
492
- expected_remaining = WRAPPER_AUTONOMOUS_ROUNDS - len(receipts)
565
+ expected_remaining = WRAPPER_AUTONOMOUS_ROUNDS - final_index
493
566
  if receipt.get("autonomous_reviews_remaining") != expected_remaining or type(
494
567
  receipt.get("autonomous_reviews_remaining")
495
568
  ) is not int:
496
569
  fail("completion receipt autonomous_reviews_remaining does not match the final round")
497
570
  if receipt.get("autonomous_review_allowed") is not False:
498
571
  fail("completion receipt must disable further autonomous review")
499
- if receipt.get("prior_review_result_sha256") != receipt_hashes[:-1]:
572
+ if receipt.get("prior_review_result_sha256") != final.get(
573
+ "prior_review_result_sha256"
574
+ ):
500
575
  fail("completion receipt prior_review_result_sha256 does not match the final external receipt")
501
576
  if receipt.get("completion_review_result_sha256") != receipt_hashes[-1]:
502
577
  fail("completion receipt completion_review_result_sha256 does not identify the final external receipt")
@@ -950,13 +1025,29 @@ def validate(payload: dict[str, Any], ledger_dir: Path) -> tuple[str, int, int]:
950
1025
  fail("ready_for_human_decision requires no unresolved finding occurrence and no unreviewed delta")
951
1026
  elif closeout == "continuation_authorization_required":
952
1027
  final = receipts[-1]
953
- if (
954
- len(receipts) != WRAPPER_AUTONOMOUS_ROUNDS
955
- or final.get("status") != "findings"
956
- or final.get("review_state") != "post_review_budget"
957
- or final.get("human_decision_required") is not True
958
- ):
959
- fail(f"continuation_authorization_required requires final-round (round {WRAPPER_AUTONOMOUS_ROUNDS}) findings in post_review_budget")
1028
+ # The lane is spent either at the wrapper chain's last round, or — when a
1029
+ # fix batch moved the candidate — at the succession round that reviewed it.
1030
+ # Only the closeout knows the lane is spent: the controller sizes
1031
+ # human_decision_required from its own chain, where the succession round
1032
+ # is round one of two.
1033
+ succeeded = final.get("predecessor_chain_id") is not None
1034
+ if succeeded:
1035
+ spent = (
1036
+ len(receipts) == LANE_MAX_ROUNDS and final.get("status") == "findings"
1037
+ )
1038
+ else:
1039
+ spent = (
1040
+ len(receipts) == WRAPPER_AUTONOMOUS_ROUNDS
1041
+ and final.get("status") == "findings"
1042
+ and final.get("review_state") == "post_review_budget"
1043
+ and final.get("human_decision_required") is True
1044
+ )
1045
+ if not spent:
1046
+ fail(
1047
+ "continuation_authorization_required requires final-round "
1048
+ f"(round {WRAPPER_AUTONOMOUS_ROUNDS}) findings in post_review_budget, "
1049
+ f"or a succession round (round {LANE_MAX_ROUNDS}) carrying findings"
1050
+ )
960
1051
  elif closeout == "baseline_race" and not delta:
961
1052
  fail("baseline_race requires a non-empty unreviewed_delta")
962
1053
 
@@ -15,7 +15,7 @@ Bitable ownership:
15
15
 
16
16
  - Ambiguous "写测试用例" / "write test cases" requests mean `testing-strategy` first when the user wants test code, E2E/browser/device tests, CI coverage, mocks, or verification evidence. Use this skill only when the deliverable is a structured TC artifact, Feishu/Bitable sync, or source-to-TC generation workflow.
17
17
  - Use `testing-strategy` to decide which test layers (unit / integration / E2E / scenario) are needed *after* the use cases are written.
18
- - Use `go-microservice-dev` / `python-service-dev` / `web-react-dev` / `miniapp-product-dev` / `app-cross-platform-dev` for implementing the test code once test cases are approved.
18
+ - Test-code implementation, once test cases are approved, must go to the owning stack skill: `go-microservice-dev` / `python-service-dev` / `nodejs-service-dev` / `web-react-dev` / `miniapp-product-dev` / `app-cross-platform-dev`.
19
19
  - Use `product-rd-workflow` when the test case work is part of a broader feature delivery plan.
20
20
  - Use `llm-inference-integration` when test cases cover LLM / agent / RAG / inference behavior.
21
21
  - Use `skill-extraction-workflow` to feed lessons from test case generation or Feishu Bitable setup back into this skill after each delivery cycle.
@@ -9,14 +9,15 @@ Use this skill when the task is about test scope, test design, verification evid
9
9
 
10
10
  ## Skill Routing
11
11
 
12
- - Use this skill for test strategy, test pyramid decisions, unit/integration/e2e/scenario boundaries, fixtures, mocks/fakes, regression coverage, and verification evidence.
13
- - Use `go-microservice-dev` for Go-specific implementation details after the test layer is chosen.
14
- - Use `python-service-dev` for Python-specific pytest, async test, fixture, fake client, ruff, mypy/pyright, packaging, or migration-test implementation details after the test layer is chosen.
15
- - Use `app-cross-platform-dev` for Flutter unit/widget/integration tests, Android unit/Compose/instrumented tests, iOS unit/UI tests, mobile device smoke, and app release verification after the test layer is chosen.
16
- - Use `miniapp-product-dev` for WeChat/Alipay/Douyin/Baidu mini-program build, developer-tool preview, real-device smoke, host capability verification, review submission, and release checks after the test layer is chosen.
17
- - Use `web-react-dev` for React unit/component/API-client/browser/E2E implementation, browser automation, accessibility checks, and build/deploy smoke after the test layer is chosen.
18
- - Use `terminal-cli-dev` for command-line, terminal, PTY-backed, ANSI-rendered, keyboard-driven, and full-screen text UI implementation after the test layer is chosen.
19
- - Use `llm-inference-integration` for LLM/agent/RAG evals, replay sets, prompt/model regression checks, shadow runs, and inference-specific observability after the test layer is chosen.
12
+ - Use this skill for test strategy, test pyramid decisions, unit/integration/e2e/scenario boundaries, fixtures, mocks/fakes, regression coverage, and verification evidence. Stack pointers below apply after that choice.
13
+ - Use `go-microservice-dev` for Go-specific implementation details.
14
+ - Use `python-service-dev` for Python-specific pytest, async test, fixture, fake client, ruff, mypy/pyright, packaging, or migration-test implementation details.
15
+ - Node runner, mock/fixture, fake timers, stream and cancellation assertions, child-process lifecycle, and packaged-artifact verification must use `nodejs-service-dev`.
16
+ - Use `app-cross-platform-dev` for Flutter unit/widget/integration tests, Android unit/Compose/instrumented tests, iOS unit/UI tests, mobile device smoke, and app release verification.
17
+ - Use `miniapp-product-dev` for WeChat/Alipay/Douyin/Baidu mini-program build, developer-tool preview, real-device smoke, host capability verification, review submission, and release checks.
18
+ - Use `web-react-dev` for React unit/component/API-client/browser/E2E implementation, browser automation, accessibility checks, and build/deploy smoke.
19
+ - Use `terminal-cli-dev` for the terminal interface contract, PTY/ANSI/keyboard rendering, and full-screen text UI testing.
20
+ - Use `llm-inference-integration` for LLM/agent/RAG evals, replay sets, prompt/model regression checks, shadow runs, and inference-specific observability.
20
21
  - Use `defect-diagnosis` first when a test is failing, flaky, or used to reproduce a bug.
21
22
  - Use `product-rd-workflow` first when testing is part of an end-to-end product delivery plan.
22
23
  - Use `product-ui-ux-design` for visual hierarchy, interaction, state, accessibility, and design acceptance criteria; use this skill for automated proof and test coverage.