Skip to content

Commit 2e69d3e

Browse files
committed
feat(spec)!: retire PackageDependency.optional and AppManifest.dependencies, the two unread dependency spellings
ADR-0141 D8 items 2 and 3: both keys are tombstoned with retiredKey(), registered in RETIRED_KEYS_BY_MAJOR[18] with one D3 semantic entry (dependency-unread-spellings-retired) and a step-18 rationale fragment. No D2 conversion: neither shape is a stack collection member. Claude-Session: https://claude.ai/code/session_01BkRZmjDUobsYmkGEjwjH9U Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6390fe5 commit 2e69d3e

10 files changed

Lines changed: 637 additions & 10 deletions

‎packages/spec/src/contracts/app-lifecycle-service.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ describe('App Lifecycle Service Contract', () => {
1414
views: ['contact_list', 'deal_board'],
1515
flows: ['new_deal_notification'],
1616
hasSeedData: true,
17-
dependencies: [],
1817
};
1918

2019
it('should allow a minimal IAppLifecycleService implementation with all required methods', () => {

‎packages/spec/src/kernel/package-dependency-dual-source.test.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import {
1616
//
1717
// ./cloud — since #16325 ./marketplace — the DECLARATION form an author
1818
// writes into a package manifest:
19-
// `{ packageId, versionRange, optional }`, embedded in
19+
// `{ packageId, versionRange, optional }` (`optional` since retired,
20+
// ADR-0141 D8), embedded in
2021
// `PackageManifestSchema.dependencies[]` → `sys_package_version.manifest_json`;
2122
// ./kernel — the RESOLVER form the dependency resolver walks:
2223
// `{ name, versionConstraint, type, resolvedVersion }`, embedded in
@@ -144,10 +145,10 @@ describe('PackageDependency dual-source retirement (C7)', () => {
144145
packageId: 'com.objectstack.core',
145146
versionRange: '^1.0.0',
146147
});
148+
// `optional` is a retired tombstone (ADR-0141 D8): it materializes nothing.
147149
expect(declared).toEqual({
148150
packageId: 'com.objectstack.core',
149151
versionRange: '^1.0.0',
150-
optional: false, // the `.default(false)` still applies
151152
});
152153
});
153154

@@ -163,13 +164,14 @@ describe('PackageDependency dual-source retirement (C7)', () => {
163164
const kernelKeys = keysOf(ResolvedPackageDependencySchema as never);
164165
const cloudKeys = keysOf(PackageDependencySchema as never);
165166
expect([...kernelKeys].sort()).toEqual(['name', 'resolvedVersion', 'type', 'versionConstraint']);
167+
// `optional` stays in the shape as a retiredKey() tombstone (ADR-0141 D8).
166168
expect([...cloudKeys].sort()).toEqual(['optional', 'packageId', 'versionRange']);
167169
expect([...kernelKeys].filter((k) => cloudKeys.has(k)), 'key sets must stay disjoint').toEqual([]);
168170

169171
// Neither side is `.strict()`, so cross-pasting a document does not throw —
170172
// it silently strips. That is exactly the failure mode the shared name hid,
171173
// and it is why the pin above forbids a "helpful" re-export alias.
172-
const manifestDoc = { packageId: 'com.objectstack.core', versionRange: '^1.0.0', optional: true };
174+
const manifestDoc = { packageId: 'com.objectstack.core', versionRange: '^1.0.0' };
173175
const strippedByResolver = ResolvedPackageDependencySchema.safeParse(manifestDoc);
174176
expect(strippedByResolver.success, 'resolver form rejects a manifest doc only on required keys').toBe(false);
175177

‎packages/spec/src/marketplace/dependency-spellings-retirement.test.ts‎

Lines changed: 494 additions & 0 deletions
Large diffs are not rendered by default.

‎packages/spec/src/marketplace/package-version.zod.ts‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { z } from 'zod';
44
import { SEMVER_2_0_0_VERSION_PATTERN } from '../kernel/version-grammar';
5+
import { retiredKey } from '../shared/retired-key';
56

67
/**
78
* Package Version Protocol
@@ -58,8 +59,31 @@ export const PackageDependencySchema = lazySchema(() => z.object({
5859
packageId: z.string().describe('Manifest ID of the dependency'),
5960
/** Required version range (semver, e.g. "^1.0.0"). */
6061
versionRange: z.string().describe('Semver version range (e.g. ^1.0.0)'),
61-
/** Whether this dependency is optional (missing dep is a warning, not an error). */
62-
optional: z.boolean().default(false).describe('Whether this dependency is optional'),
62+
/**
63+
* REMOVED (#25792 item 6; ADR-0141 D8 item 2, ADR-0049 enforce-or-remove).
64+
*
65+
* Said "missing dep is a warning, not an error", and nothing ever made it
66+
* so. The authored dependency is the manifest record
67+
* `ManifestSchema.dependencies` (`{ [packageId]: versionRange }`): it has no
68+
* optional arm, and the ADR-0141 D2 pre-install check reads it alone and
69+
* treats every entry as required. This array is a projection of that record
70+
* (D8), so an entry carries the id and the range and nothing the record
71+
* cannot say. Measured at retirement: no reader and no writer of the key
72+
* outside `packages/spec` (this repository and HotCRM).
73+
*
74+
* Tombstoned rather than deleted, so the rejection carries this prescription
75+
* in both channels (`tsc` and the parse). No D2 conversion: a snapshot is not
76+
* a stack collection member (the `kernel/Manifest:capabilities` precedent);
77+
* the D3 record is `dependency-unread-spellings-retired`.
78+
*/
79+
optional: retiredKey(
80+
'`PackageDependency.optional` was removed in @objectstack/spec 18 (ADR-0049 ' +
81+
'enforce-or-remove, ADR-0141 D8) — no install path ever honoured it: the ' +
82+
'pre-install check reads the package\'s `manifest.dependencies` record, which ' +
83+
'has no optional arm, and treats every entry as required. Delete the key. ' +
84+
'Declare a dependency in `manifest.dependencies` (`{ \'com.acme.core\': ' +
85+
'\'^1.0.0\' }`) only when the package cannot install without it.',
86+
),
6387
}).describe('Package dependency declaration'));
6488

6589
export type PackageDependency = z.input<typeof PackageDependencySchema>;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
// #25792 item 6 — ADR-0141 D8 item 2, ADR-0049 enforce-or-remove.
4+
// `PackageDependency.optional` ("missing dep is a warning, not an error") had
5+
// no record spelling: the authored dependency is `ManifestSchema.dependencies`
6+
// (`{ [packageId]: versionRange }`), the ADR-0141 D2 pre-install check reads it
7+
// alone and treats every entry as required, and the marketplace snapshot's
8+
// array is a projection of that record. Measured at `origin/main` `6390fe52ce`:
9+
// no reader and no writer of the key outside `packages/spec`, and none in
10+
// HotCRM at `9464673`.
11+
//
12+
// `retiredKey()` for the prescription and the `tsc` channel. The key was
13+
// DEFAULTED (`false`); the `acceptRetiredDefaultResidue` stage is NOT adopted,
14+
// because nothing in either repository parses the snapshot schema to emit the
15+
// default. No D2 conversion: a snapshot is not a stack collection member (the
16+
// `kernel/Manifest:capabilities` precedent). The D3 record is
17+
// `dependency-unread-spellings-retired`.
18+
export const entry = 'marketplace/PackageDependency:optional';
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
// #25792 item 6 — ADR-0141 D8 item 3, ADR-0049 enforce-or-remove.
4+
// `AppManifest.dependencies` listed bare ids with no range, and no install path
5+
// consulted it; the ADR-0141 D2 pre-install check judges the manifest record
6+
// `ManifestSchema.dependencies` alone. D8 offered two fates, a projection from
7+
// the record or a retirement, "decided with a measured reader count". Measured
8+
// at `origin/main` `6390fe52ce`: no reader of the key, and no parse of
9+
// `AppManifestSchema` at all, outside `packages/spec`; none in HotCRM at
10+
// `9464673`. Zero readers leave a projection nobody would read, so it retires.
11+
//
12+
// `retiredKey()` for the prescription and the `tsc` channel. The key was
13+
// DEFAULTED (`[]`); the `acceptRetiredDefaultResidue` stage is NOT adopted,
14+
// because nothing parses the schema to emit the default. No D2 conversion: an
15+
// app manifest is not a stack collection member (the
16+
// `kernel/Manifest:capabilities` precedent). The D3 record is
17+
// `dependency-unread-spellings-retired`.
18+
export const entry = 'system/AppManifest:dependencies';
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
import type { SemanticMigration } from '../../types.js';
4+
5+
// #25792 item 6 — ADR-0141 D8 items 2 and 3: the stated fates for the two
6+
// dependency spellings that sat declared beside the record the install check
7+
// reads. One family, one entry; both keys are in `RETIRED_KEYS_BY_MAJOR[18]`.
8+
export const entry: SemanticMigration = {
9+
id: 'dependency-unread-spellings-retired',
10+
// No backticks in `surface`: build-upgrade-guide.ts renders it inside a
11+
// code span AND a table cell.
12+
surface:
13+
'PackageDependency.optional (an entry of the marketplace snapshot manifestJson.dependencies[]) '
14+
+ '/ AppManifest.dependencies (the bare-id list on the app install manifest)',
15+
replacement:
16+
'delete both keys. A dependency is declared once, with its range, in the package\'s own '
17+
+ '`manifest.dependencies` record (`{ \'com.acme.core\': \'^1.0.0\' }`); the ADR-0141 D2 '
18+
+ 'pre-install check enforces every entry as required, and the marketplace snapshot array is a '
19+
+ 'projection of that record carrying `packageId` and `versionRange` only',
20+
reason:
21+
'ADR-0049 enforce-or-remove, deciding ADR-0141 D8 items 2 and 3 on a measured reader count. '
22+
+ 'Measured at origin/main 6390fe52ce: no reader and no writer of either key outside '
23+
+ 'packages/spec, across packages/, ui/, examples/ and apps/, and none in HotCRM at 9464673, '
24+
+ 'whose three modules declare their dependency in the record (the live control). '
25+
+ '`optional` promised "missing dep is a warning, not an error" and the record it projects '
26+
+ 'from has no optional arm, so no install path could honour it; `AppManifest.dependencies` '
27+
+ 'restated the record without its range and nothing consulted it. Why D3 semantic and not a '
28+
+ 'D2 conversion: neither shape is a stack collection member, so a conversion would be a '
29+
+ 'transform with no seam that ever runs (the kernel/Manifest:capabilities precedent).',
30+
acceptanceCriteria:
31+
'No source, snapshot or app manifest writes either key: a TypeScript author fails `tsc` (each '
32+
+ 'key is typed as the retired mark), and a parse of PackageDependencySchema, '
33+
+ 'PackageManifestSchema or AppManifestSchema refuses the key with its prescription, the old '
34+
+ 'default included. The live neighbour is untouched and must be verified as such: '
35+
+ '`manifest.dependencies` keeps driving the pre-install check, the namespace co-owners and '
36+
+ 'the hydrate order. Runtime behaviour is deliberately UNCHANGED: nothing ever read either '
37+
+ 'key, so removing them removes no behaviour.',
38+
};

‎packages/spec/src/migrations/registry.ts.template‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,6 +1701,19 @@ const STEP18_RATIONALE: readonly RationaleFragment[] = [
17011701
+ 'it. Its D3 record is the semantic entry `declared-index-bare-unique-true-retired`: '
17021702
+ 'whether each respelled index was really meant installation-wide is the author\'s call.',
17031703
},
1704+
{
1705+
id: 'dependency-unread-spellings-retired',
1706+
order: 110,
1707+
text:
1708+
'It also states the fates ADR-0141 D8 left to a measured reader count for the two dependency '
1709+
+ 'spellings beside the record the pre-install check reads (ADR-0049 enforce-or-remove): '
1710+
+ '`PackageDependency.optional`, which promised a missing dependency would only warn though the '
1711+
+ 'record has no optional arm and every entry is required, and `AppManifest.dependencies`, a '
1712+
+ 'bare-id list without a range. Neither had a reader or a writer outside `packages/spec`, here or '
1713+
+ 'in HotCRM, so both are tombstoned and `manifest.dependencies` is the one way to declare a '
1714+
+ 'dependency. There is no D2 conversion, because neither shape is a stack collection member; the '
1715+
+ 'D3 record is the semantic entry `dependency-unread-spellings-retired`.',
1716+
},
17041717
{
17051718
id: 'deployment-plumbing-organization-columns-retired',
17061719
order: 86,

‎packages/spec/src/system/app-install.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ describe('AppManifestSchema', () => {
2222
views: ['project_board', 'task_list'],
2323
flows: ['auto_assign', 'notify_on_complete'],
2424
hasSeedData: true,
25-
dependencies: ['core_crm'],
2625
};
2726
const parsed = AppManifestSchema.parse(manifest);
2827
expect(parsed.name).toBe('project_management');
@@ -42,7 +41,8 @@ describe('AppManifestSchema', () => {
4241
expect(parsed.flows).toEqual([]);
4342
expect(parsed.hasSeedData).toBe(false);
4443
expect(parsed.seedData).toEqual([]);
45-
expect(parsed.dependencies).toEqual([]);
44+
// `dependencies` is a retired tombstone (ADR-0141 D8): it materializes nothing.
45+
expect(parsed).not.toHaveProperty('dependencies');
4646
});
4747

4848
it('should enforce snake_case name', () => {

‎packages/spec/src/system/app-install.zod.ts‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
22

33
import { z } from 'zod';
4+
import { retiredKey } from '../shared/retired-key';
45

56
/**
67
* App Installation Protocol
@@ -56,8 +57,28 @@ export const AppManifestSchema = lazySchema(() => z.object({
5657
/** Seed data records to populate on install */
5758
seedData: z.array(z.record(z.string(), z.unknown())).default([]).describe('Seed data records'),
5859

59-
/** App dependencies (other apps that must be installed first) */
60-
dependencies: z.array(z.string()).default([]).describe('Required app dependencies'),
60+
/**
61+
* REMOVED (#25792 item 6; ADR-0141 D8 item 3, ADR-0049 enforce-or-remove).
62+
*
63+
* A list of bare ids with no version range, "other apps that must be
64+
* installed first", and no install path ever consulted it. The ADR-0141 D2
65+
* pre-install check judges one declaration, the manifest record
66+
* `ManifestSchema.dependencies` (`{ [packageId]: versionRange }`), which says
67+
* the same thing with a range. Measured at retirement: no reader and no
68+
* writer of the key outside `packages/spec` (this repository and HotCRM).
69+
*
70+
* Tombstoned rather than deleted, so the rejection carries this prescription
71+
* in both channels (`tsc` and the parse). No D2 conversion: an app manifest is
72+
* not a stack collection member (the `kernel/Manifest:capabilities`
73+
* precedent); the D3 record is `dependency-unread-spellings-retired`.
74+
*/
75+
dependencies: retiredKey(
76+
'`AppManifest.dependencies` was removed in @objectstack/spec 18 (ADR-0049 ' +
77+
'enforce-or-remove, ADR-0141 D8) — nothing read it: it listed bare ids with ' +
78+
'no version range, and no install path consulted it. Delete the key. Declare ' +
79+
'each dependency with its range in the package\'s `manifest.dependencies` ' +
80+
'(`{ \'com.acme.core\': \'^1.0.0\' }`), which the pre-install check enforces.',
81+
),
6182
}).describe('App manifest for marketplace installation'));
6283

6384
export type AppManifest = z.input<typeof AppManifestSchema>;

0 commit comments

Comments
 (0)