fix(workspace): a blank field in `altimate.json` reads as signed out, not as an unreadable link

RA
1h ago
+163-7

Issue for this PR

Closes #1903

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Since #1835 getCredentials() throws on a blank required field. The strict binding read let that through, so the engine overlay treated it as an unreadable workspace link and printed the raw Zod JSON on every run.

  • AltimateApi.getCredentials() throws a typed IncompleteCredentials ("Altimate sign-in is incomplete (… must not be blank); sign in again") when the only problem is a blank altimateUrl, altimateInstanceName or altimateApiKey (after ${env:…} resolution). Any other fault still throws as before.
  • readLocalBindingScopedStrict() reads IncompleteCredentials as unbound (signed out), so the run behaves as it does with no altimate.json: no warning, no refusal.
  • backendConfig() (integrations CLI) returns null for it too, as it does for a missing file.
  • Bad JSON, an unset ${env:…} variable, a read error, or a blank field next to another schema fault still fail closed. A blank key still never loads the gateway as connected.

How did you verify your code works?

  • engine-overlay.test.ts: 8 new tests (each blank field, blank after env resolution, blanking while attached, and three fail-closed cases); 5 of them fail on main. 86 pass, 0 fail.
  • datamate.test.ts checks the typed error and that no Zod JSON shows (54 pass); integrations.test.ts adds a blank-is-signed-out case for backendConfig that fails on main.
  • Real run with a blank altimateInstanceName in a scratch home: main prints Workspace link could not be read: … ([ { "code": "custom", … before the reply; with this change nothing prints.
  • tsgo --noEmit and the marker guard are clean.

Cost side effects

None.

Screenshots / recordings

CLI text only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
  • I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"

🤖 Generated with Claude Code

https://claude.ai/code/session_01BXxzvpym19ATbtFL8LaB6b


Summary by cubic

Fixes blank fields in altimate.json reading as an unreadable workspace link instead of a signed-out state, which printed raw Zod JSON on every run. Closes #1903.

  • getCredentials() now throws a typed IncompleteCredentials ("sign in again") when only a required field is blank after ${env:…} resolution; the strict binding read and backendConfig() treat it as unbound, so runs behave as if altimate.json is missing.
  • Bad JSON, an unset ${env:…} variable, or a blank field alongside another schema fault still fail closed as before; a blank key still never loads the gateway as connected.

Summary by CodeRabbit

  • Bug Fixes
    • Blank or whitespace-only login details are now treated as signed out, rather than causing confusing credential errors.
    • When login details are incomplete, workspace connections remain unbound, and existing user-managed connections are preserved.
    • Invalid credential files and other credential errors continue to be reported as errors.