Repository navigation
feat(ci): publish spec-change manifests as workflow artifacts - #265
Conversation
spec-changes.yml and replay-spec-changes.yml used to POST each changed-services manifest to the SDK automation bot at /internal/spec-changes, HMAC-signed with SPEC_CHANGES_SECRET. That was the bot's only inbound surface besides the GitHub webhook, and traffic from Actions runners cannot be IP-scoped, so it needed its own WAF exception. Both producers now upload the manifest as a workflow artifact (spec-changes-<sha>, spec-changes-replay-<run_id>). The bot pulls it on the run's workflow_run webhook with its App token and upserts by sha, so nothing leaves GitHub and re-running a producer is the recovery path for a missed delivery. The replay script's --push/--bot-url become --output-dir, still gated on --confirm REPLAY_SPEC_CHANGES.
[Medium impact] The PR appears safe to merge; the remaining test gap is non-blocking. Findings
Fix with agent prompt### Issue 1
scripts/__tests__/replay-spec-changes.spec.mjs:undefined-105
The updated tests check `--output-dir` parsing but never exercise the new file-writing branch. Add tests using a temporary directory to check `<sha>.json` contents, skipping empty manifests, dry runs writing nothing, and a bad later target leaving no earlier files. These are the guarantees the artifact upload now depends on.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThe PR replaces signed manifest POSTs with workflow artifacts for the SDK bot to download.
|
| parsed.endpoint.href, | ||
| "https://sdk-automation-bot.workos.tools/internal/spec-changes", | ||
| ); | ||
| assert.equal(parsed.outputDir, resolve("spec-changes")); |
There was a problem hiding this comment.
File writes lack test coverage
The updated tests check --output-dir parsing but never exercise the new file-writing branch. Add tests using a temporary directory to check <sha>.json contents, skipping empty manifests, dry runs writing nothing, and a bad later target leaving no earlier files. These are the guarantees the artifact upload now depends on.
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/__tests__/replay-spec-changes.spec.mjs
Line: 102
Comment:
**File writes lack test coverage**
The updated tests check `--output-dir` parsing but never exercise the new file-writing branch. Add tests using a temporary directory to check `<sha>.json` contents, skipping empty manifests, dry runs writing nothing, and a bad later target leaving no earlier files. These are the guarantees the artifact upload now depends on.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Review follow-ups on #265. The replay guide still described push mode, signed POSTs, and SPEC_CHANGES_SECRET; it now documents upload mode and artifact delivery. The file-writing step moves into an exported writeManifests that validates every target before the first write, with tests for the written contents, skipped empty manifests, and a bad later target leaving no files behind.
Why
spec-changes.ymlandreplay-spec-changes.ymlPOSTed each changed-services manifest to the SDK bot at/internal/spec-changes, HMAC-signed withSPEC_CHANGES_SECRET. Runner traffic cannot be IP-scoped, so that endpoint needed its own WAF exception, and every run since Oct 30 has failed on it.Pairs with workos/sdk-automation-bot
feat/spec-changes-artifact-ingest, which pulls the artifact on this workflow'sworkflow_runwebhook.What
spec-changes.yml: build the manifest with--output spec-changes/<sha>.jsonand upload it as artifactspec-changes-<sha>(14-day retention). No upload when there are no changed services. Re-running the workflow re-publishes, which is the recovery path for a missed delivery.replay-spec-changes.yml:mode: uploadreplacespush. The script writes one<sha>.jsonper target intospec-changes/, uploaded asspec-changes-replay-<run_id>.scripts/replay-spec-changes.mjs:--push/--bot-urlbecome--output-dir, still gated on--confirm REPLAY_SPEC_CHANGES. The HMAC POST path is gone.actionlintclean on both workflows.npm test: 163 pass.After merge
Delete the
SPEC_CHANGES_SECRETActions secret; nothing reads it anymore.