Skip to content

refactor!: read stack hooks from the hooks field - #481

Merged
sephriot merged 1 commit into
mainfrom
refactor/stack-hooks-nested-selection
Aug 27, 2026
Merged

sephriot merged 1 commit into
mainfrom
refactor/stack-hooks-nested-selection

Conversation

@sephriot

@sephriot sephriot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

stack list and stack show read the stack hook scripts from ten fields the API marks as deprecated. This reads them from the current field instead, which nests them, and the JSON output nests with them.

This is a potential breaking change if someone is parsing this output
Maybe we are ok with this, maybe not, I'd prefer the repository owner to decide.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe): Refactor

Changes Made

  • Both commands now request the hook scripts from the field the API points at, rather than the ten deprecated ones.

  • Table output is unchanged.

  • JSON output changes shape. Before and after, for a stack with one after-apply script:

    before   {"id":"stack-1","afterApply":["echo done"], ...}
    after    {"id":"stack-1","hooks":{"afterApply":["echo done"]}, ...}
    

Why the output has to move

The GraphQL client builds the request from the Go struct and serialises the same struct to JSON, so nesting one nests the other. Keeping the flat JSON is possible but needs a hand-written marshaller.

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All existing tests pass

Screenshots (if applicable)

N/A

Related Issues

N/A

- stack list and stack show select the hooks object instead of the ten
  deprecated top-level hook fields they read today
- the shurcooL fork nests a selection only for a named field, so the JSON
  output nests with it

BREAKING CHANGE: spacectl stack show --output json and spacectl stack list
--output json move the hook script lists from top-level keys into a hooks
object. Anything reading afterApply, beforePlan and the rest at the top level
has to read them under hooks instead.
@upwind-code-us

upwind-code-us Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Upwind Upwind Code Scan - ✅ Proceed with Deployment

0 newly introduced vulnerabilities · 0 resolved · 1 total in this PR vs main

🟡 1 Medium

View full analysis in Upwind Console

Scan completed in 14s

Scan history (1 scan)
Commit Scanned at New Resolved Net
ad7772a < 2026-08-27 09:35 UTC 0 0 0

Last scanned: ad7772a · 2026-08-27 09:35 UTC

@upwind-code-us

upwind-code-us Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Upwind Upwind IaC Scan - ✅ Proceed with Deployment

0 newly introduced misconfigurations · 0 resolved · 3 total in this PR vs main

🔶 1 High | 🟡 1 Medium | 🟢 1 Low

View full analysis in Upwind Console →

Scan completed in 2s

Scan history (1 scan)
Commit Scanned at New Resolved Net
ad7772a < 2026-08-27 09:35 UTC 0 0 0

Last scanned: ad7772a · 2026-08-27 09:35 UTC

@sephriot
sephriot marked this pull request as ready for review August 27, 2026 09:44
@sephriot
sephriot requested a review from a team as a code owner August 27, 2026 09:44
@sephriot
sephriot merged commit 3de2220 into main Aug 27, 2026
9 checks passed
@sephriot
sephriot deleted the refactor/stack-hooks-nested-selection branch August 27, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants