capdag 1.248.10 → 1.249.12
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/capdag.js +11 -6
- package/capdag.test.js +35 -0
- package/package.json +1 -1
package/capdag.js
CHANGED
|
@@ -5603,9 +5603,12 @@ function slugForSync(registryUrl) {
|
|
|
5603
5603
|
}
|
|
5604
5604
|
|
|
5605
5605
|
/**
|
|
5606
|
-
* How a cartridge was installed.
|
|
5607
|
-
*
|
|
5608
|
-
*
|
|
5606
|
+
* How a cartridge was installed. Exactly ONE value is semantic: BUNDLE
|
|
5607
|
+
* selects the bundled-cartridge integrity path at discovery. Every other
|
|
5608
|
+
* value is provenance telemetry, and the vocabulary GROWS as installers do —
|
|
5609
|
+
* so an unrecognized spelling is preserved verbatim on the record and
|
|
5610
|
+
* round-trips, never failing the cartridge.json parse. Mirrors Rust
|
|
5611
|
+
* CartridgeInstallSource; the on-disk JSON uses snake_case values.
|
|
5609
5612
|
*/
|
|
5610
5613
|
const CartridgeInstallSource = Object.freeze({
|
|
5611
5614
|
REGISTRY: 'registry',
|
|
@@ -5744,10 +5747,12 @@ class CartridgeJson {
|
|
|
5744
5747
|
}
|
|
5745
5748
|
let installedFrom = null;
|
|
5746
5749
|
if (obj.installed_from !== undefined && obj.installed_from !== null) {
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
throw new CartridgeJsonError(CartridgeJsonErrorKind.INVALID_JSON, `cartridge.json unknown installed_from: ${obj.installed_from}`);
|
|
5750
|
+
if (typeof obj.installed_from !== 'string') {
|
|
5751
|
+
throw new CartridgeJsonError(CartridgeJsonErrorKind.INVALID_JSON, 'cartridge.json installed_from must be a string');
|
|
5750
5752
|
}
|
|
5753
|
+
// An unknown spelling is preserved VERBATIM: the provenance vocabulary
|
|
5754
|
+
// grows as installers do, and a telemetry hint must never fail the
|
|
5755
|
+
// parse and take the cartridge down with it. Only BUNDLE is semantic.
|
|
5751
5756
|
installedFrom = obj.installed_from;
|
|
5752
5757
|
}
|
|
5753
5758
|
return new CartridgeJson({
|
package/capdag.test.js
CHANGED
|
@@ -6965,6 +6965,40 @@ function assertThrowsPlanState(fn, message) {
|
|
|
6965
6965
|
|
|
6966
6966
|
// TEST1450: a defaults-only request is AUTO with every knob at its default,
|
|
6967
6967
|
// and the proto JSON carries the documented wire shape.
|
|
6968
|
+
// TEST1514: the provenance vocabulary grows with installers. A workspace
|
|
6969
|
+
// build install parses to its named value; a spelling this build does not
|
|
6970
|
+
// know parses, is preserved VERBATIM, round-trips, and is not BUNDLE (the
|
|
6971
|
+
// one semantic value) — an unknown telemetry hint can never fail the
|
|
6972
|
+
// cartridge.json parse and take the cartridge down with it.
|
|
6973
|
+
function test1514_installSourceVocabularyTolerance() {
|
|
6974
|
+
const base = {
|
|
6975
|
+
name: 'candlecartridge',
|
|
6976
|
+
version: '1.227.800',
|
|
6977
|
+
channel: 'nightly',
|
|
6978
|
+
registry_url: 'https://cartridges-staging.machinefabric.com/v1/manifest',
|
|
6979
|
+
entry: 'candlecartridge',
|
|
6980
|
+
installed_at: '2026-08-14T22:26:59Z',
|
|
6981
|
+
fabric_manifest_version: 4,
|
|
6982
|
+
};
|
|
6983
|
+
// A drifted installer's spelling is tolerated but NOT blessed: the
|
|
6984
|
+
// protocol's vocabulary is registry/dev/bundle/app_installer, and a
|
|
6985
|
+
// writer's mistake never becomes a named value.
|
|
6986
|
+
const built = CartridgeJson.fromObject({ ...base, installed_from: 'build' });
|
|
6987
|
+
assert(built.installedFrom === 'build',
|
|
6988
|
+
`build is preserved verbatim like any unknown, got ${built.installedFrom}`);
|
|
6989
|
+
assert(!Object.values(CartridgeInstallSource).includes('build'),
|
|
6990
|
+
'build is not part of the protocol vocabulary');
|
|
6991
|
+
|
|
6992
|
+
const unknown = CartridgeJson.fromObject({ ...base, installed_from: 'quantum_courier' });
|
|
6993
|
+
assert(unknown.installedFrom === 'quantum_courier',
|
|
6994
|
+
`unknown spellings are preserved verbatim, got ${unknown.installedFrom}`);
|
|
6995
|
+
assert(unknown.installedFrom !== CartridgeInstallSource.BUNDLE,
|
|
6996
|
+
'an unknown spelling is never the semantic bundle value');
|
|
6997
|
+
const rewritten = unknown.toObject ? unknown.toObject() : JSON.parse(JSON.stringify(unknown));
|
|
6998
|
+
assert((rewritten.installed_from || rewritten.installedFrom) === 'quantum_courier',
|
|
6999
|
+
'unknown spellings round-trip');
|
|
7000
|
+
}
|
|
7001
|
+
|
|
6968
7002
|
function test1450_planRequestDefaults() {
|
|
6969
7003
|
const request = new plannerNS.PlanRequest({
|
|
6970
7004
|
sources: [{ mediaUrn: 'media:ext=pdf', isSequence: false }],
|
|
@@ -7589,6 +7623,7 @@ async function runTests() {
|
|
|
7589
7623
|
|
|
7590
7624
|
// planner.js: unified plan-space vocabulary
|
|
7591
7625
|
console.log('--- planner.js ---');
|
|
7626
|
+
runTest('TEST1514: install_source_vocabulary_tolerance', test1514_installSourceVocabularyTolerance);
|
|
7592
7627
|
runTest('TEST1450: plan_request_defaults', test1450_planRequestDefaults);
|
|
7593
7628
|
runTest('TEST1451: plan_request_knob_validation', test1451_planRequestKnobValidation);
|
|
7594
7629
|
runTest('TEST1452: knob_proto_round_trip', test1452_knobProtoRoundTrip);
|
package/package.json
CHANGED