@runeditrun/rer 0.2.40 → 0.2.41

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.
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.41
4
+
5
+ - **A run site's custom-domain readback waits for the domains to go live.** After `rer deploy --site` attaches its custom domains, it now polls the zone's Custom Domain list inside the deploy's readiness window until every hostname is listed on the site's Worker. The wait starts at 2 seconds and doubles up to 10 seconds. A hostname already on another Worker is still refused at once. A hostname still missing when the window ends fails as `domain-readback-mismatch` and names it. Before, the deploy read the list once, so a new zone's normal lag failed a deploy that would have gone live (#183).
6
+ - **A native demo's start passes the visitor's address to the seed.** When a native hosted demo starts, its seeding request to the seed's `/health` now carries `cf-connecting-ip` with the visitor's client address, as every later request does. Seeds that admit requests by client address, as Dial does, now start without workarounds in the seed (#188).
7
+ - **Base's docs lead with the one-line start.** The foundation template's README, ONBOARDING and OPERATIONS, and RUN-LOCALLY.md in the default seed and the export, now open with `npx -y @runeditrun/rer dev just-every/<repo>`. They give `rer setup` for setting up without starting, and the installer form `curl -fsSL https://runeditrun.com/install.sh | sh -s -- dev just-every/<repo>` for a machine without Node 22. Composed editions name their own `run-<edition>` repository (#185).
8
+ - **The publication scan accepts rer-project.json alone.** A seed's destination is valid with rer-project.json alone, edition.json alone, or both. Each manifest that is present binds its id, and rer-project.json also binds `sourceRepository`. Before, the 13 seeds whose edition.json was removed in the rer-project.json rollout failed `publish-check` with `destination.invalid` (#187).
9
+
3
10
  ## 0.2.40
4
11
 
5
12
  - **The /contract clause table keeps clause IDs whole.** A clause ID or kind never breaks across lines. The ID column is sized from the longest clause ID in the contract, so a long ID like `DEPENDENCY-001` fits on one line. Titles wrap only between words, and only evidence paths and gap text may break inside a word. The kind now sits under the clause ID instead of in a column of its own.
@@ -53,7 +53,7 @@ export class NativeDemo extends DurableObject {
53
53
  if (claimed.status !== 303) throw new Error(`owner-claim-${claimed.status}: ${(await claimed.text()).slice(0, 500)}`);
54
54
  await claimed.body?.cancel();
55
55
  const cookies = claimed.headers.getSetCookie();
56
- const seeded = await app.fetch(new Request(origin + '/health', { headers: { cookie: cookies.map(cookie => cookie.split(';')[0]).join('; ') } }));
56
+ const seeded = await app.fetch(new Request(origin + '/health', { headers: { 'cf-connecting-ip': clientIp, cookie: cookies.map(cookie => cookie.split(';')[0]).join('; ') } }));
57
57
  await seeded.arrayBuffer();
58
58
  if (!seeded.ok) throw new Error(`demo-seed-${seeded.status}`);
59
59
  if (this.state?.phase !== 'starting') throw new Error('demo-ended-during-start');
@@ -56,6 +56,29 @@ export async function waitForSiteUpload({ api, worker, versionId, fingerprint, p
56
56
  throw timeout();
57
57
  }
58
58
 
59
+ /** A new zone's Custom Domain list lags the attach. Poll it inside the deploy's
60
+ * readiness window until every hostname is listed on the kit's Worker. A hostname
61
+ * on another Worker is refused at once; one still unlisted at the deadline fails
62
+ * naming it. */
63
+ export async function waitForSiteDomains({ api, zoneId, worker, hostnames, window }) {
64
+ const bounded = readinessAPI(api, window, 'domain-readback-mismatch');
65
+ const mismatch = hostname => Object.assign(new Error('domain-readback-mismatch'), { resource: `domain:${hostname}` });
66
+ let delay = 2000, missing = hostnames[0];
67
+ while (window.remaining() > 0) {
68
+ let domains;
69
+ try { domains = await bounded.request(`/workers/domains?zone_id=${zoneId}`); }
70
+ catch (error) { if (window.remaining() <= 0 || error.name === 'TimeoutError') throw mismatch(missing); throw error; }
71
+ assert(Array.isArray(domains), 'invalid-domain-list');
72
+ const foreign = hostnames.find(hostname => domains.some(row => row?.hostname === hostname && row.service !== worker));
73
+ if (foreign) throw mismatch(foreign);
74
+ missing = hostnames.find(hostname => !domains.some(row => row?.hostname === hostname));
75
+ if (!missing) return domains;
76
+ await window.sleep(Math.min(delay, window.remaining()));
77
+ delay = Math.min(delay * 2, 10000);
78
+ }
79
+ throw mismatch(missing);
80
+ }
81
+
59
82
  /** Only provider UUIDs and kit fingerprints are safe to include in CLI output. */
60
83
  export function siteReadbackSummary(error) {
61
84
  if (error.message !== 'site-upload-timeout') return '';
@@ -5,7 +5,7 @@ import { ownerWorkerName } from './owner.mjs';
5
5
  import { uploadAssets, workerOrigin } from './worker.mjs';
6
6
  import { readinessWindow, readinessAPI } from './readiness-window.mjs';
7
7
  import { uploadVersionId } from './uploaded-worker.mjs';
8
- import { ownedSiteVersion, waitForSiteUpload } from './site-readback.mjs';
8
+ import { ownedSiteVersion, waitForSiteDomains, waitForSiteUpload } from './site-readback.mjs';
9
9
  export { servedVersion, siteReadbackSummary } from './site-readback.mjs';
10
10
 
11
11
  /* A seed's run site (run-<seed>.com): the folder `rer build --site` writes,
@@ -113,8 +113,7 @@ export async function siteDeploy({ api, plan, files, receiptPath, readiness = {}
113
113
  }
114
114
  // Readback: the kit's Worker live and both domains on it.
115
115
  await readback();
116
- const domains = await api.request(`/workers/domains?zone_id=${zone.id}`);
117
- for (const hostname of plan.hostnames) assert(domains.some(row => row.hostname === hostname && row.service === plan.worker), 'domain-readback-mismatch');
116
+ await waitForSiteDomains({ api, zoneId: zone.id, worker: plan.worker, hostnames: plan.hostnames, window });
118
117
  const receipt = { worker: plan.worker, domain: plan.domain, zoneId: zone.id, fingerprint, files: files.length, hostnames: plan.hostnames, redirect: plan.redirects[0] };
119
118
  await writeReceipt(receiptPath, receipt);
120
119
  return { origin: `https://${plan.domain}`, receipt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runeditrun/rer",
3
- "version": "0.2.40",
3
+ "version": "0.2.41",
4
4
  "description": "The rer command: install, set up, run and launch Run Edit Run checkouts.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -63,17 +63,21 @@ def destination(history, project=None, repository=None):
63
63
  if not present:
64
64
  identity(project)
65
65
  return None # Legacy sources retain strict reference inspection.
66
- documents = []
66
+ # Either manifest alone, or both, declares the destination; each present one binds.
67
+ documents = {}
67
68
  for name in MANIFESTS:
68
- entry = named.get(name)
69
+ if name not in named:
70
+ continue
71
+ entry = named[name]
69
72
  if not ordinary_document(entry):
70
73
  raise ValueError('destination manifest must be an ordinary committed file')
71
74
  document = json.loads(history.blob(entry['oid']), object_pairs_hook=unique_object,
72
75
  parse_constant=reject_constant)
73
76
  if not isinstance(document, dict):
74
77
  raise ValueError('destination manifest must be an object')
75
- documents.append(document)
76
- edition, project_document = documents
78
+ documents[name] = document
79
+ edition = documents.get('edition.json', {})
80
+ project_document = documents.get('rer-project.json')
77
81
  if 'identityKind' in edition:
78
82
  logical, invalid = tree_identity(history, named.values())
79
83
  if invalid or logical is None or project != logical:
@@ -84,9 +88,10 @@ def destination(history, project=None, repository=None):
84
88
  repository_value = repository_identity
85
89
  else:
86
90
  project_value = identity(project)
87
- project_values = [identity(edition.get('id')), identity(project_document.get('projectId'))]
91
+ project_values = [identity(document.get(FIELDS[name])) for name, document in documents.items()]
88
92
  repository_value = lambda value: identity(value, url=True)
89
- repository_values = [repository_value(project_document.get('sourceRepository'))]
93
+ repository_values = ([] if project_document is None else
94
+ [repository_value(project_document.get('sourceRepository'))])
90
95
  if 'custody' in edition:
91
96
  custody = edition['custody']
92
97
  if not isinstance(custody, dict):