rampway 0.3.1 → 0.4.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/velocious/worker.js"],"names":[],"mappings":"AAAA,YAAY;AAEZ,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAA;AAEtC,OAAO,SAAS,MAAM,0CAA0C,CAAA;AAChE,OAAO,qBAAqB,MAAM,+CAA+C,CAAA;AAEjF,OAAO,EAAC,sBAAsB,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAA;AACvE,OAAO,EAAC,+BAA+B,EAAC,MAAM,eAAe,CAAA;AAC7D,OAAO,EAAC,2BAA2B,EAAC,MAAM,iBAAiB,CAAA;AAC3D,OAAO,kBAAkB,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAC,8BAA8B,EAAC,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAA;AAElD,MAAM,qBAAqB,GAAG,GAAG,CAAA;AAEjC;;;;GAIG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAI;IACvC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAA;IAClH,MAAM,CAAC,aAAa,EAAE,eAAe,EAAE,KAAK,CAAC,GAAG,IAAI,CAAA;IACpD,IAAI,OAAO,eAAe,KAAK,QAAQ,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,eAAe,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;IACzJ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,qBAAqB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,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Aa,EAAE,OAAO,EAAE,KAAK;IACtE,MAAM,MAAM,GAAG,aAAa,EAAE,cAAc,EAAE,EAAE,CAAA;IAChD,IAAI,CAAC,MAAM;QAAE,OAAM;IACnB,MAAM,OAAO,GAAG,EAAC,OAAO,EAAE,KAAK,EAAC,CAAA;IAChC,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;IACvC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,EAAC,GAAG,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAC,CAAC,CAAA;AACtE,CAAC;AAED,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAClE,IAAI,CAAC;QACH,MAAM,2BAA2B,CAAC,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAChF,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;IACtB,CAAC;AACH,CAAC"}
@@ -4,7 +4,8 @@
4
4
  Velocious application. Rampway owns every deployment-specific decision and
5
5
  calls its normal deploy lifecycle; Velocious supplies only route mounting,
6
6
  request/connection scopes, database persistence, background execution, and
7
- framework error events.
7
+ framework error events. Each admitted run is executed by a package-owned
8
+ detached Node worker, not by the request process.
8
9
 
9
10
  The API accepts no command, path, repository, branch, environment value, log
10
11
  request, or arbitrary Git ref. A caller can select only a configured
@@ -38,6 +39,7 @@ routes.draw((route) => {
38
39
  route.mount(RampwayDeploymentApi, {
39
40
  at: "/rampway/deployments",
40
41
  accessTokens: deploymentSecrets.rampwayAccessTokens,
42
+ workerBootstrapPath: "/srv/my-app/control/rampway-velocious-worker.mjs",
41
43
  projects: {
42
44
  "my-app": {
43
45
  stages: {
@@ -55,6 +57,25 @@ export default {routes}
55
57
  ```
56
58
 
57
59
  `accessTokens` and every `configPath` are explicit backend configuration.
60
+ `workerBootstrapPath` is also explicit backend configuration. It must be an
61
+ absolute regular module file available in the deployed application release; the
62
+ mount resolves it to its real path before accepting requests. The module is
63
+ loaded only by Rampway's package-owned worker and must default-export a factory
64
+ that reconstructs the host application's Velocious configuration:
65
+
66
+ ```js
67
+ import configurationResolver from "velocious/build/src/configuration-resolver.js"
68
+
69
+ export default async function createRampwayDeploymentWorkerContext() {
70
+ return {
71
+ configuration: await configurationResolver({directory: "/srv/my-app"})
72
+ }
73
+ }
74
+ ```
75
+
76
+ The factory receives only the bounded stable mount and run identifiers. It must
77
+ load backend-owned configuration and secrets itself; neither bearer tokens nor
78
+ deployment targets are passed to the worker.
58
79
  Provision the secrets module outside source control using the application's
59
80
  normal secret mechanism. There is deliberately no environment-variable
60
81
  fallback. `configPath` must be absolute, and its selected Rampway stage must
@@ -72,6 +93,7 @@ Mount options:
72
93
  | `projects` | yes | Explicit project/stage allowlist with absolute Rampway config paths and approved release branches. |
73
94
  | `databaseIdentifier` | no | Velocious database used for runs/audits; default `default`. |
74
95
  | `staleRunTimeoutMs` | no | Ownership lease; default `60000`, minimum `4`. |
96
+ | `workerBootstrapPath` | yes | Absolute backend module that reconstructs the Velocious configuration in the detached worker. |
75
97
 
76
98
  ## Client calls
77
99
 
@@ -119,7 +141,7 @@ context.
119
141
 
120
142
  Create responses are bounded:
121
143
 
122
- - `202`: created; execution continues in a fresh Velocious connection context.
144
+ - `202`: created; execution continues in a separate detached Node process.
123
145
  - `200`: matching idempotent replay; the original run is returned.
124
146
  - `401`: missing or invalid bearer token.
125
147
  - `404`: project/stage is not allowlisted.
@@ -137,6 +159,15 @@ is also sent to Velocious framework error reporting.
137
159
 
138
160
  ## Execution and recovery guarantees
139
161
 
162
+ Rampway serializes durable admission and writes the request audit before
163
+ launching the worker. The parent waits for the operating system's child-spawn
164
+ acknowledgement before returning `202`; the worker then claims the pending run
165
+ and writes the heartbeat, lifecycle audits, terminal result, and database
166
+ connections from its own process. Its stdio is ignored rather than inherited,
167
+ and its invocation contains only the immutable bootstrap path and bounded
168
+ mount/run identifiers. A launch error fences the pending run as failed and is
169
+ not retried in the request process.
170
+
140
171
  Rampway serializes durable admission before validating reachability on the
141
172
  deployment target, so an idempotent retry storm performs the Git fetch only for
142
173
  the created run. It then invokes the same `deploy()` used by the CLI: deploy
@@ -156,12 +187,18 @@ are fenced by mount, run, owner, status, and (for stale reconciliation) the
156
187
  observed heartbeat. A renewed live owner therefore cannot be reclaimed, and an
157
188
  expired owner cannot overwrite a reconciled run.
158
189
 
159
- Pending work whose lease expires becomes `interrupted` and no longer blocks a
160
- new run. A stale running run, or a known successful activation whose success
161
- record could not be persisted, becomes `reconciliation_required` and continues
162
- to block duplicates until an operator verifies live state. Audit persistence
163
- failure is reported through both Velocious `framework-error` and `all-error`
164
- events and never strands deployment execution.
190
+ Pending work is protected by a separate durable launch-to-claim lease while the
191
+ worker imports its bootstrap and reconstructs Velocious. Status polling and
192
+ other admission processes therefore cannot interrupt a legitimately booting
193
+ worker; the lease is cleared atomically by claim or pre-claim failure. If that
194
+ launch lease expires without a claim, the pending run becomes `interrupted` and
195
+ no longer blocks a new run. A stale running run, or a known successful
196
+ activation whose success record could not be persisted, becomes
197
+ `reconciliation_required` and continues to block duplicates until an operator
198
+ verifies live state. Bootstrap failures are recorded as failed and audited when
199
+ the host configuration can still be reconstructed. Audit persistence failure is
200
+ reported through both Velocious `framework-error` and `all-error` events and
201
+ never strands deployment execution.
165
202
  Keyed retries and run-status polling evaluate the lease before returning, so a
166
203
  dead owner's stale `pending` or `running` state is reconciled without requiring
167
204
  a different-key deployment attempt.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rampway",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "JS-native Capistrano-style release-directory deployments with Rollbridge integration.",
5
5
  "type": "module",
6
6
  "private": false,