@mc-and-his-agents/loom-installer 0.1.48 → 0.1.50

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 (22) hide show
  1. package/package.json +1 -1
  2. package/payload/manifest.json +42 -42
  3. package/payload/plugin/loom/skills/shared/scripts/loom_check.py +69 -0
  4. package/payload/plugin/loom/skills/shared/scripts/loom_flow.py +50 -13
  5. package/payload/skills/loom-adopt/.loom-runtime/shared/scripts/loom_check.py +69 -0
  6. package/payload/skills/loom-adopt/.loom-runtime/shared/scripts/loom_flow.py +50 -13
  7. package/payload/skills/loom-handoff/.loom-runtime/shared/scripts/loom_check.py +69 -0
  8. package/payload/skills/loom-handoff/.loom-runtime/shared/scripts/loom_flow.py +50 -13
  9. package/payload/skills/loom-init/.loom-runtime/shared/scripts/loom_check.py +69 -0
  10. package/payload/skills/loom-init/.loom-runtime/shared/scripts/loom_flow.py +50 -13
  11. package/payload/skills/loom-merge-ready/.loom-runtime/shared/scripts/loom_check.py +69 -0
  12. package/payload/skills/loom-merge-ready/.loom-runtime/shared/scripts/loom_flow.py +50 -13
  13. package/payload/skills/loom-pre-review/.loom-runtime/shared/scripts/loom_check.py +69 -0
  14. package/payload/skills/loom-pre-review/.loom-runtime/shared/scripts/loom_flow.py +50 -13
  15. package/payload/skills/loom-resume/.loom-runtime/shared/scripts/loom_check.py +69 -0
  16. package/payload/skills/loom-resume/.loom-runtime/shared/scripts/loom_flow.py +50 -13
  17. package/payload/skills/loom-retire/.loom-runtime/shared/scripts/loom_check.py +69 -0
  18. package/payload/skills/loom-retire/.loom-runtime/shared/scripts/loom_flow.py +50 -13
  19. package/payload/skills/loom-review/.loom-runtime/shared/scripts/loom_check.py +69 -0
  20. package/payload/skills/loom-review/.loom-runtime/shared/scripts/loom_flow.py +50 -13
  21. package/payload/skills/loom-spec-review/.loom-runtime/shared/scripts/loom_check.py +69 -0
  22. package/payload/skills/loom-spec-review/.loom-runtime/shared/scripts/loom_flow.py +50 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mc-and-his-agents/loom-installer",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "description": "Node installer for Loom plugin and single-skill installation surfaces.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -2,9 +2,9 @@
2
2
  "schema_version": "loom-installer-payload/v1",
3
3
  "loom_version": "0.4.0",
4
4
  "source_repository": "https://github.com/MC-and-his-Agents/Loom",
5
- "source_commit": "e584966cb8ab5b856e9b3588173d436302fa4904",
5
+ "source_commit": "e0d9542d7f67ae153e1b884c11bbc848943941cb",
6
6
  "source_ref": "main",
7
- "built_at": "2026-04-28T10:12:57+08:00",
7
+ "built_at": "2026-04-28T11:55:17+08:00",
8
8
  "runtime": {
9
9
  "python_minimum": "3.10",
10
10
  "python_recommended": "3.11+"
@@ -633,13 +633,13 @@
633
633
  },
634
634
  {
635
635
  "path": "plugin/loom/skills/shared/scripts/loom_check.py",
636
- "bytes": 362269,
637
- "sha256": "451270ab050bc0b1522ae08d2c151dd704d711a41c5de5ba237d626b6d60ec1d"
636
+ "bytes": 365681,
637
+ "sha256": "e48281477bbb35b887e21034570ed519a40dae718ea97e99886a66b04dbd1d50"
638
638
  },
639
639
  {
640
640
  "path": "plugin/loom/skills/shared/scripts/loom_flow.py",
641
- "bytes": 341764,
642
- "sha256": "1d48bec787cdb4a056cd98c0f40b54fadc70711299691c343dcf4db60672246b"
641
+ "bytes": 343536,
642
+ "sha256": "f8fe63875c5abce92281c4fce0fa329c3584a25a85c131ba2d0364ac39b78997"
643
643
  },
644
644
  {
645
645
  "path": "plugin/loom/skills/shared/scripts/loom_init.py",
@@ -1223,13 +1223,13 @@
1223
1223
  },
1224
1224
  {
1225
1225
  "path": "skills/loom-adopt/.loom-runtime/shared/scripts/loom_check.py",
1226
- "bytes": 362269,
1227
- "sha256": "451270ab050bc0b1522ae08d2c151dd704d711a41c5de5ba237d626b6d60ec1d"
1226
+ "bytes": 365681,
1227
+ "sha256": "e48281477bbb35b887e21034570ed519a40dae718ea97e99886a66b04dbd1d50"
1228
1228
  },
1229
1229
  {
1230
1230
  "path": "skills/loom-adopt/.loom-runtime/shared/scripts/loom_flow.py",
1231
- "bytes": 341764,
1232
- "sha256": "1d48bec787cdb4a056cd98c0f40b54fadc70711299691c343dcf4db60672246b"
1231
+ "bytes": 343536,
1232
+ "sha256": "f8fe63875c5abce92281c4fce0fa329c3584a25a85c131ba2d0364ac39b78997"
1233
1233
  },
1234
1234
  {
1235
1235
  "path": "skills/loom-adopt/.loom-runtime/shared/scripts/loom_init.py",
@@ -1843,13 +1843,13 @@
1843
1843
  },
1844
1844
  {
1845
1845
  "path": "skills/loom-handoff/.loom-runtime/shared/scripts/loom_check.py",
1846
- "bytes": 362269,
1847
- "sha256": "451270ab050bc0b1522ae08d2c151dd704d711a41c5de5ba237d626b6d60ec1d"
1846
+ "bytes": 365681,
1847
+ "sha256": "e48281477bbb35b887e21034570ed519a40dae718ea97e99886a66b04dbd1d50"
1848
1848
  },
1849
1849
  {
1850
1850
  "path": "skills/loom-handoff/.loom-runtime/shared/scripts/loom_flow.py",
1851
- "bytes": 341764,
1852
- "sha256": "1d48bec787cdb4a056cd98c0f40b54fadc70711299691c343dcf4db60672246b"
1851
+ "bytes": 343536,
1852
+ "sha256": "f8fe63875c5abce92281c4fce0fa329c3584a25a85c131ba2d0364ac39b78997"
1853
1853
  },
1854
1854
  {
1855
1855
  "path": "skills/loom-handoff/.loom-runtime/shared/scripts/loom_init.py",
@@ -2463,13 +2463,13 @@
2463
2463
  },
2464
2464
  {
2465
2465
  "path": "skills/loom-init/.loom-runtime/shared/scripts/loom_check.py",
2466
- "bytes": 362269,
2467
- "sha256": "451270ab050bc0b1522ae08d2c151dd704d711a41c5de5ba237d626b6d60ec1d"
2466
+ "bytes": 365681,
2467
+ "sha256": "e48281477bbb35b887e21034570ed519a40dae718ea97e99886a66b04dbd1d50"
2468
2468
  },
2469
2469
  {
2470
2470
  "path": "skills/loom-init/.loom-runtime/shared/scripts/loom_flow.py",
2471
- "bytes": 341764,
2472
- "sha256": "1d48bec787cdb4a056cd98c0f40b54fadc70711299691c343dcf4db60672246b"
2471
+ "bytes": 343536,
2472
+ "sha256": "f8fe63875c5abce92281c4fce0fa329c3584a25a85c131ba2d0364ac39b78997"
2473
2473
  },
2474
2474
  {
2475
2475
  "path": "skills/loom-init/.loom-runtime/shared/scripts/loom_init.py",
@@ -3088,13 +3088,13 @@
3088
3088
  },
3089
3089
  {
3090
3090
  "path": "skills/loom-merge-ready/.loom-runtime/shared/scripts/loom_check.py",
3091
- "bytes": 362269,
3092
- "sha256": "451270ab050bc0b1522ae08d2c151dd704d711a41c5de5ba237d626b6d60ec1d"
3091
+ "bytes": 365681,
3092
+ "sha256": "e48281477bbb35b887e21034570ed519a40dae718ea97e99886a66b04dbd1d50"
3093
3093
  },
3094
3094
  {
3095
3095
  "path": "skills/loom-merge-ready/.loom-runtime/shared/scripts/loom_flow.py",
3096
- "bytes": 341764,
3097
- "sha256": "1d48bec787cdb4a056cd98c0f40b54fadc70711299691c343dcf4db60672246b"
3096
+ "bytes": 343536,
3097
+ "sha256": "f8fe63875c5abce92281c4fce0fa329c3584a25a85c131ba2d0364ac39b78997"
3098
3098
  },
3099
3099
  {
3100
3100
  "path": "skills/loom-merge-ready/.loom-runtime/shared/scripts/loom_init.py",
@@ -3708,13 +3708,13 @@
3708
3708
  },
3709
3709
  {
3710
3710
  "path": "skills/loom-pre-review/.loom-runtime/shared/scripts/loom_check.py",
3711
- "bytes": 362269,
3712
- "sha256": "451270ab050bc0b1522ae08d2c151dd704d711a41c5de5ba237d626b6d60ec1d"
3711
+ "bytes": 365681,
3712
+ "sha256": "e48281477bbb35b887e21034570ed519a40dae718ea97e99886a66b04dbd1d50"
3713
3713
  },
3714
3714
  {
3715
3715
  "path": "skills/loom-pre-review/.loom-runtime/shared/scripts/loom_flow.py",
3716
- "bytes": 341764,
3717
- "sha256": "1d48bec787cdb4a056cd98c0f40b54fadc70711299691c343dcf4db60672246b"
3716
+ "bytes": 343536,
3717
+ "sha256": "f8fe63875c5abce92281c4fce0fa329c3584a25a85c131ba2d0364ac39b78997"
3718
3718
  },
3719
3719
  {
3720
3720
  "path": "skills/loom-pre-review/.loom-runtime/shared/scripts/loom_init.py",
@@ -4328,13 +4328,13 @@
4328
4328
  },
4329
4329
  {
4330
4330
  "path": "skills/loom-resume/.loom-runtime/shared/scripts/loom_check.py",
4331
- "bytes": 362269,
4332
- "sha256": "451270ab050bc0b1522ae08d2c151dd704d711a41c5de5ba237d626b6d60ec1d"
4331
+ "bytes": 365681,
4332
+ "sha256": "e48281477bbb35b887e21034570ed519a40dae718ea97e99886a66b04dbd1d50"
4333
4333
  },
4334
4334
  {
4335
4335
  "path": "skills/loom-resume/.loom-runtime/shared/scripts/loom_flow.py",
4336
- "bytes": 341764,
4337
- "sha256": "1d48bec787cdb4a056cd98c0f40b54fadc70711299691c343dcf4db60672246b"
4336
+ "bytes": 343536,
4337
+ "sha256": "f8fe63875c5abce92281c4fce0fa329c3584a25a85c131ba2d0364ac39b78997"
4338
4338
  },
4339
4339
  {
4340
4340
  "path": "skills/loom-resume/.loom-runtime/shared/scripts/loom_init.py",
@@ -4948,13 +4948,13 @@
4948
4948
  },
4949
4949
  {
4950
4950
  "path": "skills/loom-retire/.loom-runtime/shared/scripts/loom_check.py",
4951
- "bytes": 362269,
4952
- "sha256": "451270ab050bc0b1522ae08d2c151dd704d711a41c5de5ba237d626b6d60ec1d"
4951
+ "bytes": 365681,
4952
+ "sha256": "e48281477bbb35b887e21034570ed519a40dae718ea97e99886a66b04dbd1d50"
4953
4953
  },
4954
4954
  {
4955
4955
  "path": "skills/loom-retire/.loom-runtime/shared/scripts/loom_flow.py",
4956
- "bytes": 341764,
4957
- "sha256": "1d48bec787cdb4a056cd98c0f40b54fadc70711299691c343dcf4db60672246b"
4956
+ "bytes": 343536,
4957
+ "sha256": "f8fe63875c5abce92281c4fce0fa329c3584a25a85c131ba2d0364ac39b78997"
4958
4958
  },
4959
4959
  {
4960
4960
  "path": "skills/loom-retire/.loom-runtime/shared/scripts/loom_init.py",
@@ -5568,13 +5568,13 @@
5568
5568
  },
5569
5569
  {
5570
5570
  "path": "skills/loom-review/.loom-runtime/shared/scripts/loom_check.py",
5571
- "bytes": 362269,
5572
- "sha256": "451270ab050bc0b1522ae08d2c151dd704d711a41c5de5ba237d626b6d60ec1d"
5571
+ "bytes": 365681,
5572
+ "sha256": "e48281477bbb35b887e21034570ed519a40dae718ea97e99886a66b04dbd1d50"
5573
5573
  },
5574
5574
  {
5575
5575
  "path": "skills/loom-review/.loom-runtime/shared/scripts/loom_flow.py",
5576
- "bytes": 341764,
5577
- "sha256": "1d48bec787cdb4a056cd98c0f40b54fadc70711299691c343dcf4db60672246b"
5576
+ "bytes": 343536,
5577
+ "sha256": "f8fe63875c5abce92281c4fce0fa329c3584a25a85c131ba2d0364ac39b78997"
5578
5578
  },
5579
5579
  {
5580
5580
  "path": "skills/loom-review/.loom-runtime/shared/scripts/loom_init.py",
@@ -6188,13 +6188,13 @@
6188
6188
  },
6189
6189
  {
6190
6190
  "path": "skills/loom-spec-review/.loom-runtime/shared/scripts/loom_check.py",
6191
- "bytes": 362269,
6192
- "sha256": "451270ab050bc0b1522ae08d2c151dd704d711a41c5de5ba237d626b6d60ec1d"
6191
+ "bytes": 365681,
6192
+ "sha256": "e48281477bbb35b887e21034570ed519a40dae718ea97e99886a66b04dbd1d50"
6193
6193
  },
6194
6194
  {
6195
6195
  "path": "skills/loom-spec-review/.loom-runtime/shared/scripts/loom_flow.py",
6196
- "bytes": 341764,
6197
- "sha256": "1d48bec787cdb4a056cd98c0f40b54fadc70711299691c343dcf4db60672246b"
6196
+ "bytes": 343536,
6197
+ "sha256": "f8fe63875c5abce92281c4fce0fa329c3584a25a85c131ba2d0364ac39b78997"
6198
6198
  },
6199
6199
  {
6200
6200
  "path": "skills/loom-spec-review/.loom-runtime/shared/scripts/loom_init.py",
@@ -4466,6 +4466,42 @@ def check_daily_execution_cli(root: Path) -> list[Failure]:
4466
4466
  elif payload.get("result") != "pass":
4467
4467
  failures.append(Failure("daily-execution-cli", "`installed spec review record allow` must pass"))
4468
4468
 
4469
+ spec_plan_path = positive_target / ".loom/specs/INIT-0001/plan.md"
4470
+ spec_plan_text = spec_plan_path.read_text(encoding="utf-8")
4471
+ spec_plan_path.unlink()
4472
+ try:
4473
+ payload, error = load_command_json(
4474
+ root,
4475
+ [
4476
+ "python3",
4477
+ str(install_root / "loom-spec-review" / "scripts" / "loom-spec-review.py"),
4478
+ "review",
4479
+ "record",
4480
+ "--target",
4481
+ str(positive_target),
4482
+ "--item",
4483
+ "INIT-0001",
4484
+ "--review-file",
4485
+ ".loom/reviews/INIT-0001.spec.json",
4486
+ "--decision",
4487
+ "allow",
4488
+ "--kind",
4489
+ "spec_review",
4490
+ "--summary",
4491
+ "Incomplete formal spec suite should not be approved.",
4492
+ "--reviewer",
4493
+ "loom-check",
4494
+ ],
4495
+ )
4496
+ if error:
4497
+ failures.append(Failure("daily-execution-cli", f"`installed incomplete spec review record` failed: {error}"))
4498
+ elif payload.get("result") != "block":
4499
+ failures.append(Failure("daily-execution-cli", "`installed incomplete spec review record` must block"))
4500
+ elif not any("plan.md" in str(item) for item in payload.get("missing_inputs", [])):
4501
+ failures.append(Failure("daily-execution-cli", "`installed incomplete spec review record` must name the missing plan.md"))
4502
+ finally:
4503
+ spec_plan_path.write_text(spec_plan_text, encoding="utf-8")
4504
+
4469
4505
  payload, error = load_command_json(
4470
4506
  root,
4471
4507
  [
@@ -7229,6 +7265,39 @@ def check_adversarial_adoption_fixture(root: Path) -> list[Failure]:
7229
7265
  else:
7230
7266
  failures.append(Failure("adversarial-adoption", "review shadow carrier fixture could not load review artifact"))
7231
7267
 
7268
+ unreadable_review_shadow_target = base / "unreadable-review-shadow"
7269
+ shutil.copytree(baseline, unreadable_review_shadow_target)
7270
+ (unreadable_review_shadow_target / ".loom/shadow/review-repo.json").write_text("{not-json", encoding="utf-8")
7271
+ run_command(
7272
+ root,
7273
+ ["git", "add", "-f", ".loom/shadow/review-repo.json"],
7274
+ cwd=unreadable_review_shadow_target,
7275
+ timeout_seconds=30,
7276
+ )
7277
+ run_command(
7278
+ root,
7279
+ ["git", "commit", "-m", "corrupt review shadow evidence"],
7280
+ cwd=unreadable_review_shadow_target,
7281
+ timeout_seconds=30,
7282
+ )
7283
+ unreadable_payload, unreadable_error = load_command_json(
7284
+ root,
7285
+ [
7286
+ "python3",
7287
+ str(unreadable_review_shadow_target / ".loom/bin/loom_flow.py"),
7288
+ "checkpoint",
7289
+ "merge",
7290
+ "--target",
7291
+ str(unreadable_review_shadow_target),
7292
+ "--item",
7293
+ "INIT-0001",
7294
+ ],
7295
+ )
7296
+ if unreadable_error:
7297
+ failures.append(Failure("adversarial-adoption", f"unreadable review shadow evidence must fail closed without crashing: {unreadable_error}"))
7298
+ elif unreadable_payload.get("result") == "pass":
7299
+ failures.append(Failure("adversarial-adoption", "unreadable review shadow evidence must fail closed instead of passing"))
7300
+
7232
7301
  invalid_review_schema_target = base / "invalid-review-schema"
7233
7302
  shutil.copytree(baseline, invalid_review_schema_target)
7234
7303
  invalid_review_payload = load_json_file(invalid_review_schema_target / review_path)
@@ -1489,7 +1489,10 @@ def shadow_evidence_paths_for_sources(target_root: Path, source_paths: set[str])
1489
1489
  relative = evidence_path.relative_to(target_root).as_posix()
1490
1490
  if relative == ".loom/shadow/shadow-parity.json":
1491
1491
  continue
1492
- payload = load_json_file(evidence_path)
1492
+ try:
1493
+ payload = load_json_file(evidence_path)
1494
+ except (OSError, ValueError, json.JSONDecodeError):
1495
+ continue
1493
1496
  if not isinstance(payload, dict):
1494
1497
  continue
1495
1498
  source_files = payload.get("source_files")
@@ -1509,10 +1512,13 @@ def allowed_post_review_carrier_paths(context: dict[str, Any], *review_paths: st
1509
1512
  allowed.update(shadow_evidence_paths_for_sources(context["target_root"], set(review_paths)))
1510
1513
  review_shadow_root = context["target_root"] / ".loom/shadow"
1511
1514
  if review_shadow_root.exists():
1512
- allowed.update(
1513
- evidence_path.relative_to(context["target_root"]).as_posix()
1514
- for evidence_path in sorted(review_shadow_root.glob("review-*.json"))
1515
- )
1515
+ for evidence_path in sorted(review_shadow_root.glob("review-*.json")):
1516
+ try:
1517
+ payload = load_json_file(evidence_path)
1518
+ except (OSError, ValueError, json.JSONDecodeError):
1519
+ continue
1520
+ if isinstance(payload, dict):
1521
+ allowed.add(evidence_path.relative_to(context["target_root"]).as_posix())
1516
1522
  return allowed
1517
1523
 
1518
1524
 
@@ -1535,6 +1541,16 @@ def formal_spec_path(context: dict[str, Any]) -> str | None:
1535
1541
  return None
1536
1542
 
1537
1543
 
1544
+ def formal_spec_suite_status(context: dict[str, Any]) -> tuple[dict[str, str], list[str]]:
1545
+ suite = spec_suite_paths(context)
1546
+ missing = [
1547
+ path
1548
+ for path in (suite["spec"], suite["plan"], suite["implementation_contract"])
1549
+ if not (context["target_root"] / path).is_file()
1550
+ ]
1551
+ return suite, missing
1552
+
1553
+
1538
1554
  def spec_suite_paths(context: dict[str, Any]) -> dict[str, str]:
1539
1555
  item_id = context["item_id"]
1540
1556
  candidates = [
@@ -1751,15 +1767,25 @@ def review_gate_payload(
1751
1767
 
1752
1768
 
1753
1769
  def spec_review_gate_payload(context: dict[str, Any]) -> dict[str, Any]:
1754
- spec_path = formal_spec_path(context)
1755
- return review_gate_payload(
1770
+ suite, missing_suite_paths = formal_spec_suite_status(context)
1771
+ spec_path = suite["spec"] if not missing_suite_paths else formal_spec_path(context)
1772
+ payload = review_gate_payload(
1756
1773
  context,
1757
1774
  review_path=default_spec_review_path(context["item_id"]),
1758
1775
  expected_kind="spec_review",
1759
1776
  gate_name="spec_review",
1760
- required=spec_path is not None,
1777
+ required=not missing_suite_paths,
1761
1778
  path_label=spec_path,
1762
1779
  )
1780
+ payload["formal_spec_suite"] = suite
1781
+ if missing_suite_paths:
1782
+ payload["result"] = "block"
1783
+ payload["summary"] = "spec review is blocked until the complete formal spec suite is present."
1784
+ payload["missing_inputs"] = [
1785
+ f"missing formal spec suite file: {path}" for path in missing_suite_paths
1786
+ ] + list(payload.get("missing_inputs", []))
1787
+ payload["fallback_to"] = "build"
1788
+ return payload
1763
1789
 
1764
1790
 
1765
1791
  def implementation_review_status_payload(context: dict[str, Any]) -> dict[str, Any]:
@@ -2107,7 +2133,7 @@ def build_review_flow_payload(
2107
2133
 
2108
2134
  build_payload = checkpoint_payload("build", context)
2109
2135
  governance_surface = build_governance_surface(target_root)
2110
- surface_name = "review" if operation == "review" else "spec_review"
2136
+ surface_name = "review"
2111
2137
  repo_specific_requirements = repo_specific_requirements_payload(
2112
2138
  governance_surface.get("repo_interface"),
2113
2139
  target_root=target_root,
@@ -4237,6 +4263,15 @@ def carrier_refresh_payload(target_root: Path, output_relative: str, expected_it
4237
4263
  for action in actions:
4238
4264
  if action.get("status") == "block":
4239
4265
  missing_inputs.extend(str(message) for message in action.get("missing_inputs", []))
4266
+ if runtime_state.get("result") != "pass":
4267
+ refreshable_runtime_drift = {
4268
+ f"bootstrap runtime artifact `{action.get('path')}` sha256 drifted"
4269
+ for action in actions
4270
+ if action.get("kind") is None and action.get("status") == "refresh-needed" and action.get("path")
4271
+ }
4272
+ for message in runtime_state.get("missing_inputs", []):
4273
+ if str(message) not in refreshable_runtime_drift:
4274
+ missing_inputs.append(f"runtime-state: {message}")
4240
4275
 
4241
4276
  review_status: dict[str, Any] = {"status": "not_checked"}
4242
4277
  if not context_errors:
@@ -6798,15 +6833,17 @@ def handle_review(args: argparse.Namespace) -> int:
6798
6833
  }
6799
6834
  )
6800
6835
  if args.decision == "allow" and args.kind == "spec_review":
6801
- spec_path = formal_spec_path(context)
6802
- if spec_path is None:
6836
+ _, missing_suite_paths = formal_spec_suite_status(context)
6837
+ if missing_suite_paths:
6803
6838
  return emit(
6804
6839
  {
6805
6840
  "command": "review",
6806
6841
  "operation": "record",
6807
6842
  "result": "block",
6808
- "summary": "spec review cannot be recorded as `allow` without a readable formal spec path.",
6809
- "missing_inputs": ["formal spec path"],
6843
+ "summary": "spec review cannot be recorded as `allow` without the complete formal spec suite.",
6844
+ "missing_inputs": [
6845
+ f"missing formal spec suite file: {path}" for path in missing_suite_paths
6846
+ ],
6810
6847
  "fallback_to": "build",
6811
6848
  "build_checkpoint": build_payload,
6812
6849
  }
@@ -4466,6 +4466,42 @@ def check_daily_execution_cli(root: Path) -> list[Failure]:
4466
4466
  elif payload.get("result") != "pass":
4467
4467
  failures.append(Failure("daily-execution-cli", "`installed spec review record allow` must pass"))
4468
4468
 
4469
+ spec_plan_path = positive_target / ".loom/specs/INIT-0001/plan.md"
4470
+ spec_plan_text = spec_plan_path.read_text(encoding="utf-8")
4471
+ spec_plan_path.unlink()
4472
+ try:
4473
+ payload, error = load_command_json(
4474
+ root,
4475
+ [
4476
+ "python3",
4477
+ str(install_root / "loom-spec-review" / "scripts" / "loom-spec-review.py"),
4478
+ "review",
4479
+ "record",
4480
+ "--target",
4481
+ str(positive_target),
4482
+ "--item",
4483
+ "INIT-0001",
4484
+ "--review-file",
4485
+ ".loom/reviews/INIT-0001.spec.json",
4486
+ "--decision",
4487
+ "allow",
4488
+ "--kind",
4489
+ "spec_review",
4490
+ "--summary",
4491
+ "Incomplete formal spec suite should not be approved.",
4492
+ "--reviewer",
4493
+ "loom-check",
4494
+ ],
4495
+ )
4496
+ if error:
4497
+ failures.append(Failure("daily-execution-cli", f"`installed incomplete spec review record` failed: {error}"))
4498
+ elif payload.get("result") != "block":
4499
+ failures.append(Failure("daily-execution-cli", "`installed incomplete spec review record` must block"))
4500
+ elif not any("plan.md" in str(item) for item in payload.get("missing_inputs", [])):
4501
+ failures.append(Failure("daily-execution-cli", "`installed incomplete spec review record` must name the missing plan.md"))
4502
+ finally:
4503
+ spec_plan_path.write_text(spec_plan_text, encoding="utf-8")
4504
+
4469
4505
  payload, error = load_command_json(
4470
4506
  root,
4471
4507
  [
@@ -7229,6 +7265,39 @@ def check_adversarial_adoption_fixture(root: Path) -> list[Failure]:
7229
7265
  else:
7230
7266
  failures.append(Failure("adversarial-adoption", "review shadow carrier fixture could not load review artifact"))
7231
7267
 
7268
+ unreadable_review_shadow_target = base / "unreadable-review-shadow"
7269
+ shutil.copytree(baseline, unreadable_review_shadow_target)
7270
+ (unreadable_review_shadow_target / ".loom/shadow/review-repo.json").write_text("{not-json", encoding="utf-8")
7271
+ run_command(
7272
+ root,
7273
+ ["git", "add", "-f", ".loom/shadow/review-repo.json"],
7274
+ cwd=unreadable_review_shadow_target,
7275
+ timeout_seconds=30,
7276
+ )
7277
+ run_command(
7278
+ root,
7279
+ ["git", "commit", "-m", "corrupt review shadow evidence"],
7280
+ cwd=unreadable_review_shadow_target,
7281
+ timeout_seconds=30,
7282
+ )
7283
+ unreadable_payload, unreadable_error = load_command_json(
7284
+ root,
7285
+ [
7286
+ "python3",
7287
+ str(unreadable_review_shadow_target / ".loom/bin/loom_flow.py"),
7288
+ "checkpoint",
7289
+ "merge",
7290
+ "--target",
7291
+ str(unreadable_review_shadow_target),
7292
+ "--item",
7293
+ "INIT-0001",
7294
+ ],
7295
+ )
7296
+ if unreadable_error:
7297
+ failures.append(Failure("adversarial-adoption", f"unreadable review shadow evidence must fail closed without crashing: {unreadable_error}"))
7298
+ elif unreadable_payload.get("result") == "pass":
7299
+ failures.append(Failure("adversarial-adoption", "unreadable review shadow evidence must fail closed instead of passing"))
7300
+
7232
7301
  invalid_review_schema_target = base / "invalid-review-schema"
7233
7302
  shutil.copytree(baseline, invalid_review_schema_target)
7234
7303
  invalid_review_payload = load_json_file(invalid_review_schema_target / review_path)
@@ -1489,7 +1489,10 @@ def shadow_evidence_paths_for_sources(target_root: Path, source_paths: set[str])
1489
1489
  relative = evidence_path.relative_to(target_root).as_posix()
1490
1490
  if relative == ".loom/shadow/shadow-parity.json":
1491
1491
  continue
1492
- payload = load_json_file(evidence_path)
1492
+ try:
1493
+ payload = load_json_file(evidence_path)
1494
+ except (OSError, ValueError, json.JSONDecodeError):
1495
+ continue
1493
1496
  if not isinstance(payload, dict):
1494
1497
  continue
1495
1498
  source_files = payload.get("source_files")
@@ -1509,10 +1512,13 @@ def allowed_post_review_carrier_paths(context: dict[str, Any], *review_paths: st
1509
1512
  allowed.update(shadow_evidence_paths_for_sources(context["target_root"], set(review_paths)))
1510
1513
  review_shadow_root = context["target_root"] / ".loom/shadow"
1511
1514
  if review_shadow_root.exists():
1512
- allowed.update(
1513
- evidence_path.relative_to(context["target_root"]).as_posix()
1514
- for evidence_path in sorted(review_shadow_root.glob("review-*.json"))
1515
- )
1515
+ for evidence_path in sorted(review_shadow_root.glob("review-*.json")):
1516
+ try:
1517
+ payload = load_json_file(evidence_path)
1518
+ except (OSError, ValueError, json.JSONDecodeError):
1519
+ continue
1520
+ if isinstance(payload, dict):
1521
+ allowed.add(evidence_path.relative_to(context["target_root"]).as_posix())
1516
1522
  return allowed
1517
1523
 
1518
1524
 
@@ -1535,6 +1541,16 @@ def formal_spec_path(context: dict[str, Any]) -> str | None:
1535
1541
  return None
1536
1542
 
1537
1543
 
1544
+ def formal_spec_suite_status(context: dict[str, Any]) -> tuple[dict[str, str], list[str]]:
1545
+ suite = spec_suite_paths(context)
1546
+ missing = [
1547
+ path
1548
+ for path in (suite["spec"], suite["plan"], suite["implementation_contract"])
1549
+ if not (context["target_root"] / path).is_file()
1550
+ ]
1551
+ return suite, missing
1552
+
1553
+
1538
1554
  def spec_suite_paths(context: dict[str, Any]) -> dict[str, str]:
1539
1555
  item_id = context["item_id"]
1540
1556
  candidates = [
@@ -1751,15 +1767,25 @@ def review_gate_payload(
1751
1767
 
1752
1768
 
1753
1769
  def spec_review_gate_payload(context: dict[str, Any]) -> dict[str, Any]:
1754
- spec_path = formal_spec_path(context)
1755
- return review_gate_payload(
1770
+ suite, missing_suite_paths = formal_spec_suite_status(context)
1771
+ spec_path = suite["spec"] if not missing_suite_paths else formal_spec_path(context)
1772
+ payload = review_gate_payload(
1756
1773
  context,
1757
1774
  review_path=default_spec_review_path(context["item_id"]),
1758
1775
  expected_kind="spec_review",
1759
1776
  gate_name="spec_review",
1760
- required=spec_path is not None,
1777
+ required=not missing_suite_paths,
1761
1778
  path_label=spec_path,
1762
1779
  )
1780
+ payload["formal_spec_suite"] = suite
1781
+ if missing_suite_paths:
1782
+ payload["result"] = "block"
1783
+ payload["summary"] = "spec review is blocked until the complete formal spec suite is present."
1784
+ payload["missing_inputs"] = [
1785
+ f"missing formal spec suite file: {path}" for path in missing_suite_paths
1786
+ ] + list(payload.get("missing_inputs", []))
1787
+ payload["fallback_to"] = "build"
1788
+ return payload
1763
1789
 
1764
1790
 
1765
1791
  def implementation_review_status_payload(context: dict[str, Any]) -> dict[str, Any]:
@@ -2107,7 +2133,7 @@ def build_review_flow_payload(
2107
2133
 
2108
2134
  build_payload = checkpoint_payload("build", context)
2109
2135
  governance_surface = build_governance_surface(target_root)
2110
- surface_name = "review" if operation == "review" else "spec_review"
2136
+ surface_name = "review"
2111
2137
  repo_specific_requirements = repo_specific_requirements_payload(
2112
2138
  governance_surface.get("repo_interface"),
2113
2139
  target_root=target_root,
@@ -4237,6 +4263,15 @@ def carrier_refresh_payload(target_root: Path, output_relative: str, expected_it
4237
4263
  for action in actions:
4238
4264
  if action.get("status") == "block":
4239
4265
  missing_inputs.extend(str(message) for message in action.get("missing_inputs", []))
4266
+ if runtime_state.get("result") != "pass":
4267
+ refreshable_runtime_drift = {
4268
+ f"bootstrap runtime artifact `{action.get('path')}` sha256 drifted"
4269
+ for action in actions
4270
+ if action.get("kind") is None and action.get("status") == "refresh-needed" and action.get("path")
4271
+ }
4272
+ for message in runtime_state.get("missing_inputs", []):
4273
+ if str(message) not in refreshable_runtime_drift:
4274
+ missing_inputs.append(f"runtime-state: {message}")
4240
4275
 
4241
4276
  review_status: dict[str, Any] = {"status": "not_checked"}
4242
4277
  if not context_errors:
@@ -6798,15 +6833,17 @@ def handle_review(args: argparse.Namespace) -> int:
6798
6833
  }
6799
6834
  )
6800
6835
  if args.decision == "allow" and args.kind == "spec_review":
6801
- spec_path = formal_spec_path(context)
6802
- if spec_path is None:
6836
+ _, missing_suite_paths = formal_spec_suite_status(context)
6837
+ if missing_suite_paths:
6803
6838
  return emit(
6804
6839
  {
6805
6840
  "command": "review",
6806
6841
  "operation": "record",
6807
6842
  "result": "block",
6808
- "summary": "spec review cannot be recorded as `allow` without a readable formal spec path.",
6809
- "missing_inputs": ["formal spec path"],
6843
+ "summary": "spec review cannot be recorded as `allow` without the complete formal spec suite.",
6844
+ "missing_inputs": [
6845
+ f"missing formal spec suite file: {path}" for path in missing_suite_paths
6846
+ ],
6810
6847
  "fallback_to": "build",
6811
6848
  "build_checkpoint": build_payload,
6812
6849
  }