feat(templates): ship Vercel Cron canary-tick out of the box - #9
Open
PBab13 wants to merge 1 commit into
Open
Conversation
GH Actions schedule:'*/15' was best-effort under runner load (intervals up
to 80+ min observed) and could be silently cancelled by deploy-shadow
sharing the shadow-canary-${repo} concurrency group. Vercel Cron fires on
time with guaranteed delivery.
- Add app/api/canary-tick/route.ts (auth, SLO check, 2-tick hysteresis,
Paris-time-gated ramp cap, sloChecks ring buffer, opt-in Slack notify).
- Add lib/canary/tick.ts (pure decision helpers, imports core types only).
- vercel.json registers the */15 cron.
- canary-ramp.yml: drop schedule, keep workflow_dispatch only (manual
fallback for when /api/canary-tick is broken).
- .env.local.example: document CRON_SECRET, SLO_AUTH_TOKEN, optional
VERCEL_AUTOMATION_BYPASS_SECRET, optional SLACK_WEBHOOK_URL_MONITORING_CHANNEL.
- manifest.json: register new files, bump payload version 0.2.1 -> 0.3.0.
- Changeset: minor bump on @dotworld/shadow-canary-templates (fixed group
pulls core + skill along).
Refs LOVER-5123. Inspired by FileWorld migration in LOVER-5043.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate the canary ramp scheduler shipped by
@dotworld/shadow-canary-templatesfrom GH Actions cron to Vercel Cron, so new consumers get the reliable system out of the box.schedule: '*/15 * * * *'was best-effort under runner load (intervals up to 80+ min observed in practice) and could be silently cancelled bydeploy-shadow.ymlsharing theshadow-canary-${repo}concurrency group.The upstream template (v0.7.2) still shipped the deprecated bash path. New adopters thus inherited the broken scheduler. This PR brings the template in sync.
What new adopters get
app/api/canary-tick/route.ts— orchestration entry point hit by Vercel Cron every 15 min. Mirrors the bash workflow logic 1:1:CRON_SECRET) with constant-time compareVERCEL_AUTOMATION_BYPASS_SECRETsupportsloChecksring buffer (10 entries, body excerpt capped at 500 chars)SLACK_WEBHOOK_URL_MONITORING_CHANNEL)lib/canary/tick.ts— pure decision helpers (decideAction,parisHourCap,extractPrevOk,appendSloCheck,pctAfterTick,trimBodyExcerpt). Imports@dotworld/shadow-canary-coretypes only.vercel.json—crons: [{ path: '/api/canary-tick', schedule: '*/15 * * * *' }].What changes for existing adopters
npx shadow-canary-copy(or copy the three new files by hand).CRON_SECRET(required — auto-injected in deployed Vercel envs; signs cron calls),SLO_AUTH_TOKEN(required — bearer forwarded to the SLO endpoint). Optional:VERCEL_AUTOMATION_BYPASS_SECRET,SLACK_WEBHOOK_URL_MONITORING_CHANNEL./api/sloon the host project readsSLO_AUTH_TOKENand acceptsAuthorization: Bearer ${SLO_AUTH_TOKEN}.canary-ramp.ymlis now a manual fallbackschedule:dropped;workflow_dispatchkept. An operator can hand-trigger a tick if/api/canary-tickis broken (e.g. a bad deploy ships a failing route). Same decision logic, same env, no behavioural drift.Notes
lib/canary/tick.tsare covered in the FileWorld repo (src/lib/canary/tick.test.ts, 156 lines, 100% branch).minorbump on@dotworld/shadow-canary-templates. Templates is in thefixedgroup with-coreand-skill, so all three bump together.Linear
LOVER-5123
Test plan
pnpm installresolves without issuespnpm changeset statusshows the new minor bumpnpx shadow-canary-copy /tmp/test-app(after publish or viapnpm pack) copies the new filesCRON_SECRET+SLO_AUTH_TOKEN, verify/api/canary-tickreturns 401 without bearer and 200 with the right bearerGenerated with Claude Code.