@atolis-hq/wake 0.4.111 → 0.4.113

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/README.md CHANGED
@@ -191,6 +191,7 @@ any time for the full command list, or see
191
191
 
192
192
  ## Documentation
193
193
 
194
+ - [Documentation index](docs/README.md) - current guides and references.
194
195
  - [docs/getting-started.md](docs/getting-started.md) - packaged-install setup, sandbox lifecycle, `wake doctor`.
195
196
  - [docs/cli.md](docs/cli.md) - full CLI command reference.
196
197
  - [docs/vision.md](docs/vision.md) - the rationale and long-term direction for Wake.
@@ -1,6 +1,6 @@
1
1
  import { ResourceCorrelationRole, } from '../resources/index.js';
2
2
  import { workItemId } from '../work/index.js';
3
- // Work items never embed a provider/repo/issue number (see docs/adrs/0001); this joins
3
+ // Work items never embed a provider/repo/issue number (see project/adrs/0001); this joins
4
4
  // the primary correlated resource's adapter-formatted key at the presentation layer only.
5
5
  export async function primaryExternalRef(root, rawWorkItemId, suppliedCorrelations, suppliedResources) {
6
6
  const correlations = suppliedCorrelations ?? (await root.resources.correlationsForWork(workItemId(rawWorkItemId)));
@@ -11,6 +11,15 @@ export interface SourceUpdatePort {
11
11
  checkout(tag: string): Promise<void>;
12
12
  healthy(): Promise<boolean>;
13
13
  }
14
+ /**
15
+ * The candidate cannot be installed yet, for example because the registry has
16
+ * not finished propagating a just-published version. Nothing about the release
17
+ * is known to be bad, so it is reported but never recorded as a bad tag and a
18
+ * later attempt may succeed.
19
+ */
20
+ export declare class CandidateNotYetAvailableError extends Error {
21
+ constructor(message: string, cause?: unknown);
22
+ }
14
23
  /**
15
24
  * Optional Docker rollout alongside the source checkout — build+swap the
16
25
  * sandbox container onto the new tag, roll it back on a failed deploy, and
@@ -1,5 +1,17 @@
1
1
  import { runSelfUpdate } from '../surfaces/index.js';
2
2
  import { UpdateMaintenancePhase } from './update-maintenance-lease.js';
3
+ /**
4
+ * The candidate cannot be installed yet, for example because the registry has
5
+ * not finished propagating a just-published version. Nothing about the release
6
+ * is known to be bad, so it is reported but never recorded as a bad tag and a
7
+ * later attempt may succeed.
8
+ */
9
+ export class CandidateNotYetAvailableError extends Error {
10
+ constructor(message, cause) {
11
+ super(message, cause === undefined ? undefined : { cause });
12
+ this.name = 'CandidateNotYetAvailableError';
13
+ }
14
+ }
3
15
  export function createSelfUpdateApplication(input) {
4
16
  return {
5
17
  async update(tag, force = false) {
@@ -243,7 +255,9 @@ async function prepareCandidate(input, tag) {
243
255
  if (priorTag !== null)
244
256
  await input.source.checkout(priorTag);
245
257
  await recordRolloutFailure(input.rollout, tag, error);
246
- await input.ledger.recordBad(tag);
258
+ // A candidate that is merely not installable yet must stay retryable.
259
+ if (!(error instanceof CandidateNotYetAvailableError))
260
+ await input.ledger.recordBad(tag);
247
261
  throw new UpdateCandidateFailure(error);
248
262
  }
249
263
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Turns a failed candidate image build into a retryable "not yet available"
3
+ * error when npm could not resolve the just-published package version, which
4
+ * happens briefly after a release while the registry propagates. Any other
5
+ * build failure is returned unchanged and still marks the tag bad.
6
+ */
7
+ export declare function classifyCandidateBuildFailure(error: unknown, packageName: string, tag: string): unknown;
@@ -0,0 +1,18 @@
1
+ import { DockerProcessError } from '../surfaces/index.js';
2
+ import { CandidateNotYetAvailableError } from './self-update-application.js';
3
+ /**
4
+ * Turns a failed candidate image build into a retryable "not yet available"
5
+ * error when npm could not resolve the just-published package version, which
6
+ * happens briefly after a release while the registry propagates. Any other
7
+ * build failure is returned unchanged and still marks the tag bad.
8
+ */
9
+ export function classifyCandidateBuildFailure(error, packageName, tag) {
10
+ if (!(error instanceof DockerProcessError))
11
+ return error;
12
+ const output = `${error.result.stdout}\n${error.result.stderr}`;
13
+ const unresolvable = output.includes('ETARGET') &&
14
+ output.includes(`No matching version found for ${packageName}@${tag}`);
15
+ return unresolvable
16
+ ? new CandidateNotYetAvailableError(`${packageName}@${tag} is not available from the npm registry yet; retry in a few minutes`, error)
17
+ : error;
18
+ }
@@ -25,6 +25,7 @@ import { createRunnerRegistry } from './runner-registry.js';
25
25
  import { createOneShotRunnerAdvance, createResidentRunnerAdvance, withFinalProjectionCatchUp, } from './runner-tick-adapter.js';
26
26
  import { runnerToolNotices } from './runner-tool-notices.js';
27
27
  import { createSelfUpdateApplication, } from './self-update-application.js';
28
+ import { classifyCandidateBuildFailure } from './self-update-build-failure.js';
28
29
  import { createSelfUpdateFailureLog } from './self-update-failure-log.js';
29
30
  import { createSourceUpdatePort } from './source-update-port.js';
30
31
  import { createUpdateLedger } from './update-ledger.js';
@@ -599,10 +600,15 @@ function createOperationalApplications(root) {
599
600
  source: updatePort,
600
601
  rollout: {
601
602
  async prepare(prepareTag) {
602
- await buildSandboxTag(root, dockerCli, `${imageRepository}:${prepareTag}`, {
603
- development: updateDevelopment,
604
- buildVersion: prepareTag,
605
- });
603
+ try {
604
+ await buildSandboxTag(root, dockerCli, `${imageRepository}:${prepareTag}`, {
605
+ development: updateDevelopment,
606
+ buildVersion: prepareTag,
607
+ });
608
+ }
609
+ catch (error) {
610
+ throw classifyCandidateBuildFailure(error, root.config.host.selfUpdate.npm.package, prepareTag);
611
+ }
606
612
  },
607
613
  async deploy(deployTag) {
608
614
  await deploySandboxTag(root, dockerCli, deployTag, `${imageRepository}:${deployTag}`, updateDevelopment);
@@ -124,6 +124,6 @@ export function resolveWakeVersion(options = {}) {
124
124
  return `g${headHash.slice(0, 7)}`;
125
125
  return '0.1.0-dev';
126
126
  }
127
- export const wakeVersion = "v0.4.111";
127
+ export const wakeVersion = "v0.4.113";
128
128
  /** The registry-installable version used by packaged sandbox images. */
129
129
  export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;