Skip to content

fix(gcp): inject the endpoint the read path honours, not nothing - #1434

Merged
lex00 merged 1 commit into
mainfrom
fix/1431-gcp-endpoint-env
Aug 3, 2026
Merged

lex00 merged 1 commit into
mainfrom
fix/1431-gcp-endpoint-env

Conversation

@lex00

@lex00 lex00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Closes #1431. Unblocks #1211 (E·gcp) and INTENTIUS/behold#126.

The bug

FLOCI_GCP_EMULATOR.env returned {}, so chant emulator up --lexicon gcp booted floci-gcp, reported its endpoint, and left GCP_ENDPOINT_URL unset.

describeResources and observeResourcesDeep take their endpoint from that variable and nothing else. So every --live read went to real GCP while an emulator sat running on :4588.

Why the comment was wrong

It was right when written, and stopped being right two hours later:

when commit what
2026-08-02 19:41 9200d0d9 #1345 declares the capability, env empty — correct at the time; GCP was observed through Config Connector over kubectl, so no ambient variable existed
2026-08-02 21:34 7f4e985e #1209 moves observation onto the applier's own direct-REST transport, reading GCP_ENDPOINT_URL

Nothing re-read the comment. Outside tests setting it by hand, nothing in the repo wrote that variable at all — only the two readers consumed it.

The rationale was also half right, which is likely why it survived review: the apply path genuinely takes an explicit endpoint argument and needs no injection. The read path is the one that cannot be told where to look. The comment now says which half is which, so the next person to read it can tell whether it still holds.

Verified against the real plugins

Not just the unit test — endpointEnvVarsFor and applyLiveEndpoint driven with the actual gcpPlugin, before and after:

before   gcp: endpointEnvVarsFor -> []
         GCP_ENDPOINT_URL after applyLiveEndpoint = undefined

after    gcp: endpointEnvVarsFor -> ["GCP_ENDPOINT_URL"]
         GCP_ENDPOINT_URL after applyLiveEndpoint = http://localhost:4588
         notice: environment "local" declares endpoint http://localhost:4588
                 — applied to GCP_ENDPOINT_URL for this read

Identical in shape to azure's, which is the point.

endpointEnvVars derives its list by probing env, so an empty env also meant core believed gcp had no endpoint variable at all. Same line fixes it; covered by its own test.

Gate

tsc clean. 550 tests across 63 files (lexicons/gcp, core live-endpoint and op suites), 3 new.

Note for anyone running these locally on a fresh clone: just _ensure-gen first, or the gcp suites fail on missing src/generated/ barrels — unrelated to this change.

Closes #1431. Unblocks #1211 (E·gcp) and INTENTIUS/behold#126.

`FLOCI_GCP_EMULATOR.env` returned `{}`, so `chant emulator up --lexicon gcp`
booted floci-gcp, reported its endpoint, and left `GCP_ENDPOINT_URL` unset.
`describeResources` and `observeResourcesDeep` take their endpoint from that
variable and nothing else, so every `--live` read went to REAL GCP while an
emulator sat running on :4588.

The comment explaining the empty `env` was true when written and stopped being
true two hours later:

  2026-08-02 19:41  9200d0d  #1345 declares the capability, env empty —
                              correct, GCP was observed through Config
                              Connector over kubectl, no ambient var existed
  2026-08-02 21:34  7f4e985  #1209 moves observation onto the applier's own
                              direct-REST transport, reading GCP_ENDPOINT_URL

Nothing re-read the comment. Outside tests setting it by hand, nothing in the
repo wrote that variable at all — only the two readers consumed it.

The rationale was also half right, which is why it survived: the APPLY path
genuinely takes an explicit `endpoint` argument and needs no injection. The READ
path is the one that cannot be told where to look. The comment now says which
half is which.

Verified against the real plugins, before and after:

  before   gcp: endpointEnvVarsFor -> []
           GCP_ENDPOINT_URL after applyLiveEndpoint = undefined
  after    gcp: endpointEnvVarsFor -> ["GCP_ENDPOINT_URL"]
           GCP_ENDPOINT_URL after applyLiveEndpoint = http://localhost:4588
           notice: environment "local" declares endpoint http://localhost:4588
                   — applied to GCP_ENDPOINT_URL for this read

which is now identical in shape to azure's. `endpointEnvVars` derives its list by
probing `env`, so an empty `env` also meant core believed gcp had no endpoint
variable — that is fixed by the same line and is covered by its own test.

Gate: tsc clean, 550 tests across 63 files in lexicons/gcp + core live-endpoint
and op suites.
@lex00
lex00 merged commit 46d08dd into main Aug 3, 2026
5 checks passed
@lex00
lex00 deleted the fix/1431-gcp-endpoint-env branch August 3, 2026 18:17
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.

floci-gcp declares no endpoint env var, so chant emulator up boots an emulator the GCP read path never reaches

1 participant