@wildo-ai/wildo-module-client 1.1.11 → 1.1.13
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/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/services/_http-client.d.ts.map +1 -1
- package/dist/esm/services/_http-client.js.map +1 -1
- package/dist/esm/services/_zod-issue-formatting.d.ts.map +1 -1
- package/dist/esm/services/_zod-issue-formatting.js.map +1 -1
- package/dist/esm/services/index.d.ts.map +1 -1
- package/dist/esm/services/index.js.map +1 -1
- package/dist/esm/services/lockfile-repair.service.d.ts +12 -25
- package/dist/esm/services/lockfile-repair.service.d.ts.map +1 -1
- package/dist/esm/services/lockfile-repair.service.js +34 -39
- package/dist/esm/services/lockfile-repair.service.js.map +1 -1
- package/dist/esm/services/module-adopter.service.d.ts.map +1 -1
- package/dist/esm/services/module-adopter.service.js.map +1 -1
- package/dist/esm/services/module-packager.service.d.ts +8 -8
- package/dist/esm/services/module-packager.service.d.ts.map +1 -1
- package/dist/esm/services/module-packager.service.js +8 -8
- package/dist/esm/services/module-packager.service.js.map +1 -1
- package/dist/esm/services/provider-materialization-hook.d.ts.map +1 -1
- package/dist/esm/services/provider-materialization-hook.js.map +1 -1
- package/dist/esm/services/provider-sync-runner.d.ts +8 -9
- package/dist/esm/services/provider-sync-runner.d.ts.map +1 -1
- package/dist/esm/services/provider-sync-runner.js +6 -7
- package/dist/esm/services/provider-sync-runner.js.map +1 -1
- package/dist/esm/services/registry-companion-client.d.ts.map +1 -1
- package/dist/esm/services/registry-companion-client.js.map +1 -1
- package/dist/esm/services/registry-lockfile.service.d.ts.map +1 -1
- package/dist/esm/services/registry-lockfile.service.js.map +1 -1
- package/dist/esm/services/registry-server-client.d.ts.map +1 -1
- package/dist/esm/services/registry-server-client.js +21 -7
- package/dist/esm/services/registry-server-client.js.map +1 -1
- package/dist/esm/services/types.d.ts.map +1 -1
- package/dist/esm/services/types.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/__tests__/lockfile-repair.service.test.ts +5 -5
- package/src/__tests__/registry-server-client.test.ts +82 -3
- package/src/services/lockfile-repair.service.ts +36 -58
- package/src/services/module-packager.service.ts +8 -8
- package/src/services/provider-sync-runner.ts +8 -9
- package/src/services/registry-server-client.ts +24 -5
- package/dist/tsconfig.tsbuildinfo +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildo-ai/wildo-module-client",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"description": "Module-registry runtime services consumed by wildo-cli and the dev companion (Phase 0.5 skeleton)",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Wildo AI",
|
|
@@ -30,18 +30,18 @@
|
|
|
30
30
|
"test:watch": "vitest"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@wildo-ai/platform-config-lib": "1.1.
|
|
33
|
+
"@wildo-ai/platform-config-lib": "1.1.13"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^24.0.15",
|
|
37
|
-
"rimraf": "^6.
|
|
37
|
+
"rimraf": "^6.1.4",
|
|
38
38
|
"tsc-alias": "1.8.16",
|
|
39
39
|
"tsc-watch": "7.2.1",
|
|
40
40
|
"typescript": "5.9.3",
|
|
41
|
-
"vitest": "^1.
|
|
41
|
+
"vitest": "^4.1.12"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"zod": "^4.
|
|
44
|
+
"zod": "^4.6.6"
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|
|
47
47
|
"type": "git",
|
|
@@ -51,14 +51,14 @@ const validEntry = (overrides: Record<string, unknown> = {}) => ({
|
|
|
51
51
|
|
|
52
52
|
describe('LockfileRepairService.inspect', () => {
|
|
53
53
|
it('returns ok+empty when the lockfile does not exist', async () => {
|
|
54
|
-
const report = await LockfileRepairService.inspect(saasRoot
|
|
54
|
+
const report = await LockfileRepairService.inspect(saasRoot);
|
|
55
55
|
expect(report.ok).toBe(true);
|
|
56
56
|
expect(report.findings).toEqual([]);
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
it('reports envelope-malformed on top-level Zod failure', async () => {
|
|
60
60
|
await writeEnvelope({ schemaVersion: 1, generatedAt: '2026', sections: {} });
|
|
61
|
-
const report = await LockfileRepairService.inspect(saasRoot
|
|
61
|
+
const report = await LockfileRepairService.inspect(saasRoot);
|
|
62
62
|
expect(report.ok).toBe(false);
|
|
63
63
|
expect(report.findings[0].kind).toBe('envelope-malformed');
|
|
64
64
|
});
|
|
@@ -69,7 +69,7 @@ describe('LockfileRepairService.inspect', () => {
|
|
|
69
69
|
generatedAt: '2026-05-05T12:00:00.000Z',
|
|
70
70
|
sections: { modules: { installed: 'not-an-object' } },
|
|
71
71
|
});
|
|
72
|
-
const report = await LockfileRepairService.inspect(saasRoot
|
|
72
|
+
const report = await LockfileRepairService.inspect(saasRoot);
|
|
73
73
|
expect(report.ok).toBe(false);
|
|
74
74
|
expect(report.findings[0].kind).toBe('modules-section-malformed');
|
|
75
75
|
});
|
|
@@ -80,7 +80,7 @@ describe('LockfileRepairService.inspect', () => {
|
|
|
80
80
|
generatedAt: '2026-05-05T12:00:00.000Z',
|
|
81
81
|
sections: { modules: { installed: { 'acme/billing': validEntry() } } },
|
|
82
82
|
});
|
|
83
|
-
const report = await LockfileRepairService.inspect(saasRoot
|
|
83
|
+
const report = await LockfileRepairService.inspect(saasRoot);
|
|
84
84
|
expect(report.ok).toBe(true); // warnings only
|
|
85
85
|
expect(report.findings).toHaveLength(1);
|
|
86
86
|
expect(report.findings[0]).toMatchObject({
|
|
@@ -100,7 +100,7 @@ describe('LockfileRepairService.inspect', () => {
|
|
|
100
100
|
generatedAt: '2026-05-05T12:00:00.000Z',
|
|
101
101
|
sections: { modules: { installed: { 'acme/billing': validEntry() } } },
|
|
102
102
|
});
|
|
103
|
-
const report = await LockfileRepairService.inspect(saasRoot
|
|
103
|
+
const report = await LockfileRepairService.inspect(saasRoot);
|
|
104
104
|
expect(report.findings).toEqual([]);
|
|
105
105
|
});
|
|
106
106
|
});
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* `platform-module-registry`.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { createServer, type Server } from 'node:http';
|
|
10
|
+
import { createServer, type IncomingMessage, type Server, type ServerResponse } from 'node:http';
|
|
11
11
|
import { createHash } from 'node:crypto';
|
|
12
12
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
13
13
|
import {
|
|
@@ -36,8 +36,8 @@ interface TestServer {
|
|
|
36
36
|
|
|
37
37
|
async function startServer(
|
|
38
38
|
handler: (
|
|
39
|
-
req:
|
|
40
|
-
res:
|
|
39
|
+
req: IncomingMessage,
|
|
40
|
+
res: ServerResponse,
|
|
41
41
|
) => void | Promise<void>,
|
|
42
42
|
): Promise<TestServer> {
|
|
43
43
|
return new Promise((resolve) => {
|
|
@@ -483,3 +483,82 @@ describe('RegistryServerClient domains (#2024)', () => {
|
|
|
483
483
|
expect(path).toBe('/v1/registry/my-domains');
|
|
484
484
|
});
|
|
485
485
|
});
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* A refusal with no typed meaning names what the registry said (#3388). Every route goes through `refuseUnlessOk` or,
|
|
489
|
+
* for a 409, through the same reader, so search (a 400), info (a 500) and a yank 409 stand for all of them.
|
|
490
|
+
*/
|
|
491
|
+
describe('RegistryServerClient names the registry\'s reason for a refusal (#3388)', () => {
|
|
492
|
+
const answer = async (status: number, body: string, contentType = 'application/json') => {
|
|
493
|
+
svc = await startServer((_req, res) => {
|
|
494
|
+
res.writeHead(status, { 'content-type': contentType });
|
|
495
|
+
res.end(body);
|
|
496
|
+
});
|
|
497
|
+
return svc.baseUrl;
|
|
498
|
+
};
|
|
499
|
+
const refusedFilter = JSON.stringify({
|
|
500
|
+
error: {
|
|
501
|
+
type: 'VALIDATION', message: 'validation', correlationId: 'corr-search',
|
|
502
|
+
details: { message: 'invalid search filter' },
|
|
503
|
+
validationErrors: { kind: 'Invalid option: expected one of "feature"|"provider"', maturity: { code: 'declared_refusal', params: { refusalCode: 'x' } } },
|
|
504
|
+
},
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
it('carries the reason, the refused fields and the correlation id of a 400 with a body', async () => {
|
|
508
|
+
const baseUrl = await answer(400, refusedFilter);
|
|
509
|
+
const error = await RegistryServerClient.search({ baseUrl }, { domain: 'acme', query: '' }).catch((err: unknown) => err);
|
|
510
|
+
expect(error).toBeInstanceOf(RegistryUnexpectedStatusError);
|
|
511
|
+
expect((error as Error).message).toBe(
|
|
512
|
+
`Registry "search" failed with HTTP 400 Bad Request at ${baseUrl}: invalid search filter; `
|
|
513
|
+
+ 'kind: Invalid option: expected one of "feature"|"provider"; maturity: declared_refusal {"refusalCode":"x"} '
|
|
514
|
+
+ '(VALIDATION, correlation id corr-search).',
|
|
515
|
+
);
|
|
516
|
+
expect((error as RegistryUnexpectedStatusError).refusal).toMatchObject({ reason: 'invalid search filter', correlationId: 'corr-search', type: 'VALIDATION' });
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
it('reports the status alone for a 400 with an empty body', async () => {
|
|
520
|
+
const baseUrl = await answer(400, '');
|
|
521
|
+
const error = await RegistryServerClient.search({ baseUrl }, { domain: 'acme', query: '' }).catch((err: unknown) => err);
|
|
522
|
+
expect((error as Error).message).toBe(`Registry "search" failed with HTTP 400 Bad Request at ${baseUrl}.`);
|
|
523
|
+
expect((error as RegistryUnexpectedStatusError).refusal).toBeUndefined();
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
it('quotes a body that is not the registry\'s envelope', async () => {
|
|
527
|
+
const baseUrl = await answer(500, 'upstream exploded', 'text/plain');
|
|
528
|
+
const error = await RegistryServerClient.info({ baseUrl }, { domain: 'acme', moduleId: 'acme/billing' }).catch((err: unknown) => err);
|
|
529
|
+
expect((error as Error).message).toBe(`Registry "info acme/billing" failed with HTTP 500 Internal Server Error at ${baseUrl}: the response said: upstream exploded.`);
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
it('keeps the reason of a yank 409 that is not the release-state refusal', async () => {
|
|
533
|
+
const baseUrl = await answer(409, JSON.stringify({ error: { type: 'CONFLICT', message: 'conflict', details: { message: 'gave up after lost optimistic checks', code: 'version_conflict' } } }));
|
|
534
|
+
const error = await RegistryServerClient.yank({ baseUrl }, { domain: 'acme', moduleId: 'acme/billing', version: '1.0.0' }).catch((err: unknown) => err);
|
|
535
|
+
expect(error).toBeInstanceOf(RegistryUnexpectedStatusError);
|
|
536
|
+
expect((error as Error).message).toMatch(/HTTP 409 Conflict at .*: gave up after lost optimistic checks \(version_conflict\)\.$/);
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
it('bounds a refused download\'s body by the request budget: a body that never ends does not hold the call', async () => {
|
|
540
|
+
// A transfer clears its response timer when the headers arrive and arms its idle timer only when the transfer is
|
|
541
|
+
// read (#1763), so reading the REFUSAL's body needs a deadline of its own (#3388 review F1).
|
|
542
|
+
let hanging: ServerResponse | undefined;
|
|
543
|
+
svc = await startServer((_req, res) => {
|
|
544
|
+
hanging = res;
|
|
545
|
+
res.writeHead(500, { 'content-type': 'application/json' });
|
|
546
|
+
res.write('{"error":');
|
|
547
|
+
});
|
|
548
|
+
const started = Date.now();
|
|
549
|
+
const error = await RegistryServerClient.download(
|
|
550
|
+
{ baseUrl: svc.baseUrl, timeoutMs: 300 },
|
|
551
|
+
{ domain: 'acme', moduleId: 'acme/billing', version: '1.0.0', expectedDigest: `sha256:${'a'.repeat(64)}` },
|
|
552
|
+
).catch((err: unknown) => err);
|
|
553
|
+
expect(error).toBeInstanceOf(RegistryUnexpectedStatusError);
|
|
554
|
+
expect((error as RegistryUnexpectedStatusError).refusal).toBeUndefined();
|
|
555
|
+
expect(Date.now() - started).toBeLessThan(3_000);
|
|
556
|
+
hanging?.destroy();
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
it('keeps the reason of a domain-create 409 that is not a taken slug', async () => {
|
|
560
|
+
const baseUrl = await answer(409, JSON.stringify({ error: { type: 'CONFLICT', message: 'conflict', details: { message: 'something else' } } }));
|
|
561
|
+
const error = await RegistryServerClient.createDomain({ baseUrl, authToken: 'k' }, { domain: 'wildo', defaultVisibility: 'PUBLIC' }).catch((err: unknown) => err);
|
|
562
|
+
expect((error as Error).message).toMatch(/HTTP 409 Conflict at .*: something else \(CONFLICT\)\.$/);
|
|
563
|
+
});
|
|
564
|
+
});
|
|
@@ -20,7 +20,7 @@ import * as path from 'node:path';
|
|
|
20
20
|
import { z } from 'zod';
|
|
21
21
|
import { formatZodIssuesAsSingleLine } from './_zod-issue-formatting';
|
|
22
22
|
import {
|
|
23
|
-
|
|
23
|
+
readApplicationPnpmSettings,
|
|
24
24
|
RegistryModulesLockSectionSchema,
|
|
25
25
|
getWildoSaasLockPath,
|
|
26
26
|
withoutRetiredLockfileEnvelopeKeys,
|
|
@@ -29,41 +29,26 @@ import {
|
|
|
29
29
|
} from '@wildo-ai/platform-config-lib';
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* Why a provider module's install-script name cannot simply be written back into the application's
|
|
33
|
-
* `
|
|
34
|
-
*
|
|
32
|
+
* Why a provider module's install-script name cannot simply be written back into the application's
|
|
33
|
+
* `onlyBuiltDependencies` (#2809). Each is the application's own policy, which the install (#2801) also refuses to
|
|
34
|
+
* override, and pnpm reads it as follows (measured on 10.6.4 in #2801 and #2808, and again on 10.34.9 in #3014: a
|
|
35
|
+
* `package.json` list still replaces the workspace file's, and both lists together still refuse the install).
|
|
36
|
+
*
|
|
37
|
+
* A third member, `workspace-allow-list` (an allow-list kept in `pnpm-workspace.yaml`, which a `package.json` list would
|
|
38
|
+
* replace), was RETIRED by #2808: the install and the repair now write the workspace file, so that list is the one
|
|
39
|
+
* they extend.
|
|
35
40
|
*/
|
|
36
41
|
export enum ApplicationInstallScriptPolicy {
|
|
37
|
-
/** The allow-list lives in `pnpm-workspace.yaml`, and a list in `package.json` would REPLACE it. */
|
|
38
|
-
WORKSPACE_ALLOW_LIST = 'workspace-allow-list',
|
|
39
42
|
/** A `neverBuiltDependencies` list names the package, and pnpm refuses to install with both lists. */
|
|
40
43
|
NEVER_BUILT_LIST = 'never-built-list',
|
|
41
44
|
/**
|
|
42
|
-
* The application declares an allow-list AND a `neverBuiltDependencies` list (in either file): pnpm 10.6.4 refuses to
|
|
45
|
+
* The application declares an allow-list AND a `neverBuiltDependencies` list (in either file): pnpm (10.6.4 and 10.34.9) refuses to
|
|
43
46
|
* install at all (`ERR_PNPM_CONFIG_CONFLICT_BUILT_DEPENDENCIES`, measured in #2809's review), so writing a name changes
|
|
44
47
|
* nothing until the application keeps one of them.
|
|
45
48
|
*/
|
|
46
49
|
CONFLICTING_LISTS = 'conflicting-lists',
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
/**
|
|
50
|
-
* The install-script policy `pnpm-workspace.yaml` declares, each list `undefined` when the file does not declare it.
|
|
51
|
-
* Supplied by the caller, which owns the YAML reading (`wildo-cli`'s `readWorkspaceBuildPolicy`, the reader the install
|
|
52
|
-
* uses), so the inspector and the install judge one policy the same way.
|
|
53
|
-
*/
|
|
54
|
-
export interface WorkspaceBuildPolicy {
|
|
55
|
-
onlyBuiltDependencies?: readonly string[];
|
|
56
|
-
neverBuiltDependencies?: readonly string[];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface LockfileRepairInspectOptions {
|
|
60
|
-
/**
|
|
61
|
-
* Required rather than defaulted: without it, a name missing from `package.json` could look restorable when the
|
|
62
|
-
* application keeps its list in `pnpm-workspace.yaml`, and `--fix` would then replace that list.
|
|
63
|
-
*/
|
|
64
|
-
workspaceBuildPolicy: WorkspaceBuildPolicy;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
52
|
/**
|
|
68
53
|
* Permissive envelope schema used by repair only — it accepts any
|
|
69
54
|
* `sections.*` payload without delegating to per-section schemas
|
|
@@ -97,7 +82,7 @@ export type LockfileRepairFinding =
|
|
|
97
82
|
filePath: string;
|
|
98
83
|
}
|
|
99
84
|
| {
|
|
100
|
-
/** A vendor pin the module's recorded wiring wrote (#2789) is gone from the
|
|
85
|
+
/** A vendor pin the module's recorded wiring wrote (#2789) is gone from the application's overrides: restorable. */
|
|
101
86
|
severity: 'warn';
|
|
102
87
|
kind: 'vendor-pin-missing';
|
|
103
88
|
moduleId: string;
|
|
@@ -116,7 +101,7 @@ export type LockfileRepairFinding =
|
|
|
116
101
|
| {
|
|
117
102
|
/**
|
|
118
103
|
* An install-script name the module's recorded wiring wrote (#2801), not held by the application, that the
|
|
119
|
-
* application's allow-list no longer carries: restorable into `
|
|
104
|
+
* application's allow-list no longer carries: restorable into `onlyBuiltDependencies` in `pnpm-workspace.yaml`.
|
|
120
105
|
*/
|
|
121
106
|
severity: 'warn';
|
|
122
107
|
kind: 'only-built-missing';
|
|
@@ -149,14 +134,14 @@ async function fileExists(absPath: string): Promise<boolean> {
|
|
|
149
134
|
}
|
|
150
135
|
}
|
|
151
136
|
|
|
152
|
-
/**
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
137
|
+
/**
|
|
138
|
+
* The application's effective pnpm settings (#2808), as pnpm 10 reads them: `pnpm-workspace.yaml`, or `package.json` →
|
|
139
|
+
* `pnpm` for a setting an older application still keeps there. A file the helper cannot read faithfully THROWS
|
|
140
|
+
* (`PnpmSettingsFormatError`, naming the line): reading it as empty would report every recorded pin as missing, and a
|
|
141
|
+
* `--fix` would then write into a file it cannot read.
|
|
142
|
+
*/
|
|
143
|
+
function readEffectivePnpmSettings(saasRoot: string): { overrides?: unknown; onlyBuiltDependencies?: unknown; neverBuiltDependencies?: unknown } {
|
|
144
|
+
return readApplicationPnpmSettings(saasRoot);
|
|
160
145
|
}
|
|
161
146
|
|
|
162
147
|
function asRecord(value: unknown): Record<string, unknown> {
|
|
@@ -169,40 +154,33 @@ function asNames(value: unknown): string[] | undefined {
|
|
|
169
154
|
|
|
170
155
|
/**
|
|
171
156
|
* Each install-script name a provider module's recorded wiring WROTE (#2801; a held name is the application's own), judged
|
|
172
|
-
* as pnpm 10.6.4 will judge it
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
* - otherwise a `
|
|
178
|
-
*
|
|
179
|
-
* by `NEVER_BUILT_LIST`; any other name's script runs, so nothing is reported;
|
|
157
|
+
* as pnpm 10 (10.6.4 through 10.34.9, #3014) will judge it against the application's EFFECTIVE policy (#2808: wherever pnpm reads it), with the same
|
|
158
|
+
* precedence the install uses (`onlyBuiltStates` in `wildo-cli`):
|
|
159
|
+
* - an allow-list AND a `neverBuiltDependencies` list → pnpm installs nothing, so a name the allow-list lacks is blocked
|
|
160
|
+
* by `CONFLICTING_LISTS` and never written;
|
|
161
|
+
* - an allow-list → a name it lacks is `only-built-missing`, restorable into `pnpm-workspace.yaml`;
|
|
162
|
+
* - otherwise a `neverBuiltDependencies` list → a name it lists is blocked by `NEVER_BUILT_LIST`; any other name's
|
|
163
|
+
* script runs, so nothing is reported;
|
|
180
164
|
* - otherwise no policy at all → pnpm runs no script, and the name is `only-built-missing`: restoring it writes the list
|
|
181
165
|
* the install wrote.
|
|
182
166
|
*/
|
|
183
167
|
function collectOnlyBuiltFindings(
|
|
184
168
|
moduleId: string,
|
|
185
169
|
entry: RegistryModulesLockEntry,
|
|
186
|
-
|
|
187
|
-
workspace: WorkspaceBuildPolicy,
|
|
170
|
+
settings: { onlyBuiltDependencies?: unknown; neverBuiltDependencies?: unknown },
|
|
188
171
|
findings: LockfileRepairFinding[],
|
|
189
172
|
): void {
|
|
190
173
|
const wiring = entry.registration?.providerWiring;
|
|
191
174
|
const held = new Set(wiring?.heldOnlyBuiltDependencies ?? []);
|
|
192
175
|
const wrote = (wiring?.onlyBuiltDependencies ?? []).filter((name) => !held.has(name));
|
|
193
176
|
if (wrote.length === 0) return;
|
|
194
|
-
const
|
|
195
|
-
const never = asNames(
|
|
196
|
-
const allowList = manifestList ?? workspace.onlyBuiltDependencies;
|
|
177
|
+
const allowList = asNames(settings.onlyBuiltDependencies);
|
|
178
|
+
const never = asNames(settings.neverBuiltDependencies);
|
|
197
179
|
for (const name of wrote) {
|
|
198
180
|
if (allowList !== undefined && never !== undefined) {
|
|
199
181
|
if (!allowList.includes(name)) findings.push({ severity: 'warn', kind: 'only-built-blocked', moduleId, name, policy: ApplicationInstallScriptPolicy.CONFLICTING_LISTS });
|
|
200
|
-
} else if (
|
|
201
|
-
if (!
|
|
202
|
-
} else if (workspace.onlyBuiltDependencies !== undefined) {
|
|
203
|
-
if (!workspace.onlyBuiltDependencies.includes(name)) {
|
|
204
|
-
findings.push({ severity: 'warn', kind: 'only-built-blocked', moduleId, name, policy: ApplicationInstallScriptPolicy.WORKSPACE_ALLOW_LIST });
|
|
205
|
-
}
|
|
182
|
+
} else if (allowList !== undefined) {
|
|
183
|
+
if (!allowList.includes(name)) findings.push({ severity: 'warn', kind: 'only-built-missing', moduleId, name });
|
|
206
184
|
} else if (never !== undefined) {
|
|
207
185
|
if (never.includes(name)) findings.push({ severity: 'warn', kind: 'only-built-blocked', moduleId, name, policy: ApplicationInstallScriptPolicy.NEVER_BUILT_LIST });
|
|
208
186
|
} else {
|
|
@@ -231,7 +209,7 @@ export const LockfileRepairService = {
|
|
|
231
209
|
/**
|
|
232
210
|
* Read the envelope + run every diagnostic. Read-only.
|
|
233
211
|
*/
|
|
234
|
-
async inspect(saasRoot: string
|
|
212
|
+
async inspect(saasRoot: string): Promise<LockfileRepairReport> {
|
|
235
213
|
const lockfilePath = getWildoSaasLockPath(saasRoot);
|
|
236
214
|
const findings: LockfileRepairFinding[] = [];
|
|
237
215
|
|
|
@@ -301,12 +279,12 @@ export const LockfileRepairService = {
|
|
|
301
279
|
}
|
|
302
280
|
const modules: RegistryModulesLockSection = parsed.data;
|
|
303
281
|
|
|
304
|
-
const
|
|
305
|
-
const rootOverrides = asRecord(
|
|
282
|
+
const pnpmSettings = readEffectivePnpmSettings(saasRoot);
|
|
283
|
+
const rootOverrides = asRecord(pnpmSettings.overrides);
|
|
306
284
|
for (const [moduleId, entry] of Object.entries(modules.installed)) {
|
|
307
285
|
await this.collectEntryFindings(saasRoot, moduleId, entry, findings);
|
|
308
286
|
collectVendorPinFindings(moduleId, entry, rootOverrides, findings);
|
|
309
|
-
collectOnlyBuiltFindings(moduleId, entry,
|
|
287
|
+
collectOnlyBuiltFindings(moduleId, entry, pnpmSettings, findings);
|
|
310
288
|
}
|
|
311
289
|
|
|
312
290
|
const ok = findings.every((f) => f.severity !== 'error');
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `ModulePackagerService` —
|
|
2
|
+
* `ModulePackagerService` — staging logic for module
|
|
3
3
|
* publishing.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Layout:
|
|
6
6
|
* - Published artifacts are zip archives staged under
|
|
7
7
|
* `<saasRoot>/.wildo-saas/generated/modules-artifacts/<module.id>/`.
|
|
8
8
|
* - The staged folder is the source of the artifact. It must
|
|
9
9
|
* include the `wildo.module.json` manifest, copied source
|
|
10
10
|
* files, and dependency declarations.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* This service ships the staging-folder primitives (path resolution,
|
|
13
13
|
* stage-fresh, copy-source-tree, write-manifest, compute-digest).
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* `wildo registry publish` calls these and the zip step; install
|
|
15
|
+
* consumes the same digest.
|
|
16
16
|
*
|
|
17
17
|
* Hard contracts:
|
|
18
18
|
* - Staging is always a fresh tree per call (`stageFresh`
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* from a previous failed stage MUST NOT leak into the digest.
|
|
22
22
|
* - The staged tree is a CHILD of `<saasRoot>/.wildo-saas/`,
|
|
23
23
|
* never reaches outside `saasRoot`.
|
|
24
|
-
* - Boundary enforcement
|
|
24
|
+
* - Boundary enforcement lives in this service: the
|
|
25
25
|
* staging primitive rejects file paths that escape the
|
|
26
26
|
* declared `boundaries.<layer>` allow-list, so a publish
|
|
27
27
|
* can never claim app surface it doesn't own.
|
|
@@ -112,7 +112,7 @@ function isPathInside(child: string, parent: string): boolean {
|
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
114
|
* Verify a candidate file path is contained inside one of the
|
|
115
|
-
* manifest's declared `boundaries
|
|
115
|
+
* manifest's declared `boundaries`. Returns the resolved
|
|
116
116
|
* absolute path on success; throws `RegistryBoundaryViolationError`
|
|
117
117
|
* otherwise.
|
|
118
118
|
*/
|
|
@@ -162,7 +162,7 @@ export const ModulePackagerService = {
|
|
|
162
162
|
/**
|
|
163
163
|
* Copy a single file from the app source into the staging tree.
|
|
164
164
|
* Path is verified against the manifest's declared boundaries
|
|
165
|
-
*
|
|
165
|
+
* — files outside `boundaries.*` are rejected with
|
|
166
166
|
* `RegistryBoundaryViolationError`. The relative path INSIDE the
|
|
167
167
|
* staging root mirrors the relative path inside the saas root,
|
|
168
168
|
* so callers don't need to translate paths between the two
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `runProviderSync` —
|
|
2
|
+
* `runProviderSync` — the real shell-out to
|
|
3
3
|
* `wildo config sync --domain config`.
|
|
4
4
|
*
|
|
5
5
|
* Module-registry install/update/remove/adopt flows mutate app
|
|
6
6
|
* source. When that source changes provider implementations,
|
|
7
7
|
* provider companion exports, or provider scopes, the
|
|
8
8
|
* provider-runtime delivery layer must regenerate its outputs
|
|
9
|
-
*
|
|
9
|
+
* The canonical command is owned by the provider
|
|
10
10
|
* workstream — module-registry MUST delegate, not fork.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* `runProviderMaterializationHook` is a no-op that records intent;
|
|
13
|
+
* this is the real
|
|
14
14
|
* `child_process.spawn`-based runner that:
|
|
15
15
|
* - resolves the `wildo` CLI binary from the saas root's
|
|
16
16
|
* `node_modules/.bin/wildo` (the workspace's own version);
|
|
@@ -21,10 +21,9 @@
|
|
|
21
21
|
* (`companion-discovery` / `runtime-import-reachability` /
|
|
22
22
|
* `invalid-scope` / `unknown`) so callers report repairable
|
|
23
23
|
* failures with first-class UX rather than generic install
|
|
24
|
-
* noise
|
|
25
|
-
* WIP Seams §1).
|
|
24
|
+
* noise.
|
|
26
25
|
*
|
|
27
|
-
* Hard contract
|
|
26
|
+
* Hard contract: the runner NEVER writes provider runtime
|
|
28
27
|
* artifacts itself. It only invokes the provider workstream's
|
|
29
28
|
* canonical command. Tests assert no provider artifact is touched
|
|
30
29
|
* by this code path.
|
|
@@ -61,7 +60,7 @@ export interface ProviderSyncRunnerInput {
|
|
|
61
60
|
log?: RegistryClientLogger;
|
|
62
61
|
/**
|
|
63
62
|
* Override the wildo CLI binary path. Defaults to
|
|
64
|
-
* `<saasRoot>/node_modules/.bin/wildo`.
|
|
63
|
+
* `<saasRoot>/node_modules/.bin/wildo`. Tests override
|
|
65
64
|
* this to point at a stub script.
|
|
66
65
|
*/
|
|
67
66
|
wildoBinPath?: string;
|
|
@@ -72,7 +71,7 @@ export interface ProviderSyncRunnerInput {
|
|
|
72
71
|
timeoutMs?: number;
|
|
73
72
|
/**
|
|
74
73
|
* If true, do NOT actually shell out — log the intent and
|
|
75
|
-
* resolve as `mode: 'dry-run'`. Used by the
|
|
74
|
+
* resolve as `mode: 'dry-run'`. Used by the smoke
|
|
76
75
|
* command which intentionally cannot rely on a working
|
|
77
76
|
* `wildo` binary in the smoke sandbox.
|
|
78
77
|
*/
|
|
@@ -34,6 +34,9 @@ import {
|
|
|
34
34
|
RegistryRateLimitedError,
|
|
35
35
|
isRegistryError,
|
|
36
36
|
isRegistryReleaseStateConflictBody,
|
|
37
|
+
parseRegistryRefusalBody,
|
|
38
|
+
readRegistryRefusal,
|
|
39
|
+
readRegistryRefusalBody,
|
|
37
40
|
RegistryMalformedPayloadError,
|
|
38
41
|
RegistryModuleNotFoundError,
|
|
39
42
|
RegistryUnexpectedStatusError,
|
|
@@ -83,6 +86,14 @@ export interface RegistryServerClientOptions {
|
|
|
83
86
|
timeoutMs?: number;
|
|
84
87
|
}
|
|
85
88
|
|
|
89
|
+
/**
|
|
90
|
+
* The deadline a refusal's body is read under: the request's own budget when the caller set one, else the reader's
|
|
91
|
+
* default. Needed for a download above all, whose response timer is already cleared when its headers arrive (#3388).
|
|
92
|
+
*/
|
|
93
|
+
function refusalBodyBounds(options: RegistryServerClientOptions): { timeoutMs?: number } {
|
|
94
|
+
return options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {};
|
|
95
|
+
}
|
|
96
|
+
|
|
86
97
|
function authHeaders(options: RegistryServerClientOptions): Record<string, string> {
|
|
87
98
|
return options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {};
|
|
88
99
|
}
|
|
@@ -91,6 +102,12 @@ function authHeaders(options: RegistryServerClientOptions): Record<string, strin
|
|
|
91
102
|
* Throw the typed error for a non-2xx response, after releasing its body (#1763 review: an unread body
|
|
92
103
|
* holds the connection until garbage collection). A 401 is told apart by whether a key was SENT — "log
|
|
93
104
|
* in" and "your key no longer works" are different remedies (#1759 review).
|
|
105
|
+
*
|
|
106
|
+
* A status with no typed meaning READS its body instead of discarding it (#3388): the registry's reason, the
|
|
107
|
+
* fields a schema refusal names and the correlation id travel there, and an error carrying only `HTTP 400` sent
|
|
108
|
+
* the operator to the server's logs for what the answer already said. The typed branches still discard theirs:
|
|
109
|
+
* each already names its remedy, and the engine strips the context of an authentication, authorization or
|
|
110
|
+
* not-found refusal at the wire, so those bodies carry no reason to report.
|
|
94
111
|
*/
|
|
95
112
|
async function refuseUnlessOk(
|
|
96
113
|
res: Response,
|
|
@@ -104,7 +121,9 @@ async function refuseUnlessOk(
|
|
|
104
121
|
else if (res.status === 401) error = options.authToken ? new RegistryCredentialRejectedError(options.baseUrl) : new RegistryAuthRequiredError(options.baseUrl);
|
|
105
122
|
else if (res.status === 403) error = new RegistryAuthForbiddenError(action);
|
|
106
123
|
else if (res.status === 429) error = new RegistryRateLimitedError(options.baseUrl, action, parseRetryAfterSeconds(res.headers.get('retry-after')));
|
|
107
|
-
else
|
|
124
|
+
else {
|
|
125
|
+
throw new RegistryUnexpectedStatusError(options.baseUrl, res.status, res.statusText, action, await readRegistryRefusal(res, refusalBodyBounds(options)));
|
|
126
|
+
}
|
|
108
127
|
await res.body?.cancel().catch(() => undefined);
|
|
109
128
|
throw error;
|
|
110
129
|
}
|
|
@@ -412,9 +431,9 @@ export const RegistryServerClient = {
|
|
|
412
431
|
});
|
|
413
432
|
if (res.status === 409) {
|
|
414
433
|
// Only the registry's own code means "the slug is registered"; a bare 409 is shared by other refusals.
|
|
415
|
-
const body = await res
|
|
434
|
+
const body = await readRegistryRefusalBody(res, refusalBodyBounds(options));
|
|
416
435
|
if (hasRegistryRefusalCode(body, RegistryRefusalCode.DOMAIN_TAKEN)) throw new RegistryDomainTakenError(args.domain);
|
|
417
|
-
throw new RegistryUnexpectedStatusError(options.baseUrl, res.status, res.statusText, action);
|
|
436
|
+
throw new RegistryUnexpectedStatusError(options.baseUrl, res.status, res.statusText, action, parseRegistryRefusalBody(body));
|
|
418
437
|
}
|
|
419
438
|
await refuseUnlessOk(res, options, action);
|
|
420
439
|
const parsed = RegistryCreateDomainResponseSchema.safeParse(await parseJsonOrThrow(res, options.baseUrl, action, options.timeoutMs));
|
|
@@ -462,9 +481,9 @@ async function changeYankState(
|
|
|
462
481
|
if (res.status === 409) {
|
|
463
482
|
// Only the release-state refusal is the no-op; a 409 for anything else (the registry giving up after
|
|
464
483
|
// lost optimistic checks) is a FAILED yank and must not be reported as done (#1758 re-review R3).
|
|
465
|
-
const body = await res
|
|
484
|
+
const body = await readRegistryRefusalBody(res, refusalBodyBounds(options));
|
|
466
485
|
if (isRegistryReleaseStateConflictBody(body)) throw new RegistryYankStateConflictError(args.moduleId, args.version, verb);
|
|
467
|
-
throw new RegistryUnexpectedStatusError(options.baseUrl, res.status, res.statusText, action);
|
|
486
|
+
throw new RegistryUnexpectedStatusError(options.baseUrl, res.status, res.statusText, action, parseRegistryRefusalBody(body));
|
|
468
487
|
}
|
|
469
488
|
// A 404 names the module or the version; the sanitized envelope does not say which.
|
|
470
489
|
await refuseUnlessOk(res, options, action, () => new RegistryVersionNotFoundError(args.moduleId, args.version));
|