Repository navigation
fix(env): the runtime environment file admits a configuration document carrier - #95
Merged
antoinetoussaint-byte merged 2 commits intoOct 30, 2026
Merged
Conversation
…t carrier core names a structured configuration document's carrier with a lowercase hex SHA-256 (resources.ConfigurationDocumentKey), and LoadRuntimeEnvironmentFile accepted only [A-Z0-9_] after CODEFLY__, so an --output-env artifact carrying one (a composition's workspace fixture-composition document) could never load. Admit exactly that shape: a document prefix and 64 lowercase hex digits. The name is kept rather than upper-cased in core because this SDK, and every consumer built on an earlier core, finds the document by calling that same function and looking the result up exactly. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The reader imported crypto/sha256 and encoding/hex only to spell a length, which the deny-by-default import gate (scripts/allowed-imports.txt) refuses outside the files that hash. Read the length from core's own ConfigurationDocumentKey instead: no new import, and it follows core if the digest ever changes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
antoinetoussaint-byte
added a commit
to codefly-dev/cli
that referenced
this pull request
Oct 30, 2026
Mirror codefly-dev/sdk-go#95: read the digest length from core's own ConfigurationDocumentKey instead of spelling a SHA-256 length here, so the writer and the reader derive the shape the same way. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Symptom
platform-core's composition gate (and the cli#1256 work) fails a native run with
output environment record 51: its name is not uppercase ASCII, digits and underscores. The record isCODEFLY__CONFIGURATION_DOCUMENT_V1__5023386c…e765, the carrier of the workspace'sfixture-compositiondocument (digest of["_workspace_origin","fixture-composition","local"]) thatsaas/auth-gatewayreceives. The CLI's--output-envwriter refuses it because it mirrors this reader's grammar byte for byte, and this reader refuses the whole artifact.Cause
core names a structured configuration document's carrier
CODEFLY__[SECRET_]CONFIGURATION_DOCUMENT_V1__+ a lowercase hex SHA-256 (resources.ConfigurationDocumentKey).validRuntimeEnvironmentNameaccepts only[A-Z0-9_]afterCODEFLY__. The two never agreed: no--output-envfile carrying a document could ever load.Fix (a fix, at the reader that owns the file grammar)
validRuntimeEnvironmentNamealso admits exactly the document carrier core mints: one of the two document prefixes (core's constants) and exactly 64 lowercase hex digits. Any other lowercase name is still refused.Why not upper-case the digest in core instead: this SDK reads the document by calling
resources.ConfigurationDocumentKeyand looking the result up exactly (configurationDocument: injected value,os.LookupEnv, thenFindValueInEnvironmentVariables, all case-sensitive). Every consumer built on a core that mints the lowercase name would miss an upper-cased carrier and reportErrConfigurationDocumentMissing. Widening the file grammar to the name core already mints changes no carrier name anywhere.Companion CLI change (the writer accepts the same shape): codefly-dev/cli#1260. Merge this first: the CLI's writer is held to this reader's grammar.
Tests
TestLoadRuntimeEnvironmentFileCarriesAConfigurationDocument: core's own manager emits the document, the file is loaded, andWorkspaceConfigurationDocument("fixture-composition")returns it.TestLoadRuntimeEnvironmentFileAdmitsOnlyTheDocumentDigestInLowerCase: both prefixes admitted; 63/65 digits, non-hex, aV2prefix, another carrier with a hex tail,CODEFLY__lowerand a lowercase prefix refused.go test ./...andgolangci-lint run(0 issues) pass locally.Reused: core's
ConfigurationDocumentPrefix/SecretConfigurationDocumentPrefix. Not done: no compat lookup for an upper-cased digest, because nothing mints one.🤖 Generated with Claude Code