fix: the scheduled sync runs in ops, not production - #189
Merged
Conversation
`production` carries a required-reviewer gate. That is right for deploys — deploy-prod.yml says you click Run when you mean it — and fatal for a job whose entire value is running unattended. The first dispatch prompted for approval, and a 03:17 scheduled run would have done the same with nobody awake to answer it. Splitting beats loosening `production`, because this job needs a strictly narrower credential than a deploy. It reads counts. It does not deploy, destroy, or touch KV, so it gets a Cloudflare token scoped to Account Analytics Read and nothing else. That is ADR-002's blast-radius argument about the Worker, pointed at CI: an unattended nightly job should hold the least credential that works. The analytics token is a different secret NAME, not the same name in a different environment. Same-name-different-scope is how the wrong credential ends up in the wrong job, and it reads as interchangeable in review when it is not.
…onment # Conflicts: # CHANGELOG.md
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.
fix: the scheduled sync runs in
ops, notproductionCloses: #186
Overview
The first dispatch of the scheduled sync prompted for approval, because
productioncarries arequired-reviewer gate. That gate is right for deploys — deploy-prod.yml says "you click Run when
you mean it" and means it — and fatal for a job whose entire value is running unattended. A 03:17
run would sit waiting for an approval nobody is awake to give, every night.
Summary of Changes
A separate
opsenvironment, which must have no reviewer gate.Splitting beats loosening
production, because this job needs a strictly narrower credentialthan a deploy. It reads counts. It does not deploy, destroy, or touch KV:
productionopsCLOUDFLARE_API_TOKEN(broad, provisioning)CLOUDFLARE_ANALYTICS_TOKEN(Account Analytics · Readonly)CF_RUNTIME_TOKENPAGEVAULT_API_TOKENPAGEVAULT_PROD_CONFIGThat is ADR-002's blast-radius argument about the Worker, pointed at CI: an unattended nightly job
should hold the least credential that works. Today it holds one that can deploy and destroy
infrastructure, to read some counts.
The analytics token is a different secret NAME, not the same name in a different environment.
Same-name-different-scope is how the wrong credential ends up in the wrong job, and it reads as
interchangeable in review when it is not. The workflow maps it to the
CLOUDFLARE_API_TOKENvariablethe CLI expects, explicitly and with the reason stated at the mapping.
Testing
Not covered, and it cannot be from here: whether a scheduled run fires unattended. A manual
dispatch proves the secrets resolve; only a real 03:17 run proves the gate is gone. That is the one
acceptance criterion in #186 that needs a night to pass.
Deployment Instructions
Before this can run, create the
opsenvironment — Settings → Environments → New environment:ops. Do not add a required reviewer.PAGEVAULT_PROD_CONFIGandPAGEVAULT_API_TOKEN(same values asproduction),SLACK_HEARTBEAT_WEBHOOK,SLACK_ALERT_WEBHOOK.CLOUDFLARE_ANALYTICS_TOKEN— a new token, My Profile → API Tokens → Create Token →Custom, with exactly
Account · Account Analytics · Readon the production account. Not thedeploy token.
productionanddeploy-prod.ymlare untouched.Next Steps