Skip to content

fix(cli): ignore unrelated Altertable environment variables#67

Merged
francoischalifour merged 2 commits into
mainfrom
fc/soften-env-var-strictness
Jul 16, 2026
Merged

fix(cli): ignore unrelated Altertable environment variables#67
francoischalifour merged 2 commits into
mainfrom
fc/soften-env-var-strictness

Conversation

@francoischalifour

Copy link
Copy Markdown
Member

Context

The CLI recently centralized environment-variable access behind a typed schema and added startup validation for every ALTERTABLE_* variable.

This improved configuration safety by:

  • Validating booleans, enums, ports, and other known values consistently.
  • Preventing invalid known configuration from silently falling back to defaults.
  • Keeping environment-variable access and secret metadata centralized.

However, startup validation also assumed that every inherited variable beginning with ALTERTABLE_ belonged to the CLI. Unknown names caused an immediate configuration error.

That assumption is too broad for automation and CI workflows. For example, a workflow may define domain-specific variables such as:

ALTERTABLE_CATALOG=analytics
ALTERTABLE_SCHEMA=reporting
ALTERTABLE_TABLE=events

These values are expanded into explicit CLI flags:

altertable append \
  --catalog "$ALTERTABLE_CATALOG" \
  --schema "$ALTERTABLE_SCHEMA" \
  --table "$ALTERTABLE_TABLE"

Although these variables do not configure the CLI directly, they are inherited by the CLI process. The previous validation rejected them before command parsing or execution, causing otherwise valid commands to fail.

The same startup ordering also meant environment validation ran before informational --help and --version exits. An invalid known configuration variable could therefore prevent users from accessing help or checking the installed version.

Proposed solution

Separate validation of the CLI’s known configuration surface from ownership of the broader ALTERTABLE_* namespace.

This change:

  • Continues to strictly validate every known CLI environment variable.
  • Silently ignores unknown ALTERTABLE_* variables.
  • Handles --help and --version before startup environment validation.
  • Does not emit warnings for ignored variables, preserving clean stderr for successful scripts.

Known variables still retain their existing validation behavior. For example, this remains an error:

ALTERTABLE_UPDATE_SOURCE=gitlab altertable profile show

ALTERTABLE_UPDATE_SOURCE is a recognized CLI setting, but gitlab is not one of its accepted values.

Unrelated workflow variables no longer affect execution:

ALTERTABLE_CATALOG=analytics \
ALTERTABLE_SCHEMA=reporting \
ALTERTABLE_TABLE=events \
altertable profile show

Behavioral changes

Before this change:

  • Any unknown ALTERTABLE_* variable caused exit code 10.
  • Workflow-specific variables could prevent all CLI commands from running.
  • Environment validation happened before --help and --version.

After this change:

  • Unknown ALTERTABLE_* variables are ignored.
  • Known variables are still parsed and validated strictly.
  • Successful commands do not emit warnings about unrelated variables.
  • --help and --version remain available even when a known environment setting is invalid.

@francoischalifour
francoischalifour enabled auto-merge (squash) July 16, 2026 13:40
@francoischalifour
francoischalifour merged commit 8fe9041 into main Jul 16, 2026
12 checks passed
@francoischalifour
francoischalifour deleted the fc/soften-env-var-strictness branch July 16, 2026 13:42
leonkenneth added a commit that referenced this pull request Jul 16, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.3.0](v1.2.0...v1.3.0)
(2026-07-16)


### Features

* **update:** simplify `update` command behavior and API
([#64](#64))
([310acdf](310acdf))


### Bug Fixes

* **cli:** ignore unrelated Altertable environment variables
([#67](#67))
([8fe9041](8fe9041))
* **release:** checkout merge commit for draft release verification
([#58](#58))
([988c95d](988c95d))
* **release:** run recovery with current publication code
([#63](#63))
([eab2c4a](eab2c4a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Léo-Paul Goffic <leo.goffic@altertable.ai>
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