@hunter-harness/workflow-harness 0.2.19 → 0.2.21
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.
- package/harness/bundles/general/claude-code/.harness-build.json +1 -1
- package/harness/bundles/general/claude-code/CONTEXT.md +20 -0
- package/harness/bundles/general/claude-code/harness-archive/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-plan/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-review/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-run/checklist.md +6 -0
- package/harness/bundles/general/claude-code/harness-submit/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-submit/checklist.md +8 -0
- package/harness/bundles/general/claude-code/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/harness-test/SKILL.md +1 -1
- package/harness/bundles/general/claude-code/protocols/model-routing-protocol.md +22 -0
- package/harness/bundles/general/claude-code/scripts/harness_events.py +159 -1
- package/harness/bundles/general/claude-code/scripts/harness_integration.py +34 -0
- package/harness/bundles/general/claude-code/scripts/harness_ledger.py +149 -9
- package/harness/bundles/general/claude-code/scripts/harness_migration_head.py +220 -0
- package/harness/bundles/general/codebuddy/.harness-build.json +1 -1
- package/harness/bundles/general/codebuddy/CONTEXT.md +20 -0
- package/harness/bundles/general/codebuddy/harness-archive/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-plan/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-review/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-run/checklist.md +6 -0
- package/harness/bundles/general/codebuddy/harness-submit/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-submit/checklist.md +8 -0
- package/harness/bundles/general/codebuddy/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/harness-test/SKILL.md +1 -1
- package/harness/bundles/general/codebuddy/protocols/model-routing-protocol.md +22 -0
- package/harness/bundles/general/codebuddy/scripts/harness_events.py +159 -1
- package/harness/bundles/general/codebuddy/scripts/harness_integration.py +34 -0
- package/harness/bundles/general/codebuddy/scripts/harness_ledger.py +149 -9
- package/harness/bundles/general/codebuddy/scripts/harness_migration_head.py +220 -0
- package/harness/bundles/general/codex/.harness-build.json +1 -1
- package/harness/bundles/general/codex/CONTEXT.md +20 -0
- package/harness/bundles/general/codex/harness-archive/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-plan/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-review/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-run/checklist.md +6 -0
- package/harness/bundles/general/codex/harness-submit/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-submit/checklist.md +8 -0
- package/harness/bundles/general/codex/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/codex/harness-test/SKILL.md +1 -1
- package/harness/bundles/general/codex/protocols/model-routing-protocol.md +22 -0
- package/harness/bundles/general/codex/scripts/harness_events.py +159 -1
- package/harness/bundles/general/codex/scripts/harness_integration.py +34 -0
- package/harness/bundles/general/codex/scripts/harness_ledger.py +149 -9
- package/harness/bundles/general/codex/scripts/harness_migration_head.py +220 -0
- package/harness/bundles/general/cursor/.harness-build.json +1 -1
- package/harness/bundles/general/cursor/CONTEXT.md +20 -0
- package/harness/bundles/general/cursor/harness-archive/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-plan/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-review/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-run/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-run/checklist.md +6 -0
- package/harness/bundles/general/cursor/harness-submit/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-submit/checklist.md +8 -0
- package/harness/bundles/general/cursor/harness-sync/SKILL.md +1 -1
- package/harness/bundles/general/cursor/harness-test/SKILL.md +1 -1
- package/harness/bundles/general/cursor/protocols/model-routing-protocol.md +22 -0
- package/harness/bundles/general/cursor/scripts/harness_events.py +159 -1
- package/harness/bundles/general/cursor/scripts/harness_integration.py +34 -0
- package/harness/bundles/general/cursor/scripts/harness_ledger.py +149 -9
- package/harness/bundles/general/cursor/scripts/harness_migration_head.py +220 -0
- package/harness/bundles/java/claude-code/.harness-build.json +1 -1
- package/harness/bundles/java/claude-code/CONTEXT.md +20 -0
- package/harness/bundles/java/claude-code/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-archive/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-package/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-plan/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-review/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-run/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-submit/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-submit/checklist.md +8 -0
- package/harness/bundles/java/claude-code/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/harness-test/SKILL.md +1 -1
- package/harness/bundles/java/claude-code/protocols/model-routing-protocol.md +22 -0
- package/harness/bundles/java/claude-code/scripts/harness_events.py +159 -1
- package/harness/bundles/java/claude-code/scripts/harness_integration.py +34 -0
- package/harness/bundles/java/claude-code/scripts/harness_ledger.py +149 -9
- package/harness/bundles/java/claude-code/scripts/harness_migration_head.py +220 -0
- package/harness/bundles/java/codebuddy/.harness-build.json +1 -1
- package/harness/bundles/java/codebuddy/CONTEXT.md +20 -0
- package/harness/bundles/java/codebuddy/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-archive/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-package/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-plan/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-review/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-run/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-submit/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-submit/checklist.md +8 -0
- package/harness/bundles/java/codebuddy/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/harness-test/SKILL.md +1 -1
- package/harness/bundles/java/codebuddy/protocols/model-routing-protocol.md +22 -0
- package/harness/bundles/java/codebuddy/scripts/harness_events.py +159 -1
- package/harness/bundles/java/codebuddy/scripts/harness_integration.py +34 -0
- package/harness/bundles/java/codebuddy/scripts/harness_ledger.py +149 -9
- package/harness/bundles/java/codebuddy/scripts/harness_migration_head.py +220 -0
- package/harness/bundles/java/codex/.harness-build.json +1 -1
- package/harness/bundles/java/codex/CONTEXT.md +20 -0
- package/harness/bundles/java/codex/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-archive/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-package/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-plan/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-review/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-run/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-submit/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-submit/checklist.md +8 -0
- package/harness/bundles/java/codex/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/codex/harness-test/SKILL.md +1 -1
- package/harness/bundles/java/codex/protocols/model-routing-protocol.md +22 -0
- package/harness/bundles/java/codex/scripts/harness_events.py +159 -1
- package/harness/bundles/java/codex/scripts/harness_integration.py +34 -0
- package/harness/bundles/java/codex/scripts/harness_ledger.py +149 -9
- package/harness/bundles/java/codex/scripts/harness_migration_head.py +220 -0
- package/harness/bundles/java/cursor/.harness-build.json +1 -1
- package/harness/bundles/java/cursor/CONTEXT.md +20 -0
- package/harness/bundles/java/cursor/harness-apidoc/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-archive/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-codebase-map/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-knowledge-ingest/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-knowledge-query/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-package/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-plan/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-review/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-run/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-submit/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-submit/checklist.md +8 -0
- package/harness/bundles/java/cursor/harness-sync/SKILL.md +1 -1
- package/harness/bundles/java/cursor/harness-test/SKILL.md +1 -1
- package/harness/bundles/java/cursor/protocols/model-routing-protocol.md +22 -0
- package/harness/bundles/java/cursor/scripts/harness_events.py +159 -1
- package/harness/bundles/java/cursor/scripts/harness_integration.py +34 -0
- package/harness/bundles/java/cursor/scripts/harness_ledger.py +149 -9
- package/harness/bundles/java/cursor/scripts/harness_migration_head.py +220 -0
- package/harness/manifests/general/claude-code.json +25 -17
- package/harness/manifests/general/codebuddy.json +25 -17
- package/harness/manifests/general/codex.json +25 -17
- package/harness/manifests/general/cursor.json +25 -17
- package/harness/manifests/java/claude-code.json +26 -18
- package/harness/manifests/java/codebuddy.json +26 -18
- package/harness/manifests/java/codex.json +26 -18
- package/harness/manifests/java/cursor.json +26 -18
- package/hunter-workflow-family.json +1 -1
- package/package.json +1 -1
|
@@ -28,6 +28,7 @@ if str(SCRIPTS_DIR) not in sys.path:
|
|
|
28
28
|
sys.path.insert(0, str(SCRIPTS_DIR))
|
|
29
29
|
|
|
30
30
|
import harness_paths # noqa: E402
|
|
31
|
+
import harness_profile # noqa: E402
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
if hasattr(sys.stdout, "reconfigure"):
|
|
@@ -534,18 +535,30 @@ def expand_profile_input_files(
|
|
|
534
535
|
) -> tuple[list[str], str | None]:
|
|
535
536
|
"""Expand verificationInputs[profile_input] globs from build-profile.json.
|
|
536
537
|
|
|
537
|
-
|
|
538
|
-
|
|
538
|
+
Profile is loaded via ``harness_profile.load_profile`` (C7: common_root then
|
|
539
|
+
execution overlay) so linked worktrees without a local build-profile still
|
|
540
|
+
reuse the main checkout profile. Globs remain relative to the execution
|
|
541
|
+
``project`` root (not common_root) so inputsHash tracks the tree under test.
|
|
542
|
+
|
|
543
|
+
Returns (files, error); error is None on success.
|
|
539
544
|
profile 缺失 / key 缺失 / glob 无匹配 / 结果为空 → 返回 ([], "<reason>"),
|
|
540
545
|
调用方据此返回 insufficient-evidence,执行全量测试但不允许缓存复用。
|
|
541
546
|
"""
|
|
542
|
-
|
|
543
|
-
if
|
|
547
|
+
profile = harness_profile.load_profile(Path(project))
|
|
548
|
+
if profile is None:
|
|
549
|
+
# load_profile swallows JSON errors; restore actionable unreadable diag
|
|
550
|
+
# when a profile file exists but cannot be parsed (review YELLOW-1).
|
|
551
|
+
project_root = Path(project).resolve()
|
|
552
|
+
common = harness_paths.common_root(project_root)
|
|
553
|
+
for root in (common, project_root):
|
|
554
|
+
candidate = root / ".harness" / "config" / "build-profile.json"
|
|
555
|
+
if not candidate.is_file():
|
|
556
|
+
continue
|
|
557
|
+
try:
|
|
558
|
+
json.loads(candidate.read_text(encoding="utf-8-sig"))
|
|
559
|
+
except (OSError, json.JSONDecodeError) as exc:
|
|
560
|
+
return [], f"build-profile.json unreadable: {exc}"
|
|
544
561
|
return [], "build-profile.json missing; run harness_preflight.py detect"
|
|
545
|
-
try:
|
|
546
|
-
profile = json.loads(profile_path.read_text(encoding="utf-8-sig"))
|
|
547
|
-
except (OSError, json.JSONDecodeError) as exc:
|
|
548
|
-
return [], f"build-profile.json unreadable: {exc}"
|
|
549
562
|
if not isinstance(profile, dict):
|
|
550
563
|
return [], "build-profile.json is not an object"
|
|
551
564
|
inputs = profile.get("verificationInputs")
|
|
@@ -555,7 +568,7 @@ def expand_profile_input_files(
|
|
|
555
568
|
if not isinstance(patterns, list) or not patterns:
|
|
556
569
|
return [], f"verificationInputs.{profile_input} is empty or invalid"
|
|
557
570
|
|
|
558
|
-
base = project.resolve()
|
|
571
|
+
base = Path(project).resolve()
|
|
559
572
|
seen: set[str] = set()
|
|
560
573
|
for pat in patterns:
|
|
561
574
|
if not isinstance(pat, str) or not pat.strip():
|
|
@@ -1042,6 +1055,7 @@ def decide_can_reuse(
|
|
|
1042
1055
|
requested_toolchain_hash: str | None = None,
|
|
1043
1056
|
requested_profile_hash: str | None = None,
|
|
1044
1057
|
requested_environment_hash: str | None = None,
|
|
1058
|
+
requested_db_schema_hash: str | None = None,
|
|
1045
1059
|
) -> dict[str, Any]:
|
|
1046
1060
|
ledger, ledger_path = load_ledger(change_dir)
|
|
1047
1061
|
if ledger is None:
|
|
@@ -1170,6 +1184,7 @@ def decide_can_reuse(
|
|
|
1170
1184
|
("toolchainHash", requested_toolchain_hash, "TOOLCHAIN_CHANGED"),
|
|
1171
1185
|
("profileHash", requested_profile_hash, "PROFILE_CHANGED"),
|
|
1172
1186
|
("environmentHash", requested_environment_hash, "ENVIRONMENT_CHANGED"),
|
|
1187
|
+
("dbSchemaHash", requested_db_schema_hash, "DB_SCHEMA_CHANGED"),
|
|
1173
1188
|
):
|
|
1174
1189
|
stored = entry.get(field)
|
|
1175
1190
|
if (
|
|
@@ -1236,6 +1251,7 @@ def decide_can_reuse(
|
|
|
1236
1251
|
"reuse": True,
|
|
1237
1252
|
"reason": "reuse",
|
|
1238
1253
|
"code": "REUSED",
|
|
1254
|
+
"invalidationCode": None,
|
|
1239
1255
|
"verification": verification,
|
|
1240
1256
|
"ledger_path": str(ledger_path) if ledger_path else None,
|
|
1241
1257
|
"inputsHash": stored_hash,
|
|
@@ -1245,6 +1261,90 @@ def decide_can_reuse(
|
|
|
1245
1261
|
}
|
|
1246
1262
|
|
|
1247
1263
|
|
|
1264
|
+
_INVALIDATION_ALIASES = {
|
|
1265
|
+
"INPUTS_HASH_CHANGED": "INPUT_CHANGED",
|
|
1266
|
+
"ENVIRONMENT_CHANGED": "ENV_CHANGED",
|
|
1267
|
+
"MISSING_FIELDS": "MISSING_IDENTITY_FIELD",
|
|
1268
|
+
"MISSING_V2_FIELDS": "MISSING_IDENTITY_FIELD",
|
|
1269
|
+
"LEDGER_MISSING": "MISSING_IDENTITY_FIELD",
|
|
1270
|
+
"VALIDATIONS_MISSING": "MISSING_IDENTITY_FIELD",
|
|
1271
|
+
"VALIDATION_MISSING": "MISSING_IDENTITY_FIELD",
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
def _attach_invalidation_code(payload: dict[str, Any]) -> dict[str, Any]:
|
|
1276
|
+
"""Wave-2 H-9: expose stable invalidationCode alongside legacy code."""
|
|
1277
|
+
if payload.get("reuse") is True:
|
|
1278
|
+
payload.setdefault("invalidationCode", None)
|
|
1279
|
+
return payload
|
|
1280
|
+
code = str(payload.get("code") or "").strip()
|
|
1281
|
+
if code:
|
|
1282
|
+
payload["invalidationCode"] = _INVALIDATION_ALIASES.get(code, code)
|
|
1283
|
+
return payload
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
def verification_graph_path(change_dir: Path) -> Path:
|
|
1287
|
+
return Path(change_dir) / "evidence" / "verification-graph.json"
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
def upsert_verification_graph_node(
|
|
1291
|
+
change_dir: Path,
|
|
1292
|
+
*,
|
|
1293
|
+
verification: str,
|
|
1294
|
+
status: str,
|
|
1295
|
+
inputs_hash: str,
|
|
1296
|
+
command: str | None = None,
|
|
1297
|
+
toolchain_hash: str | None = None,
|
|
1298
|
+
environment_hash: str | None = None,
|
|
1299
|
+
db_schema_hash: str | None = None,
|
|
1300
|
+
diff_hash: str | None = None,
|
|
1301
|
+
) -> dict[str, Any]:
|
|
1302
|
+
"""Persist a verification graph node keyed by canonical identity (H-9)."""
|
|
1303
|
+
path = verification_graph_path(change_dir)
|
|
1304
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
1305
|
+
graph: dict[str, Any]
|
|
1306
|
+
if path.is_file():
|
|
1307
|
+
try:
|
|
1308
|
+
loaded = json.loads(path.read_text(encoding="utf-8-sig"))
|
|
1309
|
+
graph = loaded if isinstance(loaded, dict) else {"schemaVersion": 1, "nodes": []}
|
|
1310
|
+
except (OSError, json.JSONDecodeError):
|
|
1311
|
+
graph = {"schemaVersion": 1, "nodes": []}
|
|
1312
|
+
else:
|
|
1313
|
+
graph = {"schemaVersion": 1, "nodes": []}
|
|
1314
|
+
nodes = graph.get("nodes")
|
|
1315
|
+
if not isinstance(nodes, list):
|
|
1316
|
+
nodes = []
|
|
1317
|
+
identity = {
|
|
1318
|
+
"verification": verification,
|
|
1319
|
+
"inputsHash": inputs_hash,
|
|
1320
|
+
"command": command,
|
|
1321
|
+
"toolchainHash": toolchain_hash,
|
|
1322
|
+
"environmentHash": environment_hash,
|
|
1323
|
+
"dbSchemaHash": db_schema_hash,
|
|
1324
|
+
"diffHash": diff_hash,
|
|
1325
|
+
}
|
|
1326
|
+
node = {
|
|
1327
|
+
"identity": identity,
|
|
1328
|
+
"status": status,
|
|
1329
|
+
"recordedAt": dt.datetime.now().astimezone().isoformat(timespec="milliseconds"),
|
|
1330
|
+
}
|
|
1331
|
+
replaced = False
|
|
1332
|
+
for index, existing in enumerate(nodes):
|
|
1333
|
+
if not isinstance(existing, dict):
|
|
1334
|
+
continue
|
|
1335
|
+
existing_id = existing.get("identity")
|
|
1336
|
+
if isinstance(existing_id, dict) and existing_id == identity:
|
|
1337
|
+
nodes[index] = node
|
|
1338
|
+
replaced = True
|
|
1339
|
+
break
|
|
1340
|
+
if not replaced:
|
|
1341
|
+
nodes.append(node)
|
|
1342
|
+
graph["schemaVersion"] = 1
|
|
1343
|
+
graph["nodes"] = nodes
|
|
1344
|
+
write_ledger(path, graph) # atomic json write helper already used for ledger
|
|
1345
|
+
return {"ok": True, "path": str(path), "nodeCount": len(nodes), "replaced": replaced}
|
|
1346
|
+
|
|
1347
|
+
|
|
1248
1348
|
def cmd_hash(args: argparse.Namespace) -> int:
|
|
1249
1349
|
as_json = bool(args.json)
|
|
1250
1350
|
try:
|
|
@@ -1317,10 +1417,12 @@ def cmd_can_reuse(args: argparse.Namespace) -> int:
|
|
|
1317
1417
|
requested_toolchain_hash=getattr(args, "toolchain_hash", None),
|
|
1318
1418
|
requested_profile_hash=getattr(args, "profile_hash", None),
|
|
1319
1419
|
requested_environment_hash=getattr(args, "environment_hash", None),
|
|
1420
|
+
requested_db_schema_hash=getattr(args, "db_schema_hash", None),
|
|
1320
1421
|
)
|
|
1321
1422
|
except (OSError, ValueError, json.JSONDecodeError) as exc:
|
|
1322
1423
|
return emit_error(f"can-reuse failed: {exc}", as_json=as_json)
|
|
1323
1424
|
|
|
1425
|
+
payload = _attach_invalidation_code(payload)
|
|
1324
1426
|
emit_compact_or_verbose(
|
|
1325
1427
|
payload, as_json=as_json, verbose=verbose,
|
|
1326
1428
|
compact_fn=_compact_can_reuse_payload,
|
|
@@ -1457,6 +1559,7 @@ def cmd_record(args: argparse.Namespace) -> int:
|
|
|
1457
1559
|
("toolchainHash", "toolchain_hash"),
|
|
1458
1560
|
("profileHash", "profile_hash"),
|
|
1459
1561
|
("environmentHash", "environment_hash"),
|
|
1562
|
+
("dbSchemaHash", "db_schema_hash"),
|
|
1460
1563
|
):
|
|
1461
1564
|
val = getattr(args, attr, None)
|
|
1462
1565
|
if _nonempty_str(val):
|
|
@@ -1535,6 +1638,37 @@ def cmd_record(args: argparse.Namespace) -> int:
|
|
|
1535
1638
|
extra={"missing": missing},
|
|
1536
1639
|
)
|
|
1537
1640
|
write_ledger(out_path, ledger)
|
|
1641
|
+
try:
|
|
1642
|
+
upsert_verification_graph_node(
|
|
1643
|
+
change_dir,
|
|
1644
|
+
verification=verification,
|
|
1645
|
+
status=str(status),
|
|
1646
|
+
inputs_hash=str(inputs_hash),
|
|
1647
|
+
command=str(entry.get("command") or "") or None,
|
|
1648
|
+
toolchain_hash=(
|
|
1649
|
+
str(entry.get("toolchainHash")).strip()
|
|
1650
|
+
if _nonempty_str(entry.get("toolchainHash"))
|
|
1651
|
+
else None
|
|
1652
|
+
),
|
|
1653
|
+
environment_hash=(
|
|
1654
|
+
str(entry.get("environmentHash")).strip()
|
|
1655
|
+
if _nonempty_str(entry.get("environmentHash"))
|
|
1656
|
+
else None
|
|
1657
|
+
),
|
|
1658
|
+
db_schema_hash=(
|
|
1659
|
+
str(entry.get("dbSchemaHash")).strip()
|
|
1660
|
+
if _nonempty_str(entry.get("dbSchemaHash"))
|
|
1661
|
+
else None
|
|
1662
|
+
),
|
|
1663
|
+
diff_hash=(
|
|
1664
|
+
str(ledger.get("diffHash")).strip()
|
|
1665
|
+
if _nonempty_str(ledger.get("diffHash"))
|
|
1666
|
+
else None
|
|
1667
|
+
),
|
|
1668
|
+
)
|
|
1669
|
+
except (OSError, ValueError, TypeError):
|
|
1670
|
+
# Graph is advisory persistence; ledger write already succeeded.
|
|
1671
|
+
pass
|
|
1538
1672
|
except (OSError, ValueError, FileNotFoundError, json.JSONDecodeError) as exc:
|
|
1539
1673
|
return emit_error(f"record failed: {exc}", as_json=as_json)
|
|
1540
1674
|
|
|
@@ -1654,6 +1788,11 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1654
1788
|
default=None,
|
|
1655
1789
|
help="optional environment hash to compare against ledger entry (UT-017)",
|
|
1656
1790
|
)
|
|
1791
|
+
p_reuse.add_argument(
|
|
1792
|
+
"--db-schema-hash",
|
|
1793
|
+
default=None,
|
|
1794
|
+
help="optional DB schema hash to compare against ledger entry (H-9)",
|
|
1795
|
+
)
|
|
1657
1796
|
p_reuse.add_argument(
|
|
1658
1797
|
"--verbose",
|
|
1659
1798
|
action="store_true",
|
|
@@ -1695,6 +1834,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1695
1834
|
p_record.add_argument("--toolchain-hash", default=None)
|
|
1696
1835
|
p_record.add_argument("--profile-hash", default=None)
|
|
1697
1836
|
p_record.add_argument("--environment-hash", default=None)
|
|
1837
|
+
p_record.add_argument("--db-schema-hash", default=None)
|
|
1698
1838
|
p_record.add_argument("--deploy-artifact", default=None, help="package: built artifact path")
|
|
1699
1839
|
p_record.add_argument("--artifact-hash", default=None, help="package: artifact sha256")
|
|
1700
1840
|
p_record.add_argument(
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Migration head single-source consistency check (Wave-2 H-7).
|
|
3
|
+
|
|
4
|
+
Canonical file (default ``.harness/config/migration-head.json``)::
|
|
5
|
+
|
|
6
|
+
{
|
|
7
|
+
"schemaVersion": 1,
|
|
8
|
+
"head": "005_example",
|
|
9
|
+
"sources": [
|
|
10
|
+
{"path": "backend/app/config.py", "pattern": "EXPECTED_ALEMBIC_HEAD\\s*=\\s*[\\\"']([^\\\"']+)[\\\"']"},
|
|
11
|
+
{"path": "integration/manifest.json", "jsonPointer": "/migrationHead"}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
Each source must resolve to the same ``head`` value. This harness repo may not
|
|
16
|
+
ship alembic; consumer projects declare the canonical file and run::
|
|
17
|
+
|
|
18
|
+
python harness_migration_head.py check --project . --json
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
import argparse
|
|
24
|
+
import json
|
|
25
|
+
import re
|
|
26
|
+
import sys
|
|
27
|
+
from pathlib import Path
|
|
28
|
+
from typing import Any
|
|
29
|
+
|
|
30
|
+
DEFAULT_REL = ".harness/config/migration-head.json"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def emit_json(payload: dict[str, Any], *, as_json: bool) -> None:
|
|
34
|
+
if as_json:
|
|
35
|
+
sys.stdout.write(json.dumps(payload, ensure_ascii=False, indent=2) + "\n")
|
|
36
|
+
else:
|
|
37
|
+
code = payload.get("code") or ("OK" if payload.get("ok") else "FAIL")
|
|
38
|
+
sys.stdout.write(f"{code}\n")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def emit_error(code: str, message: str, *, as_json: bool, extra: dict[str, Any] | None = None) -> int:
|
|
42
|
+
payload: dict[str, Any] = {"ok": False, "code": code, "message": message}
|
|
43
|
+
if extra:
|
|
44
|
+
payload.update(extra)
|
|
45
|
+
stream = sys.stdout if as_json else sys.stderr
|
|
46
|
+
if as_json:
|
|
47
|
+
stream.write(json.dumps(payload, ensure_ascii=False, indent=2) + "\n")
|
|
48
|
+
else:
|
|
49
|
+
stream.write(f"{code}: {message}\n")
|
|
50
|
+
return 1
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _read_json_pointer(data: Any, pointer: str) -> Any:
|
|
54
|
+
if not pointer.startswith("/"):
|
|
55
|
+
raise ValueError(f"jsonPointer must start with /: {pointer}")
|
|
56
|
+
cur = data
|
|
57
|
+
for part in pointer.lstrip("/").split("/"):
|
|
58
|
+
part = part.replace("~1", "/").replace("~0", "~")
|
|
59
|
+
if isinstance(cur, dict) and part in cur:
|
|
60
|
+
cur = cur[part]
|
|
61
|
+
else:
|
|
62
|
+
raise KeyError(pointer)
|
|
63
|
+
return cur
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _extract_source(project: Path, source: dict[str, Any]) -> str:
|
|
67
|
+
rel = str(source.get("path") or "").strip().replace("\\", "/")
|
|
68
|
+
if not rel or rel.startswith("/") or ".." in rel.split("/"):
|
|
69
|
+
raise ValueError(f"invalid source path: {rel}")
|
|
70
|
+
target = (project / rel).resolve()
|
|
71
|
+
try:
|
|
72
|
+
target.relative_to(project.resolve())
|
|
73
|
+
except ValueError as exc:
|
|
74
|
+
raise ValueError(f"source escapes project: {rel}") from exc
|
|
75
|
+
if not target.is_file():
|
|
76
|
+
raise FileNotFoundError(rel)
|
|
77
|
+
text = target.read_text(encoding="utf-8-sig")
|
|
78
|
+
if "jsonPointer" in source and source["jsonPointer"]:
|
|
79
|
+
data = json.loads(text)
|
|
80
|
+
value = _read_json_pointer(data, str(source["jsonPointer"]))
|
|
81
|
+
if value is None or (isinstance(value, str) and not value.strip()):
|
|
82
|
+
raise ValueError(f"empty value at {source['jsonPointer']} in {rel}")
|
|
83
|
+
return str(value).strip()
|
|
84
|
+
pattern = str(source.get("pattern") or "").strip()
|
|
85
|
+
if not pattern:
|
|
86
|
+
raise ValueError(f"source {rel} requires pattern or jsonPointer")
|
|
87
|
+
match = re.search(pattern, text, flags=re.MULTILINE)
|
|
88
|
+
if not match:
|
|
89
|
+
raise ValueError(f"pattern did not match in {rel}")
|
|
90
|
+
return str(match.group(1) if match.lastindex else match.group(0)).strip()
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def check_migration_head(
|
|
94
|
+
project: Path,
|
|
95
|
+
*,
|
|
96
|
+
config_rel: str = DEFAULT_REL,
|
|
97
|
+
) -> dict[str, Any]:
|
|
98
|
+
project = project.resolve()
|
|
99
|
+
config_path = (project / config_rel).resolve()
|
|
100
|
+
try:
|
|
101
|
+
config_path.relative_to(project)
|
|
102
|
+
except ValueError:
|
|
103
|
+
return {
|
|
104
|
+
"ok": False,
|
|
105
|
+
"code": "MIGRATION_HEAD_CONFIG_ESCAPE",
|
|
106
|
+
"message": f"config path escapes project: {config_rel}",
|
|
107
|
+
}
|
|
108
|
+
if not config_path.is_file():
|
|
109
|
+
return {
|
|
110
|
+
"ok": False,
|
|
111
|
+
"code": "MIGRATION_HEAD_MISSING",
|
|
112
|
+
"message": f"canonical migration-head file missing: {config_rel}",
|
|
113
|
+
"configPath": str(config_path),
|
|
114
|
+
}
|
|
115
|
+
try:
|
|
116
|
+
data = json.loads(config_path.read_text(encoding="utf-8-sig"))
|
|
117
|
+
except (OSError, json.JSONDecodeError) as exc:
|
|
118
|
+
return {
|
|
119
|
+
"ok": False,
|
|
120
|
+
"code": "MIGRATION_HEAD_UNREADABLE",
|
|
121
|
+
"message": str(exc),
|
|
122
|
+
"configPath": str(config_path),
|
|
123
|
+
}
|
|
124
|
+
if not isinstance(data, dict) or data.get("schemaVersion") != 1:
|
|
125
|
+
return {
|
|
126
|
+
"ok": False,
|
|
127
|
+
"code": "MIGRATION_HEAD_SCHEMA_INVALID",
|
|
128
|
+
"message": "migration-head.json must be schemaVersion 1 object",
|
|
129
|
+
"configPath": str(config_path),
|
|
130
|
+
}
|
|
131
|
+
head = str(data.get("head") or "").strip()
|
|
132
|
+
sources = data.get("sources")
|
|
133
|
+
if not head:
|
|
134
|
+
return {
|
|
135
|
+
"ok": False,
|
|
136
|
+
"code": "MIGRATION_HEAD_EMPTY",
|
|
137
|
+
"message": "head must be a non-empty string",
|
|
138
|
+
"configPath": str(config_path),
|
|
139
|
+
}
|
|
140
|
+
if not isinstance(sources, list) or not sources:
|
|
141
|
+
return {
|
|
142
|
+
"ok": False,
|
|
143
|
+
"code": "MIGRATION_HEAD_SOURCES_EMPTY",
|
|
144
|
+
"message": "sources must be a non-empty array",
|
|
145
|
+
"configPath": str(config_path),
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
observed: list[dict[str, Any]] = []
|
|
149
|
+
drifts: list[dict[str, Any]] = []
|
|
150
|
+
for index, source in enumerate(sources):
|
|
151
|
+
if not isinstance(source, dict):
|
|
152
|
+
return {
|
|
153
|
+
"ok": False,
|
|
154
|
+
"code": "MIGRATION_HEAD_SOURCE_INVALID",
|
|
155
|
+
"message": f"sources[{index}] must be an object",
|
|
156
|
+
}
|
|
157
|
+
try:
|
|
158
|
+
value = _extract_source(project, source)
|
|
159
|
+
except (OSError, ValueError, KeyError, json.JSONDecodeError) as exc:
|
|
160
|
+
return {
|
|
161
|
+
"ok": False,
|
|
162
|
+
"code": "MIGRATION_HEAD_SOURCE_UNREADABLE",
|
|
163
|
+
"message": str(exc),
|
|
164
|
+
"index": index,
|
|
165
|
+
"path": source.get("path"),
|
|
166
|
+
}
|
|
167
|
+
item = {"path": source.get("path"), "value": value}
|
|
168
|
+
observed.append(item)
|
|
169
|
+
if value != head:
|
|
170
|
+
drifts.append({**item, "expected": head})
|
|
171
|
+
|
|
172
|
+
if drifts:
|
|
173
|
+
return {
|
|
174
|
+
"ok": False,
|
|
175
|
+
"code": "MIGRATION_HEAD_DRIFT",
|
|
176
|
+
"message": "one or more sources disagree with canonical head",
|
|
177
|
+
"head": head,
|
|
178
|
+
"drifts": drifts,
|
|
179
|
+
"observed": observed,
|
|
180
|
+
"configPath": str(config_path),
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
"ok": True,
|
|
184
|
+
"code": "MIGRATION_HEAD_OK",
|
|
185
|
+
"head": head,
|
|
186
|
+
"observed": observed,
|
|
187
|
+
"configPath": str(config_path),
|
|
188
|
+
"sourceCount": len(observed),
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
193
|
+
parser = argparse.ArgumentParser(prog="harness_migration_head.py")
|
|
194
|
+
sub = parser.add_subparsers(dest="command", required=True)
|
|
195
|
+
check = sub.add_parser("check", help="verify sources match canonical head")
|
|
196
|
+
check.add_argument("--project", required=True)
|
|
197
|
+
check.add_argument("--config", default=DEFAULT_REL)
|
|
198
|
+
check.add_argument("--json", action="store_true")
|
|
199
|
+
return parser
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def main(argv: list[str] | None = None) -> int:
|
|
203
|
+
args = build_parser().parse_args(argv)
|
|
204
|
+
as_json = bool(getattr(args, "json", False))
|
|
205
|
+
if args.command == "check":
|
|
206
|
+
result = check_migration_head(Path(args.project), config_rel=str(args.config))
|
|
207
|
+
if not result.get("ok"):
|
|
208
|
+
return emit_error(
|
|
209
|
+
str(result.get("code") or "MIGRATION_HEAD_FAIL"),
|
|
210
|
+
str(result.get("message") or "check failed"),
|
|
211
|
+
as_json=as_json,
|
|
212
|
+
extra={k: v for k, v in result.items() if k not in {"ok", "code", "message"}},
|
|
213
|
+
)
|
|
214
|
+
emit_json(result, as_json=as_json)
|
|
215
|
+
return 0
|
|
216
|
+
return emit_error("UNKNOWN_COMMAND", f"unknown command: {args.command}", as_json=as_json)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
if __name__ == "__main__":
|
|
220
|
+
raise SystemExit(main())
|
|
@@ -48,6 +48,26 @@ _Avoid_: 每次重新探测, skill 内硬编码项目参数
|
|
|
48
48
|
一项验证(compile/install/unitTest/apiTest)所依赖源文件集合的内容哈希。指纹一致且证据完整才允许 🔁REUSED;无法证明即保守重跑。
|
|
49
49
|
_Avoid_: 仅凭 diffHash 复用, 无证据跳过
|
|
50
50
|
|
|
51
|
+
**验证图(verification graph)**:
|
|
52
|
+
`evidence/verification-graph.json` 按 canonical identity 持久化验证节点;`can-reuse` 返回 `invalidationCode`(如 `INPUT_CHANGED`);profile `mergeVerification.requiredOnMerge` 进入 integration verify。详见 ledger / integration 脚本。
|
|
53
|
+
_Avoid_: 冻结后无因重跑全量
|
|
54
|
+
|
|
55
|
+
**Migration head 单源**:
|
|
56
|
+
消费项目用 `.harness/config/migration-head.json` 声明 canonical head 与联动 sources;`harness_migration_head.py check` 做静态一致性门禁。
|
|
57
|
+
_Avoid_: config/CI/manifest 多处手写 head
|
|
58
|
+
|
|
59
|
+
**事件批处理**:
|
|
60
|
+
同阶段多事件用 `harness_events.py batch-append`(单锁多行);`phase.end` 仍走单次 append。
|
|
61
|
+
_Avoid_: 机械事件逐条起进程
|
|
62
|
+
|
|
63
|
+
**能力级模型路由**:
|
|
64
|
+
任务用 `economy` / `balanced` / `frontier` 表述;禁止在通用 harness 规则硬编码供应商模型名。详见 `protocols/model-routing-protocol.md`。
|
|
65
|
+
_Avoid_: skill 内写死 claude-/gpt- 模型 id
|
|
66
|
+
|
|
67
|
+
**Overlay 所有权**:
|
|
68
|
+
Bundle 安装目标由安装器管理;项目自有配置放 `.harness/project-overlay/`(或 project.yaml 侧)。`--force-managed` 必须配合 `--yes`/`--confirmed`,冲突 fail closed。
|
|
69
|
+
_Avoid_: 静默 force-managed
|
|
70
|
+
|
|
51
71
|
**服务会话**:
|
|
52
72
|
`runtime/service-session.json` 记录的 AI 启动服务生命周期。指纹匹配静默复用、不匹配自动重启、归档收尾统一停止;只有用户自启服务占端口才询问。
|
|
53
73
|
_Avoid_: 每轮测试后必杀服务
|
|
@@ -3,7 +3,7 @@ name: harness-archive
|
|
|
3
3
|
description: 归档所有变更产出(计划/测试报告/审查/SQL/API文档)到
|
|
4
4
|
.harness/archive/,含归档元数据和可视化最终总结。使用场景:归档、完成归档、收尾、打包产出物
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=7996938abca24d16; overlay=none; agent=codebuddy; do not edit -->
|
|
7
7
|
# harness-archive — 变更归档
|
|
8
8
|
|
|
9
9
|
## Purpose
|
|
@@ -3,7 +3,7 @@ name: harness-codebase-map
|
|
|
3
3
|
description: 分析现有代码库并生成 .harness/codebase/map/
|
|
4
4
|
下的结构化代码库地图。用于陌生项目理解、重大改造前梳理、harness-sync 提示 map 过期后的人工刷新。
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=7996938abca24d16; overlay=none; agent=codebuddy; do not edit -->
|
|
7
7
|
# harness-codebase-map — 代码库地图
|
|
8
8
|
|
|
9
9
|
## Purpose
|
|
@@ -3,7 +3,7 @@ name: harness-knowledge-ingest
|
|
|
3
3
|
description: 从 .harness/archive 归档整理、同步和维护项目知识索引。适用场景:ingest knowledge、sync
|
|
4
4
|
knowledge、rebuild knowledge index、promote knowledge、确认知识条目、检查知识库是否过期。
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=7996938abca24d16; overlay=none; agent=codebuddy; do not edit -->
|
|
7
7
|
# harness-knowledge-ingest
|
|
8
8
|
|
|
9
9
|
从 `.harness/archive/**/reports/final/summary-data.json` 抽取项目知识,生成并维护本地 `.harness/knowledge/` 索引。
|
|
@@ -3,7 +3,7 @@ name: harness-knowledge-query
|
|
|
3
3
|
description: 根据新需求、设计任务、代码修改请求或问题排查,在规划和编码前查询 .harness/knowledge
|
|
4
4
|
历史上下文。适用场景:query knowledge、查找历史需求、根据归档理解需求、继续之前类似开发、生成需求上下文包。
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=7996938abca24d16; overlay=none; agent=codebuddy; do not edit -->
|
|
7
7
|
# harness-knowledge-query
|
|
8
8
|
|
|
9
9
|
并行 change 中查询必须传 `--change <change-id>`;成功后以该 change 的 `meta/knowledge-context.json` 为稳定指针。全局 `context-packs/latest.json` 仅向后兼容,不得用于判断多个 active change 的上下文归属。
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: harness-plan
|
|
3
3
|
description: 将需求转化为设计文档+实施计划+完整测试场景表,必须在编码前完成。使用场景:需求分析、feature plan、技术方案设计、实现方案规划
|
|
4
4
|
---
|
|
5
|
-
<!-- generated by harness_deploy.py; core=
|
|
5
|
+
<!-- generated by harness_deploy.py; core=7996938abca24d16; overlay=none; agent=codebuddy; do not edit -->
|
|
6
6
|
# harness-plan — 需求规划
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
@@ -3,7 +3,7 @@ name: harness-review
|
|
|
3
3
|
description: 6维度代码审查(架构/安全/规范/兼容/测试/性能),对照项目规则(见
|
|
4
4
|
.harness/context-index.json)和测试场景表,在隔离上下文运行。使用场景:代码审查、提交前检查、合并评审
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=7996938abca24d16; overlay=none; agent=codebuddy; do not edit -->
|
|
7
7
|
# harness-review — 代码审查
|
|
8
8
|
|
|
9
9
|
## Purpose
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: harness-run
|
|
3
3
|
description: 按变更簇执行 TDD 编码循环(RED→GREEN→REFACTOR→编译验证),逐变更簇实现计划中的任务。使用场景:开始编码、实现功能、写代码、TDD 编码
|
|
4
4
|
---
|
|
5
|
-
<!-- generated by harness_deploy.py; core=
|
|
5
|
+
<!-- generated by harness_deploy.py; core=7996938abca24d16; overlay=none; agent=codebuddy; do not edit -->
|
|
6
6
|
# harness-run — 需求编码
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
@@ -267,3 +267,9 @@ description: harness-run 的执行检查清单。仅在编码执行时读取。
|
|
|
267
267
|
- [ ] 如果新增筛选参数,设计中已明确非法值行为
|
|
268
268
|
- [ ] 如果采用“忽略并不过滤”,必须有用户确认记录
|
|
269
269
|
- [ ] 测试场景覆盖非法值
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
## Wave-2 — Migration head(H-7)
|
|
273
|
+
|
|
274
|
+
- [ ] 若变更触及 alembic/versions 或项目约定 migration 路径:列出 config / CI / env / manifest 联动文件
|
|
275
|
+
- [ ] 消费项目存在 .harness/config/migration-head.json 时,跑 harness_migration_head.py check --project . --json
|
|
@@ -3,7 +3,7 @@ name: harness-submit
|
|
|
3
3
|
description: 最终提交封装:验证→中文 commit→提交/推送;worktree 模式含 --no-ff
|
|
4
4
|
合并回主分支。使用场景:提交代码、commit、push、合并分支、merge to main、完成开发
|
|
5
5
|
---
|
|
6
|
-
<!-- generated by harness_deploy.py; core=
|
|
6
|
+
<!-- generated by harness_deploy.py; core=7996938abca24d16; overlay=none; agent=codebuddy; do not edit -->
|
|
7
7
|
# harness-submit — 最终提交(含 worktree 合并)
|
|
8
8
|
|
|
9
9
|
## Purpose
|
|
@@ -369,6 +369,8 @@ powershell.exe -Command "python harness/scripts/harness_check_gate.py --write"
|
|
|
369
369
|
|
|
370
370
|
### 步骤 M5:push
|
|
371
371
|
|
|
372
|
+
**硬门槛(eslint × feature worktree)**:integration / 主仓 `pre-push` 跑 `npm run check` 时,eslint 不得把 sibling `.worktrees/<change>/` 当成第二工程根(双 `tsconfigRootDir`)。本仓以 `eslint.config.mjs` 的 `.worktrees/**` ignore 为准;若自定义 eslint 未 ignore,须先 `move_agent_to_root(<projectRoot>)` 再清 feature worktree,再 push。
|
|
373
|
+
|
|
372
374
|
```powershell
|
|
373
375
|
python harness/scripts/harness_integration.py push --change <change-name> --run-id <run-id> --feature-branch harness/<change-name> --target-branch <主分支> --temp-root <task-temp>
|
|
374
376
|
```
|
|
@@ -418,3 +420,9 @@ ledger 顶层写入 `"mergeFinalHash": "<journal pushedHead>"`;经 `harness_ga
|
|
|
418
420
|
- worktree: 已清理(迁根后)
|
|
419
421
|
- 下一步: `/harness-archive`
|
|
420
422
|
```
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
## Wave-2 — 验证复用与 merge 面(H-9)
|
|
426
|
+
|
|
427
|
+
- [ ] 代码冻结后,同 identity 的 unitTestFull 须 can-reuse;禁止无 invalidationCode 整套重跑
|
|
428
|
+
- [ ] integration verify 会合并 profile mergeVerification.requiredOnMerge(若配置)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: harness-sync
|
|
3
3
|
description: 检查并更新项目AI元数据(CodeGraph索引、harness-codebase-map分析、CLAUDE.md、AGENTS.md、.harness/完整性),确保Claude对代码库的理解与最新代码一致。当用户说'同步/更新索引/刷新元数据/检查一致性'时使用
|
|
4
4
|
---
|
|
5
|
-
<!-- generated by harness_deploy.py; core=
|
|
5
|
+
<!-- generated by harness_deploy.py; core=7996938abca24d16; overlay=none; agent=codebuddy; do not edit -->
|
|
6
6
|
# harness-sync — 元数据同步
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: harness-test
|
|
3
3
|
description: 测试执行:读取场景表,执行单元测试+API接口测试+数据兼容验证,输出测试报告。当用户说'跑测试/验证/跑用例/接口测试/单元测试'时使用
|
|
4
4
|
---
|
|
5
|
-
<!-- generated by harness_deploy.py; core=
|
|
5
|
+
<!-- generated by harness_deploy.py; core=7996938abca24d16; overlay=none; agent=codebuddy; do not edit -->
|
|
6
6
|
# harness-test — 测试执行
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# model-routing-protocol — 能力级模型路由(Wave-2 H-16)
|
|
2
|
+
|
|
3
|
+
> 本协议定义 **economy / balanced / frontier** 三档能力级。通用 Harness 规则与 skill **禁止**硬编码供应商模型名(如 `claude-*`、`gpt-*`、`gemini-*`)。宿主把能力级映射到具体模型;映射表属于项目/宿主配置,不属于本协议正文。
|
|
4
|
+
|
|
5
|
+
## 能力级
|
|
6
|
+
|
|
7
|
+
| 级别 | 适用任务 | 示例 |
|
|
8
|
+
|------|----------|------|
|
|
9
|
+
| `economy` | 机械提取、日志压缩、等待监控、格式化摘要 | 解析测试输出行、压缩长日志、轮询服务就绪 |
|
|
10
|
+
| `balanced` | 常规实现、常规修复、常规文档修订 | 按 plan 实现 CRUD、修 YELLOW、补 checklist |
|
|
11
|
+
| `frontier` | 架构取舍、安全/并发/迁移、最终审查、高风险判断 | 设计审批、RED 安全项、schema 迁移方案、merge 前终审 |
|
|
12
|
+
|
|
13
|
+
## 路由规则
|
|
14
|
+
|
|
15
|
+
1. Skill/任务描述用能力级(`--capability economy|balanced|frontier` 或文案「本任务=frontier」),不写供应商模型 id。
|
|
16
|
+
2. 宿主或 `HUNTER_HARNESS_MODEL` 仅作**遥测**(`executor_model`),不得反过来驱动通用规则分支。
|
|
17
|
+
3. **降级**(frontier→balanced→economy)必须由确定性命令结果或更高能力审查验收;不得用更低能力级的模型输出替代测试/门禁证据。
|
|
18
|
+
4. 无法映射某能力级时:fail closed,列出可用级别,禁止静默落到未知模型。
|
|
19
|
+
|
|
20
|
+
## 与验证的关系
|
|
21
|
+
|
|
22
|
+
能力级不改变 ledger / can-reuse / verification graph 合同。模型便宜不能成为跳过 `unitTestFull` 或忽略 `requiredOnMerge` 的理由。
|