@cowliss/cli 0.9.0 → 0.10.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.
Files changed (2) hide show
  1. package/dist/index.js +30 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3170,8 +3170,15 @@ const insertAppSchema = createInsertSchema(apps$1);
3170
3170
  const bytea = customType({ dataType: () => "bytea" });
3171
3171
  /**
3172
3172
  * What an artifact is: a journey or template bundle as `cow build` emitted
3173
- * it, the wasm module the server compiled from it, or the gzipped source
3174
- * tarball of the repo the push was built from.
3173
+ * it, or the gzipped source tarball of the repo the push was built from.
3174
+ *
3175
+ * `module` is still a value of the Postgres enum and no longer a value here
3176
+ * (ticket 22/05). Compiled modules are not stored: a module is a
3177
+ * deterministic function of its bundle, so the rows were Postgres caching
3178
+ * what the sandbox's own disk cache already holds, at about 2MB each of
3179
+ * which 1.34MB is the QuickJS engine Javy links into every one. Dropping
3180
+ * the enum value itself would mean recreating the type and rewriting the
3181
+ * column, for a label nothing writes.
3175
3182
  */
3176
3183
  const artifactKindEnum = pgEnum("artifact_kind", [
3177
3184
  "bundle",
@@ -4395,10 +4402,16 @@ const versionStatusEnum = pgEnum("version_status", [
4395
4402
  * use; an execution pins the journey version it started on for its whole
4396
4403
  * life (ADR 0004).
4397
4404
  *
4398
- * `moduleDigest` is the content address and is null until the compile
4399
- * settles: a version that never compiled has no module to be addressed by,
4400
- * and Postgres leaves nulls out of the unique index, so a key that fails to
4401
- * compile twice records both failures.
4405
+ * The content address is the manifest's `bundle`, which is what the
4406
+ * developer actually pushed. `moduleDigest` is a derived compile result,
4407
+ * null until the compile settles and rewritable afterwards: the toolchain
4408
+ * that produced it is ours, not the tenant's, so bumping Javy is a
4409
+ * background recompile rather than a new version in a customer's history
4410
+ * (ADR 0011, amended 2026-09-19).
4411
+ *
4412
+ * The uniqueness that follows is "one ready version per key per bundle": a
4413
+ * key whose bundle does not compile records every attempt, and the next
4414
+ * push of that bundle is a retry rather than a duplicate.
4402
4415
  *
4403
4416
  * `pushedAt` is the ordering key rather than a creation stamp, because an
4404
4417
  * unchanged key gets no new version: a push that re-sends bytes a version
@@ -4430,7 +4443,7 @@ const versions$1 = pgTable("versions", {
4430
4443
  }),
4431
4444
  error: text("error")
4432
4445
  }, (table) => [
4433
- uniqueIndex("versions_org_id_kind_key_module_digest_unique").on(table.orgId, table.kind, table.key, table.moduleDigest),
4446
+ uniqueIndex("versions_org_id_kind_key_bundle_unique").on(table.orgId, table.kind, table.key, sql`(${table.manifest}->>'bundle')`).where(sql`${table.status} = 'ready'`),
4434
4447
  index("versions_org_id_kind_key_pushed_at_idx").on(table.orgId, table.kind, table.key, table.pushedAt),
4435
4448
  index("versions_org_id_push_id_idx").on(table.orgId, table.pushId),
4436
4449
  foreignKey({
@@ -6343,15 +6356,23 @@ const versionSchema = selectVersionSchema.extend({
6343
6356
  * version" column shows (the short digest, when it was pushed, whether it
6344
6357
  * compiled) and the push its source archive lives on. The manifest entry is
6345
6358
  * left out, because a journey row already carries what its own entry says.
6359
+ *
6360
+ * `bundle` is lifted out of that entry because it is the version's address:
6361
+ * it is there from the moment the push lands, and it does not move when a
6362
+ * recompile rewrites `moduleDigest` (ADR 0011, amended 2026-09-19). The
6363
+ * compiled module's digest is not on the wire at all; nothing outside the
6364
+ * sandbox has a use for it.
6346
6365
  */
6347
6366
  const versionSummarySchema = selectVersionSchema.pick({
6348
6367
  id: true,
6349
6368
  status: true,
6350
- moduleDigest: true,
6351
6369
  pushId: true,
6352
6370
  appId: true,
6353
6371
  error: true
6354
- }).extend({ pushedAt: z.iso.datetime() });
6372
+ }).extend({
6373
+ pushedAt: z.iso.datetime(),
6374
+ bundle: digestSchema
6375
+ });
6355
6376
  /**
6356
6377
  * A push as the API reports it, with the versions it created: `cow push`
6357
6378
  * returns as soon as the upload is stored, so what is compiling, what is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowliss/cli",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "cow": "./dist/index.js"