@forgeax/engine-pack 0.0.0-dev.8d955ade1c79
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/LICENSE +202 -0
- package/README.md +429 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/__tests__/ai-recovery.unit.test.d.ts +2 -0
- package/dist/__tests__/ai-recovery.unit.test.d.ts.map +1 -0
- package/dist/__tests__/artifact-path.test.d.ts +2 -0
- package/dist/__tests__/artifact-path.test.d.ts.map +1 -0
- package/dist/__tests__/asset-evidence-error-hints.test.d.ts +2 -0
- package/dist/__tests__/asset-evidence-error-hints.test.d.ts.map +1 -0
- package/dist/__tests__/asset-evidence-lifecycle.test.d.ts +2 -0
- package/dist/__tests__/asset-evidence-lifecycle.test.d.ts.map +1 -0
- package/dist/__tests__/asset-evidence-schema.test.d.ts +2 -0
- package/dist/__tests__/asset-evidence-schema.test.d.ts.map +1 -0
- package/dist/__tests__/atlas-cli-region-mismatch.test.d.ts +2 -0
- package/dist/__tests__/atlas-cli-region-mismatch.test.d.ts.map +1 -0
- package/dist/__tests__/atlas-error-code-owner.test-d.d.ts +2 -0
- package/dist/__tests__/atlas-error-code-owner.test-d.d.ts.map +1 -0
- package/dist/__tests__/cli-asset-evidence.integration.test.d.ts +2 -0
- package/dist/__tests__/cli-asset-evidence.integration.test.d.ts.map +1 -0
- package/dist/__tests__/cli.unit.test.d.ts +2 -0
- package/dist/__tests__/cli.unit.test.d.ts.map +1 -0
- package/dist/__tests__/evidence-source-inventory.unit.test.d.ts +2 -0
- package/dist/__tests__/evidence-source-inventory.unit.test.d.ts.map +1 -0
- package/dist/__tests__/guid-collision.unit.test.d.ts +2 -0
- package/dist/__tests__/guid-collision.unit.test.d.ts.map +1 -0
- package/dist/__tests__/guid-validator-surface.unit.test.d.ts +2 -0
- package/dist/__tests__/guid-validator-surface.unit.test.d.ts.map +1 -0
- package/dist/__tests__/load-asset-config.test.d.ts +2 -0
- package/dist/__tests__/load-asset-config.test.d.ts.map +1 -0
- package/dist/__tests__/material-cook-dependencies.unit.test.d.ts +2 -0
- package/dist/__tests__/material-cook-dependencies.unit.test.d.ts.map +1 -0
- package/dist/__tests__/material-cook-receipt.unit.test.d.ts +2 -0
- package/dist/__tests__/material-cook-receipt.unit.test.d.ts.map +1 -0
- package/dist/__tests__/material-cook-schema.unit.test.d.ts +2 -0
- package/dist/__tests__/material-cook-schema.unit.test.d.ts.map +1 -0
- package/dist/__tests__/mesh-bin-consumer-surface.unit.test.d.ts +2 -0
- package/dist/__tests__/mesh-bin-consumer-surface.unit.test.d.ts.map +1 -0
- package/dist/__tests__/mesh-bin-contract.unit.test.d.ts +2 -0
- package/dist/__tests__/mesh-bin-contract.unit.test.d.ts.map +1 -0
- package/dist/__tests__/meta-schema-optional.test.d.ts +2 -0
- package/dist/__tests__/meta-schema-optional.test.d.ts.map +1 -0
- package/dist/__tests__/meta-source-overrides.unit.test.d.ts +2 -0
- package/dist/__tests__/meta-source-overrides.unit.test.d.ts.map +1 -0
- package/dist/__tests__/native-cooker-registry.test.d.ts +2 -0
- package/dist/__tests__/native-cooker-registry.test.d.ts.map +1 -0
- package/dist/__tests__/offline-evidence-artifact-verification-owner.test-d.d.ts +2 -0
- package/dist/__tests__/offline-evidence-artifact-verification-owner.test-d.d.ts.map +1 -0
- package/dist/__tests__/offline-evidence.integration.test.d.ts +2 -0
- package/dist/__tests__/offline-evidence.integration.test.d.ts.map +1 -0
- package/dist/__tests__/owner-chain.integration.test.d.ts +2 -0
- package/dist/__tests__/owner-chain.integration.test.d.ts.map +1 -0
- package/dist/__tests__/pack-v2-fixture-migration.test.d.ts +2 -0
- package/dist/__tests__/pack-v2-fixture-migration.test.d.ts.map +1 -0
- package/dist/__tests__/pack-v2-schema.test.d.ts +2 -0
- package/dist/__tests__/pack-v2-schema.test.d.ts.map +1 -0
- package/dist/__tests__/pack.unit.test.d.ts +2 -0
- package/dist/__tests__/pack.unit.test.d.ts.map +1 -0
- package/dist/__tests__/package-finalizer.contract.test.d.ts +2 -0
- package/dist/__tests__/package-finalizer.contract.test.d.ts.map +1 -0
- package/dist/__tests__/producer-contract-schema.unit.test.d.ts +2 -0
- package/dist/__tests__/producer-contract-schema.unit.test.d.ts.map +1 -0
- package/dist/__tests__/resolve-asset-source.test.d.ts +2 -0
- package/dist/__tests__/resolve-asset-source.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-projection.unit.test.d.ts +2 -0
- package/dist/__tests__/runtime-projection.unit.test.d.ts.map +1 -0
- package/dist/__tests__/runtime.browser.test.d.ts +2 -0
- package/dist/__tests__/runtime.browser.test.d.ts.map +1 -0
- package/dist/__tests__/scanner-inventory.contract.test.d.ts +2 -0
- package/dist/__tests__/scanner-inventory.contract.test.d.ts.map +1 -0
- package/dist/__tests__/scanner-inventory.test.d.ts +2 -0
- package/dist/__tests__/scanner-inventory.test.d.ts.map +1 -0
- package/dist/__tests__/scanner-mount-cycle.test.d.ts +2 -0
- package/dist/__tests__/scanner-mount-cycle.test.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack-cli.integration.test.d.ts +2 -0
- package/dist/__tests__/scriptable-pack-cli.integration.test.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack-ddc-key.unit.test.d.ts +2 -0
- package/dist/__tests__/scriptable-pack-ddc-key.unit.test.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack.test-d.d.ts +2 -0
- package/dist/__tests__/scriptable-pack.test-d.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack.unit.test.d.ts +2 -0
- package/dist/__tests__/scriptable-pack.unit.test.d.ts.map +1 -0
- package/dist/__tests__/topology-actions.unit.test.d.ts +2 -0
- package/dist/__tests__/topology-actions.unit.test.d.ts.map +1 -0
- package/dist/__tests__/topology.unit.test.d.ts +2 -0
- package/dist/__tests__/topology.unit.test.d.ts.map +1 -0
- package/dist/artifact-path.d.ts +9 -0
- package/dist/artifact-path.d.ts.map +1 -0
- package/dist/artifact-path.mjs +53 -0
- package/dist/artifact-path.mjs.map +1 -0
- package/dist/atlas/run-atlas.d.ts +8 -0
- package/dist/atlas/run-atlas.d.ts.map +1 -0
- package/dist/atlas/shelf-pack.d.ts +55 -0
- package/dist/atlas/shelf-pack.d.ts.map +1 -0
- package/dist/bridge.d.ts +2 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.mjs +3 -0
- package/dist/bridge.mjs.map +1 -0
- package/dist/build.d.ts +19 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.mjs +10203 -0
- package/dist/build.mjs.map +1 -0
- package/dist/builtin.d.ts +44 -0
- package/dist/builtin.d.ts.map +1 -0
- package/dist/builtin.mjs +141 -0
- package/dist/builtin.mjs.map +1 -0
- package/dist/catalog-builder.d.ts +43 -0
- package/dist/catalog-builder.d.ts.map +1 -0
- package/dist/catalog-delta.d.ts +11 -0
- package/dist/catalog-delta.d.ts.map +1 -0
- package/dist/catalog-projection.d.ts +91 -0
- package/dist/catalog-projection.d.ts.map +1 -0
- package/dist/cli-asset.d.ts +22 -0
- package/dist/cli-asset.d.ts.map +1 -0
- package/dist/cli-asset.mjs +9697 -0
- package/dist/cli-asset.mjs.map +1 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.mjs +29 -0
- package/dist/config.mjs.map +1 -0
- package/dist/deriveAssetName.d.ts +15 -0
- package/dist/deriveAssetName.d.ts.map +1 -0
- package/dist/errors.d.ts +30 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.mjs +19 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/evidence/material-cook.d.ts +92 -0
- package/dist/evidence/material-cook.d.ts.map +1 -0
- package/dist/evidence/offline-evidence.d.ts +25 -0
- package/dist/evidence/offline-evidence.d.ts.map +1 -0
- package/dist/evidence/source-inventory.d.ts +29 -0
- package/dist/evidence/source-inventory.d.ts.map +1 -0
- package/dist/guid.d.ts +45 -0
- package/dist/guid.d.ts.map +1 -0
- package/dist/guid.mjs +94 -0
- package/dist/guid.mjs.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +8612 -0
- package/dist/index.mjs.map +1 -0
- package/dist/material/artifact-writer.d.ts +14 -0
- package/dist/material/artifact-writer.d.ts.map +1 -0
- package/dist/material-cook.d.ts +2 -0
- package/dist/material-cook.d.ts.map +1 -0
- package/dist/material-cook.mjs +248 -0
- package/dist/material-cook.mjs.map +1 -0
- package/dist/mesh-bin-contract.d.ts +36 -0
- package/dist/mesh-bin-contract.d.ts.map +1 -0
- package/dist/mesh-bin-contract.mjs +96 -0
- package/dist/mesh-bin-contract.mjs.map +1 -0
- package/dist/name.mjs +22 -0
- package/dist/name.mjs.map +1 -0
- package/dist/native-cooker-registry.d.ts +47 -0
- package/dist/native-cooker-registry.d.ts.map +1 -0
- package/dist/native-cooker.d.ts +3 -0
- package/dist/native-cooker.d.ts.map +1 -0
- package/dist/native-cooker.mjs +142 -0
- package/dist/native-cooker.mjs.map +1 -0
- package/dist/package-finalizer.d.ts +121 -0
- package/dist/package-finalizer.d.ts.map +1 -0
- package/dist/producer-contract.d.ts +19 -0
- package/dist/producer-contract.d.ts.map +1 -0
- package/dist/resolve-asset-source.d.ts +4 -0
- package/dist/resolve-asset-source.d.ts.map +1 -0
- package/dist/resolve-asset-source.mjs +109 -0
- package/dist/resolve-asset-source.mjs.map +1 -0
- package/dist/runtime-projection.d.ts +14 -0
- package/dist/runtime-projection.d.ts.map +1 -0
- package/dist/runtime-publication.d.ts +44 -0
- package/dist/runtime-publication.d.ts.map +1 -0
- package/dist/runtime.d.ts +8 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.mjs +7261 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/scanner.d.ts +113 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.mjs +8819 -0
- package/dist/scanner.mjs.map +1 -0
- package/dist/schema-compiled.d.ts +12 -0
- package/dist/schema-compiled.d.ts.map +1 -0
- package/dist/schema.mjs +7369 -0
- package/dist/schema.mjs.map +1 -0
- package/dist/scriptable-pack-node.d.ts +62 -0
- package/dist/scriptable-pack-node.d.ts.map +1 -0
- package/dist/scriptable-pack-node.mjs +1674 -0
- package/dist/scriptable-pack-node.mjs.map +1 -0
- package/dist/scriptable-pack-worker.d.ts +2 -0
- package/dist/scriptable-pack-worker.d.ts.map +1 -0
- package/dist/scriptable-pack-worker.mjs +224 -0
- package/dist/scriptable-pack-worker.mjs.map +1 -0
- package/dist/scriptable-pack.d.ts +558 -0
- package/dist/scriptable-pack.d.ts.map +1 -0
- package/dist/scriptable-pack.mjs +672 -0
- package/dist/scriptable-pack.mjs.map +1 -0
- package/dist/topology.d.ts +10 -0
- package/dist/topology.d.ts.map +1 -0
- package/package.json +154 -0
- package/schema/meta.schema.json +173 -0
- package/schema/pack.schema.json +232 -0
- package/src/__tests__/ai-recovery.unit.test.ts +114 -0
- package/src/__tests__/artifact-path.test.ts +41 -0
- package/src/__tests__/asset-evidence-error-hints.test.ts +46 -0
- package/src/__tests__/asset-evidence-lifecycle.test.ts +104 -0
- package/src/__tests__/asset-evidence-schema.test.ts +86 -0
- package/src/__tests__/atlas-cli-region-mismatch.test.ts +134 -0
- package/src/__tests__/atlas-error-code-owner.test-d.ts +23 -0
- package/src/__tests__/cli-asset-evidence.integration.test.ts +172 -0
- package/src/__tests__/cli.unit.test.ts +448 -0
- package/src/__tests__/evidence-source-inventory.unit.test.ts +37 -0
- package/src/__tests__/guid-collision.unit.test.ts +112 -0
- package/src/__tests__/guid-validator-surface.unit.test.ts +20 -0
- package/src/__tests__/load-asset-config.test.ts +121 -0
- package/src/__tests__/material-cook-dependencies.unit.test.ts +112 -0
- package/src/__tests__/material-cook-receipt.unit.test.ts +148 -0
- package/src/__tests__/material-cook-schema.unit.test.ts +152 -0
- package/src/__tests__/mesh-bin-consumer-surface.unit.test.ts +22 -0
- package/src/__tests__/mesh-bin-contract.unit.test.ts +32 -0
- package/src/__tests__/meta-schema-optional.test.ts +116 -0
- package/src/__tests__/meta-source-overrides.unit.test.ts +71 -0
- package/src/__tests__/native-cooker-registry.test.ts +64 -0
- package/src/__tests__/offline-evidence-artifact-verification-owner.test-d.ts +64 -0
- package/src/__tests__/offline-evidence.integration.test.ts +106 -0
- package/src/__tests__/owner-chain.integration.test.ts +78 -0
- package/src/__tests__/pack-v2-fixture-migration.test.ts +87 -0
- package/src/__tests__/pack-v2-schema.test.ts +142 -0
- package/src/__tests__/pack.unit.test.ts +2218 -0
- package/src/__tests__/package-finalizer.contract.test.ts +105 -0
- package/src/__tests__/producer-contract-schema.unit.test.ts +92 -0
- package/src/__tests__/resolve-asset-source.test.ts +121 -0
- package/src/__tests__/runtime-projection.unit.test.ts +87 -0
- package/src/__tests__/runtime.browser.test.ts +15 -0
- package/src/__tests__/scanner-inventory.contract.test.ts +167 -0
- package/src/__tests__/scanner-inventory.test.ts +76 -0
- package/src/__tests__/scanner-mount-cycle.test.ts +232 -0
- package/src/__tests__/scriptable-pack-cli.integration.test.ts +47 -0
- package/src/__tests__/scriptable-pack-ddc-key.unit.test.ts +63 -0
- package/src/__tests__/scriptable-pack.test-d.ts +131 -0
- package/src/__tests__/scriptable-pack.unit.test.ts +789 -0
- package/src/__tests__/topology-actions.unit.test.ts +94 -0
- package/src/__tests__/topology.unit.test.ts +85 -0
- package/src/artifact-path.ts +69 -0
- package/src/atlas/run-atlas.ts +358 -0
- package/src/atlas/shelf-pack.ts +172 -0
- package/src/atlas/upng-ambient.d.ts +13 -0
- package/src/bridge.ts +2 -0
- package/src/build.ts +139 -0
- package/src/builtin.ts +117 -0
- package/src/catalog-builder.ts +313 -0
- package/src/catalog-delta.ts +189 -0
- package/src/catalog-projection.ts +344 -0
- package/src/cli-asset.ts +586 -0
- package/src/config.ts +36 -0
- package/src/deriveAssetName.ts +42 -0
- package/src/errors.ts +47 -0
- package/src/evidence/material-cook.ts +411 -0
- package/src/evidence/offline-evidence.ts +90 -0
- package/src/evidence/source-inventory.ts +193 -0
- package/src/guid.ts +99 -0
- package/src/index.ts +108 -0
- package/src/material/artifact-writer.ts +26 -0
- package/src/material-cook.ts +15 -0
- package/src/mesh-bin-contract.ts +150 -0
- package/src/native-cooker-registry.ts +235 -0
- package/src/native-cooker.ts +2 -0
- package/src/package-finalizer.ts +394 -0
- package/src/producer-contract.ts +277 -0
- package/src/resolve-asset-source.ts +88 -0
- package/src/runtime-projection.ts +100 -0
- package/src/runtime-publication.ts +190 -0
- package/src/runtime.ts +23 -0
- package/src/scanner.ts +715 -0
- package/src/schema/material-cook.schema.json +119 -0
- package/src/schema-compiled.ts +238 -0
- package/src/scriptable-pack-node.ts +1394 -0
- package/src/scriptable-pack-worker.ts +308 -0
- package/src/scriptable-pack.ts +1006 -0
- package/src/topology.ts +157 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://github.com/ForgeaXGame/forgeax-engine/packages/pack/schema/pack.schema.json",
|
|
4
|
+
"title": "InternalTextPackage",
|
|
5
|
+
"description": "Schema for authored and cooked internal text packages.",
|
|
6
|
+
"$comment": "The ordinary durable consumer matrix is SCRIPTABLE_PACK_ASSET_KINDS in @forgeax/engine-pack/source. Pack kind fields remain open for registered producer extensions.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"required": ["schemaVersion", "kind", "assets"],
|
|
10
|
+
"properties": {
|
|
11
|
+
"schemaVersion": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"enum": ["1.0.0", "2.0.0"]
|
|
14
|
+
},
|
|
15
|
+
"kind": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"const": "internal-text-package"
|
|
18
|
+
},
|
|
19
|
+
"packageId": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"minLength": 1,
|
|
22
|
+
"description": "Stable producer-owned package identity. It survives package moves; path is only a locator."
|
|
23
|
+
},
|
|
24
|
+
"provenance": {
|
|
25
|
+
"$ref": "#/$defs/provenance"
|
|
26
|
+
},
|
|
27
|
+
"revision": {
|
|
28
|
+
"$ref": "#/$defs/revision"
|
|
29
|
+
},
|
|
30
|
+
"diagnostics": {
|
|
31
|
+
"type": "array",
|
|
32
|
+
"items": { "$ref": "#/$defs/diagnostic" }
|
|
33
|
+
},
|
|
34
|
+
"assets": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": {
|
|
37
|
+
"$ref": "#/$defs/asset"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"allOf": [
|
|
42
|
+
{
|
|
43
|
+
"if": {
|
|
44
|
+
"required": ["packageId"],
|
|
45
|
+
"properties": {
|
|
46
|
+
"packageId": {},
|
|
47
|
+
"schemaVersion": { "const": "2.0.0" }
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"then": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"properties": {
|
|
53
|
+
"assets": {
|
|
54
|
+
"type": "array",
|
|
55
|
+
"items": {
|
|
56
|
+
"allOf": [
|
|
57
|
+
{ "$ref": "#/$defs/assetV2" },
|
|
58
|
+
{
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": { "execution": {} },
|
|
61
|
+
"required": ["execution"]
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"$defs": {
|
|
71
|
+
"guid36": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"format": "uuid"
|
|
74
|
+
},
|
|
75
|
+
"asset": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"additionalProperties": false,
|
|
78
|
+
"required": ["guid", "kind", "payload", "refs"],
|
|
79
|
+
"properties": {
|
|
80
|
+
"guid": {
|
|
81
|
+
"$ref": "#/$defs/guid36",
|
|
82
|
+
"description": "Unique GUID for this asset entry."
|
|
83
|
+
},
|
|
84
|
+
"kind": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"minLength": 1,
|
|
87
|
+
"description": "Asset kind identifier, e.g. 'MaterialAsset'."
|
|
88
|
+
},
|
|
89
|
+
"name": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"minLength": 1,
|
|
92
|
+
"description": "Optional display name for this asset. Add-only field for backward compatibility with old pack files that lack it."
|
|
93
|
+
},
|
|
94
|
+
"sourceKey": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"minLength": 1,
|
|
97
|
+
"description": "Producer-owned stable key used to match imported output topology."
|
|
98
|
+
},
|
|
99
|
+
"sourceIndex": {
|
|
100
|
+
"type": "integer",
|
|
101
|
+
"minimum": 0,
|
|
102
|
+
"description": "Producer-declared output position; not an identity key when sourceKey is present."
|
|
103
|
+
},
|
|
104
|
+
"execution": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"enum": ["direct", "cooked"],
|
|
107
|
+
"description": "Explicit authoring execution mode; never inferred from package path."
|
|
108
|
+
},
|
|
109
|
+
"payload": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"description": "Serialized asset payload. Free-form object."
|
|
112
|
+
},
|
|
113
|
+
"refs": {
|
|
114
|
+
"type": "array",
|
|
115
|
+
"items": { "$ref": "#/$defs/guid36" }
|
|
116
|
+
},
|
|
117
|
+
"artifacts": { "$ref": "#/$defs/artifacts" }
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"assetV2": {
|
|
121
|
+
"allOf": [
|
|
122
|
+
{ "$ref": "#/$defs/asset" },
|
|
123
|
+
{
|
|
124
|
+
"type": "object",
|
|
125
|
+
"required": ["artifacts"],
|
|
126
|
+
"properties": {
|
|
127
|
+
"artifacts": { "$ref": "#/$defs/artifacts" }
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
"artifacts": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"additionalProperties": false,
|
|
135
|
+
"patternProperties": {
|
|
136
|
+
"^[A-Za-z0-9][A-Za-z0-9._/-]*$": {
|
|
137
|
+
"$ref": "#/$defs/artifactDescriptor"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"artifactDescriptor": {
|
|
142
|
+
"type": "object",
|
|
143
|
+
"additionalProperties": false,
|
|
144
|
+
"required": ["path", "mediaType"],
|
|
145
|
+
"properties": {
|
|
146
|
+
"path": { "type": "string", "minLength": 1 },
|
|
147
|
+
"mediaType": { "type": "string", "minLength": 1 },
|
|
148
|
+
"assetCodec": { "$ref": "#/$defs/assetCodec" },
|
|
149
|
+
"contentEncoding": { "enum": ["identity", "zstd"] },
|
|
150
|
+
"byteLength": { "type": "integer", "minimum": 0 },
|
|
151
|
+
"integrity": { "$ref": "#/$defs/integrity" }
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"assetCodec": {
|
|
155
|
+
"type": "object",
|
|
156
|
+
"additionalProperties": false,
|
|
157
|
+
"required": ["name"],
|
|
158
|
+
"properties": {
|
|
159
|
+
"name": { "type": "string", "minLength": 1 },
|
|
160
|
+
"profile": { "type": "string", "minLength": 1 },
|
|
161
|
+
"version": { "type": "string", "minLength": 1 }
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"integrity": {
|
|
165
|
+
"type": "object",
|
|
166
|
+
"additionalProperties": false,
|
|
167
|
+
"required": ["algorithm", "digest"],
|
|
168
|
+
"properties": {
|
|
169
|
+
"algorithm": { "const": "sha256" },
|
|
170
|
+
"digest": { "type": "string", "minLength": 1 }
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"provenance": {
|
|
174
|
+
"type": "object",
|
|
175
|
+
"additionalProperties": false,
|
|
176
|
+
"required": ["provider", "version"],
|
|
177
|
+
"properties": {
|
|
178
|
+
"provider": { "type": "string", "minLength": 1 },
|
|
179
|
+
"version": { "type": "string", "minLength": 1 },
|
|
180
|
+
"source": { "type": "string", "minLength": 1 }
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"revision": {
|
|
184
|
+
"type": "object",
|
|
185
|
+
"additionalProperties": false,
|
|
186
|
+
"required": ["digest", "observedAt", "rootId"],
|
|
187
|
+
"properties": {
|
|
188
|
+
"digest": { "type": "string", "minLength": 1 },
|
|
189
|
+
"observedAt": { "type": "number" },
|
|
190
|
+
"rootId": { "type": "string", "minLength": 1 }
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"diagnostic": {
|
|
194
|
+
"type": "object",
|
|
195
|
+
"additionalProperties": false,
|
|
196
|
+
"required": ["code", "severity"],
|
|
197
|
+
"properties": {
|
|
198
|
+
"code": { "type": "string", "minLength": 1 },
|
|
199
|
+
"severity": { "type": "string", "enum": ["info", "warning", "blocking"] },
|
|
200
|
+
"message": { "type": "string" },
|
|
201
|
+
"subject": { "$ref": "#/$defs/subject" },
|
|
202
|
+
"expected": { "type": "string", "minLength": 1 },
|
|
203
|
+
"actual": { "type": "string" },
|
|
204
|
+
"hint": { "type": "string", "minLength": 1 },
|
|
205
|
+
"authority": { "type": "string", "enum": ["producer", "pack", "catalog"] },
|
|
206
|
+
"evidence": { "type": "array", "items": { "type": "object" } },
|
|
207
|
+
"recoveryIntents": { "type": "array", "items": { "type": "string", "minLength": 1 } }
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"subject": {
|
|
211
|
+
"type": "object",
|
|
212
|
+
"additionalProperties": false,
|
|
213
|
+
"required": ["type", "id"],
|
|
214
|
+
"properties": {
|
|
215
|
+
"type": { "type": "string", "enum": ["asset", "package", "resource"] },
|
|
216
|
+
"id": { "type": "string", "minLength": 1 }
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
"relation": {
|
|
220
|
+
"type": "object",
|
|
221
|
+
"additionalProperties": false,
|
|
222
|
+
"required": ["from", "to", "type", "provenance"],
|
|
223
|
+
"properties": {
|
|
224
|
+
"from": { "$ref": "#/$defs/subject" },
|
|
225
|
+
"to": { "$ref": "#/$defs/subject" },
|
|
226
|
+
"type": { "type": "string", "minLength": 1 },
|
|
227
|
+
"policy": { "type": "object" },
|
|
228
|
+
"provenance": { "$ref": "#/$defs/provenance" }
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import type {
|
|
3
|
+
CatalogEntry,
|
|
4
|
+
ImportedOutputDeclaration,
|
|
5
|
+
ProducerContractDiagnostic,
|
|
6
|
+
} from '@forgeax/engine-types';
|
|
7
|
+
import { describe, expect, it } from 'vitest';
|
|
8
|
+
import { validateProducerOutputs } from '../producer-contract.js';
|
|
9
|
+
|
|
10
|
+
const DUPLICATE_GUID = '019e2cc6-0c86-79da-aa76-b0984c86d411';
|
|
11
|
+
const OTHER_GUID = '019e2cc6-0c86-79da-aa76-b0984c86d412';
|
|
12
|
+
|
|
13
|
+
interface RecoverySignal {
|
|
14
|
+
readonly authority: 'authoritative' | 'degraded';
|
|
15
|
+
readonly diagnostic?: {
|
|
16
|
+
readonly code: string;
|
|
17
|
+
readonly hint?: string;
|
|
18
|
+
readonly subject?: { readonly id?: string };
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface RecoveryDecision {
|
|
23
|
+
readonly action: 'repair-input' | 'rollback-verified-revision' | 'reject-update';
|
|
24
|
+
readonly code: string;
|
|
25
|
+
readonly hint: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function decideRecovery(result: RecoverySignal): RecoveryDecision {
|
|
29
|
+
const diagnostic = result.diagnostic;
|
|
30
|
+
if (diagnostic === undefined || diagnostic.hint === undefined) {
|
|
31
|
+
return { action: 'reject-update', code: 'unknown', hint: 'keep the last verified result' };
|
|
32
|
+
}
|
|
33
|
+
if (result.authority === 'degraded' && diagnostic.code === 'catalog-revision-stale') {
|
|
34
|
+
return {
|
|
35
|
+
action: 'rollback-verified-revision',
|
|
36
|
+
code: diagnostic.code,
|
|
37
|
+
hint: diagnostic.hint,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (diagnostic.code === 'duplicate-source-key') {
|
|
41
|
+
return { action: 'repair-input', code: diagnostic.code, hint: diagnostic.hint };
|
|
42
|
+
}
|
|
43
|
+
return { action: 'reject-update', code: diagnostic.code, hint: diagnostic.hint };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function repairDuplicateKey(
|
|
47
|
+
entries: readonly CatalogEntry[],
|
|
48
|
+
diagnostic: ProducerContractDiagnostic,
|
|
49
|
+
): readonly CatalogEntry[] {
|
|
50
|
+
return entries.map((entry) =>
|
|
51
|
+
entry.guid === diagnostic.subject?.id
|
|
52
|
+
? { ...entry, sourceKey: `${entry.sourceKey ?? 'output'}/repaired` }
|
|
53
|
+
: entry,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
describe('AI recovery from canonical catalog fields', () => {
|
|
58
|
+
it('keeps every non-current lifecycle on a safe recovery path', () => {
|
|
59
|
+
const schema = JSON.parse(
|
|
60
|
+
readFileSync(new URL('../../../../asset-authority.schema.json', import.meta.url), 'utf8'),
|
|
61
|
+
) as {
|
|
62
|
+
'x-forgeax-audit': {
|
|
63
|
+
aiOperations: string[];
|
|
64
|
+
recoveryByLifecycle: Record<string, string[]>;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const { aiOperations, recoveryByLifecycle } = schema['x-forgeax-audit'];
|
|
68
|
+
for (const lifecycle of ['missing', 'cooking', 'current', 'stale', 'failed']) {
|
|
69
|
+
const actions = recoveryByLifecycle[lifecycle];
|
|
70
|
+
expect(actions?.every((action) => aiOperations.includes(action))).toBe(true);
|
|
71
|
+
if (lifecycle !== 'current') expect(actions?.length).toBeGreaterThan(0);
|
|
72
|
+
}
|
|
73
|
+
expect(aiOperations).toEqual(
|
|
74
|
+
expect.arrayContaining(['inspect', 'rebuild', 'cold-cook', 'preview-LKG', 'stop-publish']),
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('consumes the producer validator result and repairs a duplicate key', () => {
|
|
79
|
+
const outputs: ImportedOutputDeclaration[] = [
|
|
80
|
+
{ guid: DUPLICATE_GUID, kind: 'nebula/fragment', sourceKey: 'fragment/main', sourceIndex: 0 },
|
|
81
|
+
{ guid: OTHER_GUID, kind: 'nebula/fragment', sourceKey: 'fragment/main', sourceIndex: 1 },
|
|
82
|
+
];
|
|
83
|
+
const contract = validateProducerOutputs(outputs);
|
|
84
|
+
expect(contract.ok).toBe(false);
|
|
85
|
+
if (contract.ok) return;
|
|
86
|
+
|
|
87
|
+
const decision = decideRecovery({ authority: 'degraded', diagnostic: contract.error });
|
|
88
|
+
expect(decision).toMatchObject({ action: 'repair-input', code: contract.error.code });
|
|
89
|
+
const entries: CatalogEntry[] = outputs.map((output) => ({
|
|
90
|
+
guid: output.guid,
|
|
91
|
+
packageUrl: '/duplicate/main.pack.json',
|
|
92
|
+
sourcePath: 'duplicate.pack.json',
|
|
93
|
+
kind: output.kind,
|
|
94
|
+
packageId: 'pkg/ai-recovery',
|
|
95
|
+
...(output.sourceKey === undefined ? {} : { sourceKey: output.sourceKey }),
|
|
96
|
+
sourceIndex: output.sourceIndex,
|
|
97
|
+
}));
|
|
98
|
+
const repairedEntries = repairDuplicateKey(entries, contract.error);
|
|
99
|
+
expect(new Set(repairedEntries.map((entry) => entry.sourceKey)).size).toBe(2);
|
|
100
|
+
expect(decision.hint).toBe(contract.error.hint);
|
|
101
|
+
const repaired = repairedEntries.map((entry) => {
|
|
102
|
+
if (entry.sourceKey === undefined || entry.sourceIndex === undefined) {
|
|
103
|
+
throw new Error(`repaired catalog row ${entry.guid} lost output topology`);
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
guid: entry.guid,
|
|
107
|
+
kind: entry.kind,
|
|
108
|
+
sourceKey: entry.sourceKey,
|
|
109
|
+
sourceIndex: entry.sourceIndex,
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
expect(validateProducerOutputs(repaired)).toMatchObject({ ok: true });
|
|
113
|
+
});
|
|
114
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { validateArtifactPath } from '../artifact-path.js';
|
|
3
|
+
|
|
4
|
+
const context = {
|
|
5
|
+
packageRoot: '/packages/hero',
|
|
6
|
+
guid: '11111111-1111-4111-8111-111111111111',
|
|
7
|
+
artifactKey: 'mesh',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
describe('artifact locator validation', () => {
|
|
11
|
+
it('accepts a normalized package-relative locator', () => {
|
|
12
|
+
const result = validateArtifactPath('artifacts/hero.bin', context);
|
|
13
|
+
|
|
14
|
+
expect(result).toEqual({ ok: true, value: 'artifacts/hero.bin' });
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it.each([
|
|
18
|
+
['parent traversal', '../outside.bin'],
|
|
19
|
+
['encoded traversal', '%2e%2e%2foutside.bin'],
|
|
20
|
+
['double encoded traversal', '%252e%252e%252foutside.bin'],
|
|
21
|
+
['backslash traversal', '..\\outside.bin'],
|
|
22
|
+
['absolute POSIX path', '/tmp/outside.bin'],
|
|
23
|
+
['absolute Windows path', 'C:\\tmp\\outside.bin'],
|
|
24
|
+
['remote URL', 'https://example.test/outside.bin'],
|
|
25
|
+
])('rejects %s before any file read', (_label, locator) => {
|
|
26
|
+
const readFile = vi.fn((_path: string) => new Uint8Array());
|
|
27
|
+
const result = validateArtifactPath(locator, context);
|
|
28
|
+
|
|
29
|
+
if (result.ok) {
|
|
30
|
+
readFile(result.value);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
expect(result.ok).toBe(false);
|
|
34
|
+
expect(readFile).not.toHaveBeenCalled();
|
|
35
|
+
if (!result.ok) {
|
|
36
|
+
expect(result.error.code).toBe('asset-artifact-path-invalid');
|
|
37
|
+
expect(result.error.detail.guid).toBe(context.guid);
|
|
38
|
+
expect(result.error.detail.artifactKey).toBe(context.artifactKey);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ASSET_EVIDENCE_ERROR_HINTS, projectAssetEvidence } from '@forgeax/engine-types';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
const guid = '11111111-1111-4111-8111-111111111111';
|
|
5
|
+
|
|
6
|
+
describe('AssetEvidence structured recovery hints', () => {
|
|
7
|
+
it('provides non-empty hints for every closed evidence error code', () => {
|
|
8
|
+
const codes = [
|
|
9
|
+
'asset-evidence-capability-missing',
|
|
10
|
+
'asset-evidence-source-conflict',
|
|
11
|
+
'asset-evidence-locator-conflict',
|
|
12
|
+
'asset-evidence-receipt-conflict',
|
|
13
|
+
'asset-evidence-digest-mismatch',
|
|
14
|
+
] as const;
|
|
15
|
+
|
|
16
|
+
for (const code of codes) {
|
|
17
|
+
expect(ASSET_EVIDENCE_ERROR_HINTS[code]).toBeTruthy();
|
|
18
|
+
expect(ASSET_EVIDENCE_ERROR_HINTS[code]).not.toContain('message');
|
|
19
|
+
expect(ASSET_EVIDENCE_ERROR_HINTS[code]).toMatch(
|
|
20
|
+
/inspect|repair|retry|refresh|capability|rerun|source|rebuild|verify|catalog|package/,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('keeps mismatch errors distinct from unknown capability', () => {
|
|
26
|
+
const result = projectAssetEvidence({
|
|
27
|
+
guid,
|
|
28
|
+
source: { origin: 'sourceMeta', inputFingerprint: 'fp-1' },
|
|
29
|
+
locator: { packageUrl: '/assets/data.pack.json' },
|
|
30
|
+
receipt: {
|
|
31
|
+
guid,
|
|
32
|
+
origin: 'sourceMeta',
|
|
33
|
+
status: 'succeeded',
|
|
34
|
+
inputFingerprint: 'fp-1',
|
|
35
|
+
outputDigest: 'receipt-digest',
|
|
36
|
+
},
|
|
37
|
+
packageVerification: { status: 'passed', digest: 'package-digest' },
|
|
38
|
+
artifacts: {},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
expect(result.ok).toBe(false);
|
|
42
|
+
if (result.ok) return;
|
|
43
|
+
expect(result.error.code).toBe('asset-evidence-digest-mismatch');
|
|
44
|
+
expect(result.error.detail).toMatchObject({ guid });
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { projectAssetEvidence } from '@forgeax/engine-types';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
const guid = '11111111-1111-4111-8111-111111111111';
|
|
5
|
+
const receipt = {
|
|
6
|
+
guid,
|
|
7
|
+
origin: 'sourceMeta' as const,
|
|
8
|
+
status: 'succeeded' as const,
|
|
9
|
+
inputFingerprint: 'fp-1',
|
|
10
|
+
outputDigest: 'digest-1',
|
|
11
|
+
};
|
|
12
|
+
const descriptor = {
|
|
13
|
+
path: 'artifacts/data.bin',
|
|
14
|
+
mediaType: 'application/octet-stream',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function input(overrides: Record<string, unknown> = {}) {
|
|
18
|
+
return {
|
|
19
|
+
guid,
|
|
20
|
+
source: { origin: 'sourceMeta' as const, inputFingerprint: 'fp-1' },
|
|
21
|
+
locator: { packageUrl: '/assets/data.pack.json' },
|
|
22
|
+
artifacts: { data: descriptor },
|
|
23
|
+
runtime: { status: 'unknown' as const },
|
|
24
|
+
...overrides,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
describe('AssetEvidence lifecycle', () => {
|
|
29
|
+
it('distinguishes authored, uncooked, failed, current, stale, and shipped states', () => {
|
|
30
|
+
const authored = projectAssetEvidence(
|
|
31
|
+
input({
|
|
32
|
+
source: { origin: 'authoredPack' },
|
|
33
|
+
receipt: { ...receipt, origin: 'authoredPack' },
|
|
34
|
+
}),
|
|
35
|
+
);
|
|
36
|
+
const uncooked = projectAssetEvidence(input());
|
|
37
|
+
const failed = projectAssetEvidence(
|
|
38
|
+
input({
|
|
39
|
+
receipt: {
|
|
40
|
+
...receipt,
|
|
41
|
+
status: 'failed',
|
|
42
|
+
error: {
|
|
43
|
+
code: 'import-failed',
|
|
44
|
+
expected: 'source imports',
|
|
45
|
+
hint: 'fix source and recook',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
);
|
|
50
|
+
const current = projectAssetEvidence(input({ receipt }));
|
|
51
|
+
const stale = projectAssetEvidence(
|
|
52
|
+
input({
|
|
53
|
+
source: { origin: 'sourceMeta', inputFingerprint: 'fp-2' },
|
|
54
|
+
receipt,
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
57
|
+
const shipped = projectAssetEvidence(input({ source: undefined, receipt }));
|
|
58
|
+
|
|
59
|
+
expect(authored.ok && authored.value.cook.status).toBe('notRequired');
|
|
60
|
+
expect(uncooked.ok && uncooked.value.cook.status).toBe('notCooked');
|
|
61
|
+
expect(failed.ok && failed.value.cook.status).toBe('failed');
|
|
62
|
+
expect(current.ok && current.value.cook.freshness).toBe('current');
|
|
63
|
+
expect(stale.ok && stale.value.cook.freshness).toBe('stale');
|
|
64
|
+
expect(shipped.ok && shipped.value.cook.freshness).toBe('unknown');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('returns a structured conflict instead of masking contradictory evidence', () => {
|
|
68
|
+
const conflict = projectAssetEvidence(
|
|
69
|
+
input({
|
|
70
|
+
locators: [{ packageUrl: '/assets/a.pack.json' }, { packageUrl: '/assets/b.pack.json' }],
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
expect(conflict.ok).toBe(false);
|
|
75
|
+
if (conflict.ok) return;
|
|
76
|
+
expect(conflict.error.code).toBe('asset-evidence-locator-conflict');
|
|
77
|
+
expect(conflict.error.expected).toContain('one package locator');
|
|
78
|
+
expect(conflict.error.hint).toBeTruthy();
|
|
79
|
+
expect(conflict.error.detail).toMatchObject({ guid });
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('does not treat a failed recook as current evidence', () => {
|
|
83
|
+
const failed = projectAssetEvidence(
|
|
84
|
+
input({
|
|
85
|
+
source: { origin: 'sourceMeta', inputFingerprint: 'fp-2' },
|
|
86
|
+
receipt: {
|
|
87
|
+
...receipt,
|
|
88
|
+
inputFingerprint: 'fp-1',
|
|
89
|
+
status: 'failed',
|
|
90
|
+
error: {
|
|
91
|
+
code: 'producer-failed',
|
|
92
|
+
expected: 'a validated output',
|
|
93
|
+
hint: 'repair the source and recook',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
}),
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
expect(failed.ok).toBe(true);
|
|
100
|
+
if (!failed.ok) return;
|
|
101
|
+
expect(failed.value.cook.status).toBe('failed');
|
|
102
|
+
expect(failed.value.cook.freshness).not.toBe('current');
|
|
103
|
+
});
|
|
104
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { projectAssetEvidence } from '@forgeax/engine-types';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { parsePackV2 } from '../index.js';
|
|
4
|
+
|
|
5
|
+
const guid = '11111111-1111-4111-8111-111111111111';
|
|
6
|
+
|
|
7
|
+
describe('AssetEvidence pack projection schema', () => {
|
|
8
|
+
it('retains a package locator and asset-local artifact facts separately', () => {
|
|
9
|
+
const pack = parsePackV2({
|
|
10
|
+
schemaVersion: '2.0.0',
|
|
11
|
+
kind: 'internal-text-package',
|
|
12
|
+
assets: [
|
|
13
|
+
{
|
|
14
|
+
guid,
|
|
15
|
+
kind: 'host-config',
|
|
16
|
+
payload: { value: 1 },
|
|
17
|
+
refs: [],
|
|
18
|
+
artifacts: {
|
|
19
|
+
source: {
|
|
20
|
+
path: 'artifacts/source.json',
|
|
21
|
+
mediaType: 'application/json',
|
|
22
|
+
assetCodec: { name: 'json' },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
expect(pack.ok).toBe(true);
|
|
30
|
+
if (!pack.ok) return;
|
|
31
|
+
const asset = pack.value.assets[0];
|
|
32
|
+
expect(asset).toBeDefined();
|
|
33
|
+
if (asset === undefined) return;
|
|
34
|
+
const evidence = projectAssetEvidence({
|
|
35
|
+
guid,
|
|
36
|
+
source: { origin: 'sourceMeta', sourcePath: 'assets/config.json', inputFingerprint: 'fp-1' },
|
|
37
|
+
locator: { packageUrl: '/assets/config.pack.json' },
|
|
38
|
+
receipt: {
|
|
39
|
+
guid,
|
|
40
|
+
origin: 'sourceMeta',
|
|
41
|
+
status: 'succeeded',
|
|
42
|
+
inputFingerprint: 'fp-1',
|
|
43
|
+
outputDigest: 'digest-1',
|
|
44
|
+
},
|
|
45
|
+
packageVerification: { status: 'passed', digest: 'digest-1' },
|
|
46
|
+
artifacts: asset.artifacts,
|
|
47
|
+
runtime: { status: 'unknown' },
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
expect(evidence.ok).toBe(true);
|
|
51
|
+
if (!evidence.ok) return;
|
|
52
|
+
expect(evidence.value.packageUrl).toBe('/assets/config.pack.json');
|
|
53
|
+
const sourceArtifact = evidence.value.artifacts.source;
|
|
54
|
+
expect(sourceArtifact).toBeDefined();
|
|
55
|
+
if (sourceArtifact === undefined) return;
|
|
56
|
+
expect(sourceArtifact.verification).toBe('notChecked');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('rejects evidence projection when receipt GUID or digest is not the product GUID', async () => {
|
|
60
|
+
const { projectCookProductEvidence } = await import('@forgeax/engine-types');
|
|
61
|
+
const result = projectCookProductEvidence({
|
|
62
|
+
guid,
|
|
63
|
+
payload: { kind: 'host-config', value: 1 },
|
|
64
|
+
refs: [],
|
|
65
|
+
artifacts: {
|
|
66
|
+
source: {
|
|
67
|
+
path: 'artifacts/source.json',
|
|
68
|
+
mediaType: 'application/json',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
digest: 'digest-1',
|
|
72
|
+
receipt: {
|
|
73
|
+
guid: '22222222-2222-4222-8222-222222222222',
|
|
74
|
+
origin: 'sourceMeta',
|
|
75
|
+
status: 'succeeded',
|
|
76
|
+
inputFingerprint: 'fp-1',
|
|
77
|
+
outputDigest: 'digest-2',
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
expect(result).toMatchObject({
|
|
82
|
+
ok: false,
|
|
83
|
+
error: { code: 'asset-evidence-receipt-conflict' },
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
});
|