Skip to content

PLAT-1314/feat: select invocation context through TWOCTL_CONTEXT - #8

Merged
brtkwr merged 1 commit into
mainfrom
bkunwar/plat-1314-context-env
Oct 30, 2026
Merged

brtkwr merged 1 commit into
mainfrom
bkunwar/plat-1314-context-env

Conversation

@brtkwr

@brtkwr brtkwr commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Context

PLAT-1314 specifies an environment-variable context override for headless scripts. twoctl currently requires a flag on every invocation or a change to the shared saved context.

Changes

  • Select the invocation context using --context, then --env, then non-empty TWOCTL_CONTEXT, then the saved current context.
  • Honor that selection for API requests, auth commands, and dry runs without rewriting the saved context.
  • Resolve the registered URL during credential-free dry runs instead of inferring the wrong host when no key is stored.
  • Add regressions for precedence, request URL/key selection, auth targeting, dry-run behavior, unchanged saved selection, and the --url explicit-key boundary.

Scope / Non-goals

This is one coherent PLAT-1314 context-selection feature. It starts from main after merged PR #7 and does not depend on open retry-controls PR #6. OS-keychain storage and configuration mutation commands retain their existing behavior.

Validation

On exact head 817cfb2c43b2ce1c34f92e2f13a752231602f188, CI run 40854811107 passed both jobs:

  • build: go build ./..., all tests through make test-cover, and the 80% coverage gate passed. Total coverage: 81.0%.
  • lint: formatting, vet, ineffassign, spelling, complexity, and golint passed.
  • No tests run locally. Local formatting and git diff --check passed.

Ticket

Refs PLAT-1314.

✨ via Codex session

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T10:07:48.740382Z 817cfb2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Puvendhan Puvendhan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. TWOCTL_CONTEXT sits after --context and --env and never writes the saved context. pickContext uses it for the auth commands. The dry-run placeholder key only lets URL resolution run without a keychain read, and it is not sent. Needs a rebase after #6, or the other way round.

@brtkwr
brtkwr merged commit 407af0c into main Oct 30, 2026
2 checks passed
@brtkwr
brtkwr deleted the bkunwar/plat-1314-context-env branch October 30, 2026 12:12
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.

2 participants