Skip to content

Commit a438c14

Browse files
mogulOpenCode Agent
andcommitted
fix(usai): retire stale references to the removed model sync script
The provider-owned sync script was removed when OpenCode configuration moved to the OpenCode kit, but the USAi kit troubleshooting pages still told users to run `npm run sync:usai-models`, two feed fixtures with no remaining consumer were still shipped, and the SBX compatibility kit declared an npm test script over an empty test directory. - Point both troubleshooting pages at the repository refresh path. - Delete the two unreferenced `usai-models.json` fixtures. - Drop the SBX kit's test script, which ran zero tests and passed. - Add guards: no live `sync:usai-models` instruction under integrations/, no `node --test` script over a glob that matches nothing, and the orphan fixtures stay removed. Co-authored-by: OpenCode Agent <[email protected]>
1 parent 7dd2ddc commit a438c14

6 files changed

Lines changed: 71 additions & 18 deletions

File tree

‎integrations/isolation/acq-kits/usai-provider/TROUBLESHOOTING.md‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,20 @@ symptom means the kit wasn't applied, or the merge step didn't run.
5858

5959
## A model appears in the list but fails at runtime
6060

61-
**Cause:** the generated model catalog can drift from what USAi currently serves
62-
(models added/removed/renamed upstream).
63-
64-
**Fix:** regenerate the catalog from this kit directory: `npm run
65-
sync:usai-models`, then re-apply/recreate the sandbox. The generator only
66-
rewrites the region between the `BEGIN/END GENERATED USAI MODELS` markers.
61+
**Cause:** the vendored model snapshot can drift from what USAi currently
62+
serves (models added/removed/renamed upstream). The snapshot is derived from
63+
`integrations/providers/usai/catalog.json`, which is refreshed in the repository
64+
and shipped with a kit release; a sandbox never regenerates it.
65+
66+
**Fix:** update to a kit release that carries a refreshed snapshot, then
67+
re-apply or recreate the sandbox. A maintainer can compare the committed
68+
catalog with the live gateway by running, from `integrations/providers/usai/`,
69+
`node scripts/build-catalog.mjs --check --models-url
70+
https://api.gsa.usai.gov/api/v1/models`. The check writes nothing. It reads the
71+
gateway credential from the environment variable named in the catalog's
72+
`gateway.apiKeyEnv`, so run it on a maintainer host, not inside a sandbox.
73+
Without `--models-url` the command compares against a frozen offline fixture and
74+
says nothing about the live gateway.
6775

6876
## A global-key override warning appeared at startup
6977

‎integrations/isolation/acq-kits/usai-provider/tests/fixtures/usai-models.json‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎integrations/isolation/sbx-kits/usai-provider-kit/TROUBLESHOOTING.md‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,20 @@ symptom means the kit wasn't applied, or the merge step didn't run.
5858

5959
## A model appears in the list but fails at runtime
6060

61-
**Cause:** the generated model catalog can drift from what USAi currently serves
62-
(models added/removed/renamed upstream).
63-
64-
**Fix:** regenerate the catalog from this kit directory: `npm run
65-
sync:usai-models`, then re-apply/recreate the sandbox. The generator only
66-
rewrites the region between the `BEGIN/END GENERATED USAI MODELS` markers.
61+
**Cause:** the vendored model snapshot can drift from what USAi currently
62+
serves (models added/removed/renamed upstream). The snapshot is derived from
63+
`integrations/providers/usai/catalog.json`, which is refreshed in the repository
64+
and shipped with a kit release; a sandbox never regenerates it.
65+
66+
**Fix:** update to a kit release that carries a refreshed snapshot, then
67+
re-apply or recreate the sandbox. A maintainer can compare the committed
68+
catalog with the live gateway by running, from `integrations/providers/usai/`,
69+
`node scripts/build-catalog.mjs --check --models-url
70+
https://api.gsa.usai.gov/api/v1/models`. The check writes nothing. It reads the
71+
gateway credential from the environment variable named in the catalog's
72+
`gateway.apiKeyEnv`, so run it on a maintainer host, not inside a sandbox.
73+
Without `--models-url` the command compares against a frozen offline fixture and
74+
says nothing about the live gateway.
6775

6876
## A global-key override warning appeared at startup
6977

‎integrations/isolation/sbx-kits/usai-provider-kit/package.json‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@
22
"name": "usai-provider-kit",
33
"private": true,
44
"type": "module",
5-
"description": "legacy SBX compatibility kit: allow-list the USAi provider endpoint",
6-
"scripts": {
7-
"test": "node --test 'tests/**/*.test.mjs'"
8-
}
5+
"description": "legacy SBX compatibility kit: allow-list the USAi provider endpoint"
96
}

‎integrations/isolation/sbx-kits/usai-provider-kit/tests/fixtures/usai-models.json‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎scripts/tests/test_kit_provenance_and_drift.py‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,45 @@ def test_provider_packages_do_not_ship_opencode_configs_or_writers(self):
156156
assert not (root / "files/home/usai-config/opencode.jsonc").exists()
157157
assert not (root / "files/home/usai-config/merge-global-config.mjs").exists()
158158
assert not (root / "scripts/sync-usai-models.mjs").exists()
159+
160+
def test_orphaned_usai_model_list_fixtures_stay_removed(self):
161+
# These feed fixtures belonged to the retired sync script's tests and
162+
# have no remaining consumer.
163+
for root in (ACQ_USAI, SBX_USAI):
164+
assert not (root / "tests/fixtures/usai-models.json").exists()
165+
166+
167+
INTEGRATIONS = ROOT / "integrations"
168+
# Frozen byte-exact renderer-contract fixture: its comment is part of the
169+
# contract digest and must not be edited.
170+
FROZEN_FIXTURES = {
171+
INTEGRATIONS / "providers/usai/tests/fixtures/opencode-production.jsonc",
172+
}
173+
174+
175+
def _integration_files(suffixes: tuple[str, ...]) -> list[Path]:
176+
return [
177+
p for p in INTEGRATIONS.rglob("*") if p.is_file() and p.suffix in suffixes and "node_modules" not in p.parts
178+
]
179+
180+
181+
class TestRetiredRefreshCommand:
182+
def test_no_live_instruction_to_run_the_retired_npm_script(self):
183+
offenders = [
184+
str(p.relative_to(ROOT))
185+
for p in _integration_files((".md", ".json", ".mjs", ".yaml", ".yml", ".sh", ""))
186+
if p not in FROZEN_FIXTURES and re.search(r"sync:usai-models", p.read_text(errors="replace"))
187+
]
188+
assert offenders == []
189+
190+
def test_node_test_scripts_have_tests(self):
191+
# An npm "test" script over a glob that matches nothing passes with
192+
# "tests 0", which reads as evidence when there is none.
193+
offenders = []
194+
for pkg in INTEGRATIONS.rglob("package.json"):
195+
if "node_modules" in pkg.parts:
196+
continue
197+
script = json.loads(pkg.read_text()).get("scripts", {}).get("test", "")
198+
if "node --test" in script and not list(pkg.parent.glob("tests/**/*.test.mjs")):
199+
offenders.append(str(pkg.relative_to(ROOT)))
200+
assert offenders == []

0 commit comments

Comments
 (0)