Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

af: skip preamble lines when parsing astro CLI table output#213

Merged
jlaneve merged 1 commit intomainastronomer/agents:mainfrom
julian/af-skip-preambleastronomer/agents:julian/af-skip-preambleCopy head branch name to clipboard
May 8, 2026
Merged

af: skip preamble lines when parsing astro CLI table output#213
jlaneve merged 1 commit intomainastronomer/agents:mainfrom
julian/af-skip-preambleastronomer/agents:julian/af-skip-preambleCopy head branch name to clipboard

Conversation

@jlaneve
Copy link
Copy Markdown
Contributor

@jlaneve jlaneve commented May 8, 2026

Summary

  • When ASTRO_API_TOKEN is set in the env, astro CLI prepends Using an Astro API Token to stdout (see astro-cli cmd/cloud/setup.go:362). The af table parser was treating that line as the header row, collapsing the deployment table to a single column called using_an_astro_api_token, so every row was dropped silently and af instance discover reported No instances discovered with no error.
  • Walk lines from the top and pick the first line that boundary-detects to 2+ columns as the real header. A real multi-column header always has 2-space gaps and yields 2+ boundaries; preamble lines have only single-space gaps and yield 1.
  • Fix is generic: handles any future single-line preamble astro CLI may add (warnings, deprecation notices, etc.) without needing to enumerate them.
  • astro deployment list --json would also fix this, but it was only added in astro CLI v1.42.0 (#2063), so falling back across older versions still requires this parser to be robust.

Test plan

  • New unit test covers the Using an Astro API Token preamble case
  • New unit test covers preamble + no-results (no Deployments found in workspace X) - returns [] cleanly
  • Existing 33 table-parsing tests still pass
  • Full tests/test_astro_cli.py + tests/test_discovery.py green (76/76)

🤖 Generated with Claude Code

Co-authored-by: Claude Opus 4.7 (1M context) noreply@anthropic.com

When ASTRO_API_TOKEN is set, astro CLI prepends "Using an Astro API
Token" to stdout (cmd/cloud/setup.go:362). The af table parser was
treating that line as the header row, collapsing the table to a single
column and dropping every deployment - discover would silently report
"No instances discovered" with no error.

Walk lines from the top and pick the first one that boundary-detects to
2+ columns as the real header. Real headers always have multiple 2-space
gaps; preamble lines have only single-space gaps and yield 1 boundary.
@jlaneve jlaneve merged commit 535a040 into main May 8, 2026
10 checks passed
@jlaneve jlaneve deleted the julian/af-skip-preamble branch May 8, 2026 19:09
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.