From 1fb319ab3a98f6da2a1eadecbcdbf6c5bec813ca Mon Sep 17 00:00:00 2001 From: Bo Date: Fri, 29 May 2026 21:43:16 -0400 Subject: [PATCH] =?UTF-8?q?fix(skill-builder):=20scaffold=20regenerates=20?= =?UTF-8?q?registry.json=20=E2=80=94=20the=205th=20one-shot-green=20surfac?= =?UTF-8?q?e=20(ag-ekyq)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit init.sh's new-skill plumbing wired 4 of the 5 derived surfaces (dispositions, narrative counts, codex override-catalog) but NOT the registry.json SKU catalog. A stale registry.json trips contracts-sync ("registry.json is stale") AND correctness(ubuntu) ("SKU_CATALOG: DRIFT") together — it cost /burndown #600 a 2nd fix-and-repush (22a0af2f) and was a manual step for /eval-outcomes (#613). Adds generate-registry.sh as plumbing step 4, positioned LAST (it scans the whole skills/ tree, so the skeleton + other 3 surfaces must exist first), guarded with a WARN fallback like its siblings. A new skill is now one-shot-green across all 5 surfaces with zero manual regen. Closes-scenario: ag-ekyq#scaffold-registry-regen Bounded-context: BC4-Factory Evidence: tests/scripts/scaffold-registry-regen.bats (4/4 green; wiring + ordering contract) --- skills-codex/.agentops-manifest.json | 2 +- .../skill-builder/.agentops-generated.json | 2 +- skills/skill-builder/scripts/init.sh | 9 ++++ tests/scripts/scaffold-registry-regen.bats | 42 +++++++++++++++++++ 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 tests/scripts/scaffold-registry-regen.bats diff --git a/skills-codex/.agentops-manifest.json b/skills-codex/.agentops-manifest.json index 0d0ee1306..31ee25142 100644 --- a/skills-codex/.agentops-manifest.json +++ b/skills-codex/.agentops-manifest.json @@ -1069,7 +1069,7 @@ { "name": "skill-builder", "source_skill": "skills/skill-builder", - "source_hash": "941104f935c7d69640bcc42dcd83768f634c6150502746110c1028861e802b0b", + "source_hash": "09ca51bcec58dd8d144bf8a244deec9f716178bc0fc3ebd444b6ccbe314cdfe2", "generated_hash": "4d8b01766df9b10099f4f669e60c74dede37bd604e70d7b6a9a732cb5b2a5c05" }, { diff --git a/skills-codex/skill-builder/.agentops-generated.json b/skills-codex/skill-builder/.agentops-generated.json index db9ab06de..1e7f1b6e7 100644 --- a/skills-codex/skill-builder/.agentops-generated.json +++ b/skills-codex/skill-builder/.agentops-generated.json @@ -2,6 +2,6 @@ "generator": "manual-maintained", "source_skill": "skills/skill-builder", "layout": "modular", - "source_hash": "941104f935c7d69640bcc42dcd83768f634c6150502746110c1028861e802b0b", + "source_hash": "09ca51bcec58dd8d144bf8a244deec9f716178bc0fc3ebd444b6ccbe314cdfe2", "generated_hash": "4d8b01766df9b10099f4f669e60c74dede37bd604e70d7b6a9a732cb5b2a5c05" } diff --git a/skills/skill-builder/scripts/init.sh b/skills/skill-builder/scripts/init.sh index e19de1a26..4213e56f9 100755 --- a/skills/skill-builder/scripts/init.sh +++ b/skills/skill-builder/scripts/init.sh @@ -271,6 +271,15 @@ if [[ -f "$REPO_ROOT/scripts/append-codex-override-entry.sh" ]]; then bash "$REPO_ROOT/scripts/append-codex-override-entry.sh" "$SKILL_NAME" "$REPO_ROOT" \ || echo "init.sh: WARN could not add codex override catalog entry — add one manually" >&2 fi +# 4. registry.json SKU catalog — else contracts-sync + correctness(ubuntu) BOTH +# fail ("registry.json is stale" / "SKU_CATALOG: DRIFT"). This is the 5th +# one-shot-green surface ag-cw2y missed; it cost /burndown #600 a 2nd +# fix-and-repush (ag-ekyq). MUST run last — it scans the whole skills/ tree, +# so the new skeleton must already exist on disk. +if [[ -f "$REPO_ROOT/scripts/generate-registry.sh" ]]; then + bash "$REPO_ROOT/scripts/generate-registry.sh" >/dev/null 2>&1 \ + || echo "init.sh: WARN could not regen registry.json — run scripts/generate-registry.sh manually" >&2 +fi echo "init.sh: created skill skeleton at $NEW_DIR" echo "init.sh: codex parity at $CODEX_DIR" diff --git a/tests/scripts/scaffold-registry-regen.bats b/tests/scripts/scaffold-registry-regen.bats new file mode 100644 index 000000000..ddaecd5bd --- /dev/null +++ b/tests/scripts/scaffold-registry-regen.bats @@ -0,0 +1,42 @@ +#!/usr/bin/env bats +# ag-ekyq: skill-builder init.sh must regenerate registry.json (the SKU catalog) +# as part of new-skill scaffolding — the 5th one-shot-green surface ag-cw2y missed. +# A stale registry.json trips contracts-sync ("registry.json is stale") AND +# correctness(ubuntu) ("SKU_CATALOG: DRIFT") together; it cost /burndown #600 a +# 2nd fix-and-repush. generate-registry.sh scans the whole skills/ tree (not +# repo-root-injectable), so the contract we lock here is the WIRING + ORDERING: +# init.sh must invoke the canonical generator, AFTER the skeleton + the other +# three plumbing surfaces exist on disk. + +INIT="$BATS_TEST_DIRNAME/../../skills/skill-builder/scripts/init.sh" + +@test "init.sh invokes the canonical generate-registry.sh during scaffolding" { + run grep -E 'scripts/generate-registry\.sh' "$INIT" + [ "$status" -eq 0 ] +} + +@test "the registry regen is guarded with a WARN fallback like its sibling steps" { + # Must not hard-fail the scaffold if regen has trouble — same || echo WARN shape + # as the dispositions / counts / override-catalog steps. + run grep -E 'generate-registry\.sh.*>/dev/null|WARN could not regen registry' "$INIT" + [ "$status" -eq 0 ] +} + +@test "registry regen runs AFTER the codex override-catalog step (skeleton must exist first)" { + override_line=$(grep -n 'append-codex-override-entry\.sh' "$INIT" | head -1 | cut -d: -f1) + registry_line=$(grep -n 'generate-registry\.sh' "$INIT" | head -1 | cut -d: -f1) + [ -n "$override_line" ] + [ -n "$registry_line" ] + # registry regen must come later in the file (it scans the whole tree, so every + # other artifact — skill dir, dispositions, counts, codex catalog — must be in + # place first). + [ "$registry_line" -gt "$override_line" ] +} + +@test "registry regen runs BEFORE the final 'created skill skeleton' echo (inside the plumbing block)" { + registry_line=$(grep -n 'generate-registry\.sh' "$INIT" | head -1 | cut -d: -f1) + echo_line=$(grep -n 'created skill skeleton at' "$INIT" | head -1 | cut -d: -f1) + [ -n "$registry_line" ] + [ -n "$echo_line" ] + [ "$registry_line" -lt "$echo_line" ] +}