Skip to content

P5 O11 M2: the staging hub, and a deploy tool that always names its Worker - #195

Merged
SSFSKIM merged 16 commits into
masterfrom
p5-o11-m2
Oct 27, 2026
Merged

SSFSKIM merged 16 commits into
masterfrom
p5-o11-m2

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 27, 2026

Copy link
Copy Markdown
Owner

P5 O11 M2, the staging hub (docs/doperpowers/plans/2026-10-27-p5-o11-hub-v2.md, M2).

What this lands

  • The deploy tool always names its target Worker. Every wrangler call passes --name <config.worker> --config <app>/wrangler.jsonc --env-file /dev/null, and wrangler runs in an allow-listed environment. No inherited WRANGLER_* or CLOUDFLARE_* variable reaches it, and neither does a .env file. Wrangler 4.151 can retarget a deploy through WRANGLER_CI_OVERRIDE_NAME, CLOUDFLARE_ENV, an account_id or a redirect file. Logs are sanitized and never written to disk.
  • It refuses what could change the target. --cwd, --env-file, --profile, a repeated --config, a foreign account_id or a deploy-config redirect are each refused before Access or wrangler is touched. So is a config whose host isn't its Worker's.
  • Each wrangler call prints the target it checked, as a wrangler target … line.
  • The staging config. apps/desk-hub/deploy/staging.json deploys Worker desk-hub-staging under org staging-ssfskim. The README covers both deployments.
  • Desk-hub tests can't reach the network. A setup file lets the global fetch reach loopback only.
  • Production deploys run through the same runner from now on. OAuth through HOME keeps working, as reviewer-medium traced. Only an environment-only CLOUDFLARE_API_TOKEN login would stop working, and it would fail closed.
  • The spec. The O11 document is updated: M2 is ticked, and its Decision Log and Surprises record the rulings this milestone took (acceptance 1's proof without wrangler on desk-hub, one-time PIN dropped, the org id staging-ssfskim, access-sync owning the people policy from M3).

Validation Evidence

  • Desk-hub tests: 50 files, 698 tests pass, and test/deploy/ passes 46 of 46. The target and runner suites pass 19 of 19; they failed 9 of 19 before the fix. Typecheck and eslint on the touched files are clean (/tmp/dsk-scripts/p5-o11/task-2-report.md).
  • Review: doperpowers:reviewer-medium on 3f579bf..b7f8056 returned incorrect, with two P1 routes to production and three P2s. It returned correct on the fix, b7f8056..707074a.
  • Staging is live. curl -sI -X POST https://desk-hub-staging.opencognita-platform.workers.dev/machine/enroll shows x-desk-build: hub@3a5b522b [email protected].
  • Production untouched (acceptance 1, as amended):
    • Every wrangler target line in the deploy logs names desk-hub-staging: 4 on the first deploy, then 2 on each probe deploy. The script counted 0 naming another Worker.
    • Production's x-desk-build: hub@3486527c [email protected] is the same before and after.
    • Production's Access apps and policies (ids, AUDs, policy bodies, updated_at) are byte-identical before and after. The account's desk-hub* names changed only by staging's 2 apps and 3 policies.
    • Production's Worker secrets are not checked: no wrangler call against desk-hub is allowed, read-only included.
  • Probe: deployment probe --config deploy/staging.json --test-org staging-probe-1 passed A4, A5, E2, E3 and A1 on staging, under a throwaway org.
    • The sweep found no service token or Access object left behind (m2-probe-1-sweep.json).
    • Staging was redeployed under staging-ssfskim, and /api/me confirmed it.
  • CI: scripts/ci-gate.sh /tmp/maws-o11-m2 --gates static,unit,probes on 15e171ce5: GREEN, https://github.com/SSFSKIM/MAWS/actions/runs/40434492697 (plan, static, probes, unit 1–4/4 success).

Owner item

One-time PIN login for a second member is the owner's decision at P5 acceptance 12. Our Access apps name no login methods, so Cloudflare offers every method the account has. A staging-only PIN would need production's apps to start naming their methods.

Residue

  • The staging scripts (/tmp/dsk-scripts/deploy-staging.sh, m2-probe-staging.sh, m2-prod-baseline.sh) live outside the repository because they read the secrets directory. A durable home for them is the desk's call.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
… one-time PIN leaves M2

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…nfiguration (P5 O11 M2)

Each wrangler call the deploy tool makes (deploy, secret list, secret put) now carries
--name <config.worker> and CLOUDFLARE_ACCOUNT_ID=<config.account>, through workerWrangler,
which refuses a call bringing its own target flag and, before Access or wrangler is
touched, a configuration whose host is not its Worker's. Each call prints the target it
checked. redeploy-check redeploys through deployHub, so it takes the same check. Before
this, every call relied on wrangler.jsonc's name, so a staging configuration would have
pushed its variables onto the production Worker.

deploy/staging.json is the staging hub: Worker desk-hub-staging, org ssfskim-staging.
The README covers both deployments and names the host as $HUB in its commands.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…owner policy vs access-sync, probe's throwaway org, login methods)

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…es production cannot also make

Machine service tokens are named desk-<org>-<machine> account-wide and machine names may hold '-', so
ssfskim-staging with machine x named the same token as production's ssfskim with machine staging-x.
No production token name starts desk-staging-. A test pins that neither org's token prefix begins the
other's, and the target suite now stubs the global fetch to throw, so none of its tests can reach Cloudflare.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…way org is staging-prefixed and cleaned up

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
test/support/no-network.ts, a setupFiles entry of the desk-hub vitest config, wraps the global fetch so
every suite reaches its own Miniflare hubs and stand-ins on loopback and nothing else: a test that forgets
to inject a fake (deployHub defaults to the global fetch) is refused before a request leaves, instead of
calling Cloudflare. target.test.ts drops its per-file stub and pins the refusal, a direct fetch and a
deploy given no fake account, which fails at its first Access call with no wrangler run.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…, account or log

Review fixes (O11 M2). Wrangler 4.151 also reads its target from its environment and files:
WRANGLER_CI_OVERRIDE_NAME renames the Worker outright, CLOUDFLARE_ENV/ACCOUNT_ID/API_* pick a
section, account or API, .env and .env.local beside wrangler.jsonc are loaded into its environment,
an account_id in wrangler.jsonc beats CLOUDFLARE_ACCOUNT_ID, and a .wrangler/deploy/config.json
redirect swaps the configuration. The runner now:
- runs wrangler in an allow-listed environment (wranglerEnv: what locates the system, the login and
  the network) plus what the tool sets, with WRANGLER_LOG_SANITIZE=true and WRANGLER_WRITE_LOGS=false
  forced, since a secret put carries a credential;
- passes wrangler.jsonc by path and --env-file /dev/null on every call, and refuses a caller's
  --cwd, --env-file and --profile beside the earlier target flags;
- refuses, before Access or wrangler is touched, a wrangler.jsonc with another account_id and a
  deploy redirect.
deployArgs refuses a repeated --config, which parseArgs would otherwise resolve to the last.

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
…n) and the wrangler target discovery

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
… restored)

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T02:00:13.877519Z 15e171c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SSFSKIM
SSFSKIM merged commit 4d23377 into master Oct 27, 2026
SSFSKIM added a commit that referenced this pull request Oct 27, 2026
…ment's M1 and M2 records joined

Sminos-Session: desk-sminos-orchestrator#b4948247 (doperpowers on macbook)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant