Skip to content

fix(b-19): writer-env-fix uses PAT-implicit projectToken.project (replaces null-returning project(id))#161

Merged
gHashTag merged 1 commit into
mainfrom
fix/b19-pat-implicit-project
May 14, 2026
Merged

fix(b-19): writer-env-fix uses PAT-implicit projectToken.project (replaces null-returning project(id))#161
gHashTag merged 1 commit into
mainfrom
fix/b19-pat-implicit-project

Conversation

@gHashTag
Copy link
Copy Markdown
Owner

B-19 — writer-env-fix.yml resolve_env returns null under PAT

Closes #160.
Cross-references #156 (B-17 misdiag).
Successor of #159 (B-18 Bearer→PAT, merged 07:47:19Z).

Root cause (R5-verified)

Dispatch run 25848523618 failed with jq: error (at <stdin>:1): Cannot iterate over null (null) at step resolve_env — the GraphQL response was {"data":{"project":null}}.

The query was:

query env($projectId: String!){ project(id:$projectId){ environments { ... } } }

Under a Project-Access-Token (PAT), Railway's project(id:$x) returns null when $x references a project the PAT does not control — and PATs are scoped to exactly one project (verified by token-classify.yml run 25846091578).

The previous IGLA_PROJECT_ID / ACC2_PROJECT_ID env vars (e4fe33bb / 12c508c7) referenced different projects than what TOKEN_ACC1 / TOKEN_ACC2 are bound to.

Fix (mirrors working sibling wave-a-massive.yml#L28)

Replace the explicit-id form with the PAT-implicit form:

{ projectToken { project { environments { ... } } } }

No $projectId variable, no id argument — the token's bound project is returned directly. This is the canonical pattern used by wave-a-massive.yml (last good run 25754312720 @ 2026-05-12 18:31Z).

Both resolve_env() and fetch_services() helpers are migrated.

Secondary fix — informational project IDs

For audit-trail clarity (the env vars now have no functional effect, since the query is PAT-implicit), the values are also corrected to match what each PAT actually controls:

Var Old (BROKEN) New (R5-verified by token-classify run 25846091578)
IGLA_PROJECT_ID e4fe33bb-3b09-4842-9782-7d2dea1abc9b f29aa9dd-ca0b-460f-ad24-c7680c6717fb (IGLA RACE, ACC1)
ACC2_PROJECT_ID 12c508c7-1196-468d-b06d-d8de8cb77e93 ad0f8f04-c56d-4b11-9350-cc0c2700b9db (IGLA, ACC2)

Acceptance

After merge:

  1. gh workflow run writer-env-fix.yml --repo gHashTag/trios-railway -f confirm=PHI
  2. Workflow should complete success (no exit 4, no exit 5).
  3. R5 probe: SELECT EXTRACT(EPOCH FROM (NOW()-MAX(ts)))::int AS stale_sec FROM ssot.bpb_samples WHERE canon_name LIKE 'IGLA-SHORT-WAVE-MATRIX-%'; returns < 600 within T+10 min.

Anchor

φ² + φ⁻² = 3 · TRINITY · NEVER STOP · DOI 10.5281/zenodo.19227877

…urning project(id))

B-19 root cause (R5-verified from run 25848523618 jq error 'Cannot iterate over null'):
  The PAT-scoped GraphQL query 'query env($projectId){ project(id:$projectId){ ... } }'
  returns {data:{project:null}} because PAT tokens bind to ONE project implicitly,
  and the explicit id arg selects a different project the token cannot read.

Fix (mirrors wave-a-massive.yml line 28, last good run 25754312720 @ 2026-05-12 18:31Z):
  Replace project(id:$x) with PAT-implicit projectToken.project query — no id arg,
  no variables, the token's bound project is returned directly.

Also corrects project_ids (now informational-only since query is PAT-implicit):
  IGLA_PROJECT_ID: e4fe33bb (WRONG, PAT had no access) -> f29aa9dd (IGLA RACE, ACC1 PAT)
  ACC2_PROJECT_ID: 12c508c7 (WRONG, PAT had no access) -> ad0f8f04 (IGLA, ACC2 PAT)
  Verified by token-classify.yml run 25846091578.

Closes #160 (B-19). Cross-links #156 (B-17 misdiag).
@gHashTag gHashTag merged commit af7800a into main May 14, 2026
5 checks passed
gHashTag added a commit that referenced this pull request May 16, 2026
…carab:v4 (#216)

- Add docs/DEPLOY_SOVEREIGN_SCARAB_V4.md: NASA-style Russian deploy guide
  for 27 sovereign-scarab services on Railway
- Add railway.toml.template: per-service config stub with env stubs,
  healthcheck NONE (heartbeat via DB), image reference
- Covers: env vars, Railway UI path, Railway CLI steps, 3-account
  distribution (9 per ACC1/ACC2/ACC3), smoke-test SQL, acceptance
  criteria G-SS-04 / G-SS-05, rollback via ssot.pause_scarab()
- Notes: mass-deploy workflows deprecated (PR #214 merged);
  post-deploy management via queen-hive-mcp (L-SS3, PR #161)
- Anchor: phi^2 + phi^-2 = 3

Closes #210

Co-authored-by: Queen Hive Bot <queen-hive@trinity.local>
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.

[B-19] PAT auth works, but resolve_env query returns null — writer-env-fix needs hardcoded env_ids (refresh-acc47 pattern)

1 participant