Skip to content

feat: Gateway.InstallationID exposes the installation the gateway stamped - #74

Merged
antoinetoussaint-byte merged 1 commit into
mainfrom
issue-73-gateway-exposes-orgid-but-not-the-installation-the
Oct 21, 2026
Merged

antoinetoussaint-byte merged 1 commit into
mainfrom
issue-73-gateway-exposes-orgid-but-not-the-installation-the

Conversation

@antoinetoussaint-byte

Copy link
Copy Markdown
Contributor

Closes #73.

What

func (g *Gateway) InstallationID() string, beside OrgID(). It returns gw.installationID, the value gatewayFor already reads from the gateway-stamped x-codefly-installation-id through viewerInstallation. That is the same value every ForModule mint names. A handler that needs the installation it serves no longer re-parses the header or takes an id from the page.

  • It returns only what the runtime accepted. viewerInstallation refuses an absent or blank header (installationErr) and returns "" when it does, so a refused value is never handed back. A padded value comes back trimmed, as the runtime accepted it.
  • It is empty on an install step's gateway (gatewayFor(nil)). That step already receives its Installation. The install path is unchanged.
  • The installation is never read from a caller-supplied x-codefly-work-context. A test pins that.

Classification

Fix, made at the owner. The runtime already holds the validated value, and this exposes it. There is no new parsing, no new environment read and no new header handling. The change is additive, so there is no !.

Reuse

Reused: viewerInstallation and the gatewayFor field it fills. Deliberately not added: any shape validation of the installation id. The runtime refuses only blank values today, and the format belongs to the host.

Docs

README.md (the Gateway.OrgID paragraph in the module-read section) and CHANGELOG.md describe the accessor.

Tests

TestGatewayExposesTheStampedInstallation (solution_test.go):

  • stamped → exposed, end to end through a booted handler
  • unstamped → empty
  • caller-supplied capability with no stamped header → empty
  • blank / tab header → installationErr set and the accessor empty. This case goes through gatewayFor directly, because the HTTP server trims a blank value before a handler sees it.
  • padded → the trimmed, accepted value

go mod verify, go build ./..., go vet ./..., gofmt -l . and go test -race ./... -count=1 all pass locally.

Overlap

#70 touches only README.md/go.mod/go.sum, so it does not conflict. #57 is a stale draft against a solution.go that has since lost the code it edits (solutionCredential, authorizeMint beside newGateway). It does not touch the OrgID area, and this PR does not build on it.

Not verified

The suite is hermetic. Nothing here was run against a real host gateway, so this does not show that a deployed auth gateway stamps x-codefly-installation-id on solution routes (installationConfinementHeader). It also does not show that InstallationService.GetInstallation accepts the value for a handler's use case from #73.

🤖 Generated with Claude Code

…mped (#73)

Gateway exposed OrgID() but nothing for the installation beside it, so a
handler that needed the installation it serves re-parsed
x-codefly-installation-id itself or took an id from the browser. The runtime
already reads and validates that header into gw.installationID through
viewerInstallation; the accessor returns that accepted value and nothing else,
so a blank header the runtime refuses is never handed back.

Closes #73

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@antoinetoussaint-byte
antoinetoussaint-byte merged commit 14afd95 into main Oct 21, 2026
1 check passed
@antoinetoussaint-byte
antoinetoussaint-byte deleted the issue-73-gateway-exposes-orgid-but-not-the-installation-the branch October 25, 2026 17:04
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.

Gateway exposes OrgID() but not the installation the gateway stamped: add InstallationID()

1 participant