@zabaca/zbc 0.10.7 → 0.10.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zabaca/zbc",
3
- "version": "0.10.7",
3
+ "version": "0.10.8",
4
4
  "description": "Zabaca stack CLI — scaffold and deploy infrastructure",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -65,7 +65,27 @@ export function renderProvisionScript(input: {
65
65
  )
66
66
  }
67
67
 
68
- lines.push(input.script)
68
+ // The declared script runs in a SUBSHELL, so an `exit` inside it ends the
69
+ // script and not the payload.
70
+ //
71
+ // Consumers append a marker write after this string (see `markerWrite`) and
72
+ // rely on `set -e` to skip it when the script fails. The comment at those call
73
+ // sites — "only reached if everything above succeeded" — anticipates failure
74
+ // and not a success path that exits. A readiness poll ending in `exit 0` is a
75
+ // natural thing to write and it took the marker with it: on one consumer the
76
+ // provision re-ran on every apply for eight days, restarting a live service
77
+ // each time, while the module read exit code 0 and reported "provisioned".
78
+ // A missing marker is indistinguishable from a first run, so nothing noticed.
79
+ //
80
+ // `set -e` still aborts on a non-zero subshell, so a failing script records
81
+ // nothing exactly as before. What the subshell costs is that the script can no
82
+ // longer alter the payload's own environment — nothing follows it but the
83
+ // marker write, which needs nothing from it.
84
+ //
85
+ // An empty script is left unwrapped: `(` followed by `)` with nothing between
86
+ // them is a bash syntax error, and rendering something unparseable would turn
87
+ // a no-op into a failed apply.
88
+ lines.push(input.script.trim() === '' ? input.script : `(\n${input.script}\n)`)
69
89
  return `${lines.join('\n')}\n`
70
90
  }
71
91