Add --staging as an endpoint alias for the hosted staging platform #16
No reviewers
Labels
No labels
⏳in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grey.ooo/someones.computer_agent!16
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/staging-endpoint-flag"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
--stagingis a persistent bool on the root command — same reach as--endpoint, so it applies to every subcommand — resolving tohttps://staging.someones.computer.Tracked by Grey.ooo/someones.computer#212.
That index lives in the platform repo, which only records this repo's pinned
SHA; the change itself belongs here.
The precedence question
--endpointalready sits in a four-level chain, andapplyProjectDefaultsuses
f.Changed("endpoint")to tell the user passed it from the defaultfilled it in. An alias that simply assigns
flagEndpointleaves that flagfalse, so a
.sc.ymlcarryingendpoint:would quietly outrank the--stagingthe user just typed — the deploy would land somewhere else and saynothing. It is applied inside
applyProjectDefaultsinstead, as one switchthat states the whole ladder in the order it runs:
--endpoint--staging$SC_ENDPOINTendpoint:in.sc.ymldefaultEndpoint()--stagingoutranks the environment and the project file on purpose: a repopinned elsewhere must not pull a
--stagingdeploy back off staging.--stagingwith--endpointis an error rather than a defined winner — fora flag whose entire job is "not production", silently resolving the conflict is
the failure mode worth designing out.
applyProjectDefaultsreturns anerrornow so
PersistentPreRunEsurfaces it.The two endpoint URLs are named constants (
productionEndpoint,stagingEndpoint);defaultEndpoint()uses the former rather than repeatingthe literal.
Two things that came out of building it
deploysummary now names the resolved endpoint. A--dry-runthatcan't answer "am I about to deploy to staging?" isn't much of a rehearsal,
and it's how a user confirms the flag did what they asked. One line, above
Compose:.as the flag's value placeholder, so an aside about
`sc login`rendered the bool as
--staging sc loginin--help. Caught by running thebinary, fixed, and pinned by
TestStagingRendersAsABoolFlagInHelpso itcan't come back.
Tokens remain keyed per endpoint, so staging needs its own
sc login --staging. The flag's help text and the README both say so — unmentioned, itreads as broken auth rather than as designed.
Verified
go vet,go test ./...and the workflow's six-target cross-compile all passlocally. Beyond the tests, against the built binary in a project whose
.sc.ymlnameshttp://from-file:7500:and the help line renders as a bool:
New tests:
TestStagingBeatsTheEnvironmentAndTheProjectFile,TestStagingWithAnExplicitEndpointIsAnError,TestStagingRendersAsABoolFlagInHelp— the first two sit alongside theexisting precedence table in
internal/cli/project_test.go.Deliberately not in scope
--production/ a general--env <name>. The tracking issue's scopingraised it. One
bool is the smallest thing that closes the issue, and the constants plus the
single switch are where a table would go if a third environment ever earns
one. Not worth a lookup table for one alias.
there, once this merges and tags.
WIP: Add --staging as an endpoint alias for the hosted staging platformto Add --staging as an endpoint alias for the hosted staging platform