project-tiny-context-harness 0.8.4 → 0.8.6
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 +21 -21
- package/README.md +394 -363
- package/assets/README.md +570 -514
- package/assets/README.zh-CN.md +331 -300
- package/assets/agents/.gitkeep +1 -1
- package/assets/agents/AGENTS_CORE.md +45 -25
- package/assets/context_templates/architecture.md +26 -25
- package/assets/context_templates/area.md +32 -31
- package/assets/context_templates/context.toml +30 -24
- package/assets/context_templates/deployment.md +35 -35
- package/assets/context_templates/global.md +57 -57
- package/assets/context_templates/product-surface-contract.md +70 -70
- package/assets/context_templates/screen-contract.md +189 -189
- package/assets/context_templates/verification.md +31 -30
- package/assets/github/.gitkeep +1 -1
- package/assets/github/harness.yml +39 -39
- package/assets/make/.gitkeep +1 -1
- package/assets/make/ty-context.mk +48 -48
- package/assets/skills/context_development_engineer/SKILL.md +155 -122
- package/assets/skills/context_full_project_export/SKILL.md +28 -28
- package/assets/skills/context_harness_upgrade/SKILL.md +60 -60
- package/assets/skills/context_product_plan/SKILL.md +99 -79
- package/assets/skills/context_surface_contract/SKILL.md +191 -191
- package/assets/skills/context_uiux_design/SKILL.md +171 -171
- package/assets/skills/design-resource-authoring/SKILL.md +86 -84
- package/assets/skills/design-resource-authoring/references/downstream-handoff.md +138 -123
- package/assets/skills/design-resource-authoring/references/open-design-provider.md +132 -127
- package/assets/skills/design-resource-authoring/references/resource-selection.md +181 -154
- package/assets/skills/design-system-authoring/SKILL.md +57 -57
- package/assets/skills/design-system-authoring/agents/openai.yaml +6 -6
- package/assets/skills/design-system-authoring/references/authority-adoption.md +48 -48
- package/assets/skills/design-system-authoring/references/open-design-design-system-provider.md +110 -110
- package/assets/skills/long-task-workflow/SKILL.md +98 -92
- package/assets/skills/long-task-workflow/agents/openai.yaml +3 -1
- package/assets/skills/long-task-workflow/references/authority-lifecycle.md +72 -72
- package/assets/skills/long-task-workflow/references/contract-authoring.md +122 -101
- package/assets/skills/long-task-workflow/references/evidence-design.md +82 -61
- package/assets/skills/long-task-workflow/references/source-authoring.md +109 -90
- package/assets/skills/source-plan-authoring/SKILL.md +14 -14
- package/assets/tools/validate_context.py +442 -442
- package/dist/commands/long-task-authoring.js +27 -2
- package/dist/lib/context-default-footprint.js +2 -0
- package/dist/lib/context-manifest.js +6 -0
- package/dist/lib/context-templates.js +1 -1
- package/dist/lib/design-resource-fact-enums.d.ts +20 -0
- package/dist/lib/design-resource-fact-enums.js +170 -0
- package/dist/lib/design-resource-fact-locator-extractors.d.ts +8 -0
- package/dist/lib/design-resource-fact-locator-extractors.js +108 -0
- package/dist/lib/design-resource-fact-locator-resolver.d.ts +3 -0
- package/dist/lib/design-resource-fact-locator-resolver.js +112 -0
- package/dist/lib/design-resource-fact-locator-validation.d.ts +5 -0
- package/dist/lib/design-resource-fact-locator-validation.js +16 -0
- package/dist/lib/design-resource-fact-manifest-catalog.d.ts +4 -0
- package/dist/lib/design-resource-fact-manifest-catalog.js +249 -0
- package/dist/lib/design-resource-fact-manifest-model.d.ts +91 -0
- package/dist/lib/design-resource-fact-manifest-model.js +21 -0
- package/dist/lib/design-resource-fact-manifest-shape-axes.d.ts +6 -0
- package/dist/lib/design-resource-fact-manifest-shape-axes.js +159 -0
- package/dist/lib/design-resource-fact-manifest-shape-evidence.d.ts +4 -0
- package/dist/lib/design-resource-fact-manifest-shape-evidence.js +59 -0
- package/dist/lib/design-resource-fact-manifest-shape-facts.d.ts +4 -0
- package/dist/lib/design-resource-fact-manifest-shape-facts.js +109 -0
- package/dist/lib/design-resource-fact-manifest-shape-inspector.d.ts +5 -0
- package/dist/lib/design-resource-fact-manifest-shape-inspector.js +144 -0
- package/dist/lib/design-resource-fact-manifest-shape.d.ts +7 -0
- package/dist/lib/design-resource-fact-manifest-shape.js +75 -0
- package/dist/lib/design-resource-fact-manifest-types.d.ts +3 -0
- package/dist/lib/design-resource-fact-manifest-types.js +3 -0
- package/dist/lib/design-resource-fact-manifest-universe.d.ts +5 -0
- package/dist/lib/design-resource-fact-manifest-universe.js +50 -0
- package/dist/lib/design-resource-fact-manifest-validation.d.ts +3 -0
- package/dist/lib/design-resource-fact-manifest-validation.js +106 -0
- package/dist/lib/design-resource-fact-policy.d.ts +18 -0
- package/dist/lib/design-resource-fact-policy.js +72 -1
- package/dist/lib/design-resource-fact-property-methods.d.ts +3 -0
- package/dist/lib/design-resource-fact-property-methods.js +158 -0
- package/dist/lib/design-resource-fact-shape-primitives.d.ts +3 -0
- package/dist/lib/design-resource-fact-shape-primitives.js +18 -0
- package/dist/lib/design-resource-fact-types.d.ts +164 -0
- package/dist/lib/design-resource-fact-types.js +1 -0
- package/dist/lib/design-resource-fact-universe-assets.d.ts +4 -0
- package/dist/lib/design-resource-fact-universe-assets.js +71 -0
- package/dist/lib/design-resource-fact-universe-catalog.d.ts +4 -0
- package/dist/lib/design-resource-fact-universe-catalog.js +151 -0
- package/dist/lib/design-resource-fact-universe-conditions.d.ts +2 -0
- package/dist/lib/design-resource-fact-universe-conditions.js +92 -0
- package/dist/lib/design-resource-fact-universe-facts.d.ts +4 -0
- package/dist/lib/design-resource-fact-universe-facts.js +108 -0
- package/dist/lib/design-resource-fact-universe-helpers.d.ts +30 -0
- package/dist/lib/design-resource-fact-universe-helpers.js +167 -0
- package/dist/lib/design-resource-fact-universe-inspector.d.ts +7 -0
- package/dist/lib/design-resource-fact-universe-inspector.js +119 -0
- package/dist/lib/design-resource-fact-universe-proof.d.ts +4 -0
- package/dist/lib/design-resource-fact-universe-proof.js +113 -0
- package/dist/lib/design-resource-fact-universe-subjects.d.ts +5 -0
- package/dist/lib/design-resource-fact-universe-subjects.js +97 -0
- package/dist/lib/design-resource-fact-universe-variations.d.ts +2 -0
- package/dist/lib/design-resource-fact-universe-variations.js +75 -0
- package/dist/lib/design-resource-fact-value-validation.d.ts +2 -0
- package/dist/lib/design-resource-fact-value-validation.js +80 -0
- package/dist/lib/design-resource-handoff-file-primitives.js +2 -0
- package/dist/lib/design-resource-handoff-file-validation.js +13 -100
- package/dist/lib/design-resource-handoff-policy.d.ts +1 -0
- package/dist/lib/design-resource-handoff-policy.js +118 -11
- package/dist/lib/design-resource-handoff-shape-evidence.js +46 -3
- package/dist/lib/design-resource-handoff-shape-primitives.d.ts +5 -0
- package/dist/lib/design-resource-handoff-shape-primitives.js +28 -0
- package/dist/lib/design-resource-handoff-shape-structure.js +143 -22
- package/dist/lib/design-resource-handoff-shape.js +25 -0
- package/dist/lib/design-resource-handoff-types.d.ts +97 -21
- package/dist/lib/design-resource-handoff-types.js +22 -0
- package/dist/lib/design-resource-handoff-validation-coverage.d.ts +1 -1
- package/dist/lib/design-resource-handoff-validation-coverage.js +145 -118
- package/dist/lib/design-resource-handoff-validation-fact-cells.d.ts +2 -0
- package/dist/lib/design-resource-handoff-validation-fact-cells.js +60 -0
- package/dist/lib/design-resource-handoff-validation-fact-records.d.ts +2 -0
- package/dist/lib/design-resource-handoff-validation-fact-records.js +90 -0
- package/dist/lib/design-resource-handoff-validation-facts.js +10 -94
- package/dist/lib/design-resource-handoff-validation-proofs.d.ts +2 -0
- package/dist/lib/design-resource-handoff-validation-proofs.js +67 -0
- package/dist/lib/design-resource-handoff-validation-resource-closure.d.ts +3 -0
- package/dist/lib/design-resource-handoff-validation-resource-closure.js +88 -0
- package/dist/lib/design-resource-handoff-validation-structure.js +43 -14
- package/dist/lib/design-resource-handoff-validation.js +32 -0
- package/dist/lib/design-resource-handoff-web-dependency-validation.d.ts +2 -1
- package/dist/lib/design-resource-handoff-web-dependency-validation.js +67 -7
- package/dist/lib/execution-target-capabilities.d.ts +1 -1
- package/dist/lib/execution-target-capabilities.js +14 -0
- package/dist/lib/long-task-activation-validation.js +6 -2
- package/dist/lib/long-task-applicability-shape.js +3 -3
- package/dist/lib/long-task-authoring-authority-preview.js +1 -0
- package/dist/lib/long-task-authority-policy.d.ts +1 -0
- package/dist/lib/long-task-authority-policy.js +1 -0
- package/dist/lib/long-task-authority.js +13 -0
- package/dist/lib/long-task-claim-definitions.js +13 -1
- package/dist/lib/long-task-claims.js +23 -1
- package/dist/lib/long-task-contract-types.d.ts +3 -0
- package/dist/lib/long-task-delivery-compiler.js +1 -0
- package/dist/lib/long-task-delivery-parser.js +11 -1
- package/dist/lib/long-task-delivery-types.d.ts +1 -0
- package/dist/lib/long-task-delivery-types.js +1 -0
- package/dist/lib/long-task-delivery-validation.js +17 -0
- package/dist/lib/long-task-design-resource-handoff.js +62 -38
- package/dist/lib/long-task-design-target-capabilities.d.ts +14 -0
- package/dist/lib/long-task-design-target-capabilities.js +126 -0
- package/dist/lib/long-task-evidence-capability-codec.d.ts +94 -0
- package/dist/lib/long-task-evidence-capability-codec.js +395 -22
- package/dist/lib/long-task-evidence-capability-policy.js +18 -0
- package/dist/lib/long-task-evidence-capability-runtime.js +78 -0
- package/dist/lib/long-task-evidence-capability-types.d.ts +114 -1
- package/dist/lib/long-task-outcome-parser.js +4 -0
- package/dist/lib/long-task-playwright-capability-records.d.ts +5 -0
- package/dist/lib/long-task-playwright-capability-records.js +146 -0
- package/dist/lib/long-task-playwright-case-evidence.d.ts +3 -2
- package/dist/lib/long-task-playwright-case-evidence.js +10 -79
- package/dist/lib/long-task-playwright-case-primitives.d.ts +28 -0
- package/dist/lib/long-task-playwright-case-primitives.js +143 -0
- package/dist/lib/long-task-playwright-evidence.d.ts +1 -1
- package/dist/lib/long-task-playwright-evidence.js +10 -75
- package/dist/lib/long-task-runner-freeze.d.ts +2 -2
- package/dist/lib/long-task-runner-freeze.js +15 -1
- package/dist/lib/long-task-runtime-types.d.ts +4 -1
- package/dist/lib/long-task-semantic-contract-types.d.ts +1 -1
- package/dist/lib/long-task-semantic-drift-migration.js +2 -2
- package/dist/lib/long-task-semantic-fact-binding-types.d.ts +57 -0
- package/dist/lib/long-task-semantic-fact-binding-types.js +1 -0
- package/dist/lib/long-task-semantic-fact-closure-primitives.d.ts +5 -0
- package/dist/lib/long-task-semantic-fact-closure-primitives.js +43 -0
- package/dist/lib/long-task-semantic-fact-closure.d.ts +13 -0
- package/dist/lib/long-task-semantic-fact-closure.js +48 -0
- package/dist/lib/long-task-semantic-fact-contract-closure.d.ts +4 -0
- package/dist/lib/long-task-semantic-fact-contract-closure.js +24 -0
- package/dist/lib/long-task-semantic-fact-contract-facts.d.ts +4 -0
- package/dist/lib/long-task-semantic-fact-contract-facts.js +30 -0
- package/dist/lib/long-task-semantic-fact-contract-proofs.d.ts +4 -0
- package/dist/lib/long-task-semantic-fact-contract-proofs.js +97 -0
- package/dist/lib/long-task-semantic-fact-evidence.d.ts +21 -0
- package/dist/lib/long-task-semantic-fact-evidence.js +165 -0
- package/dist/lib/long-task-semantic-fact-input-closure.d.ts +4 -0
- package/dist/lib/long-task-semantic-fact-input-closure.js +101 -0
- package/dist/lib/long-task-semantic-fact-provenance-closure.d.ts +4 -0
- package/dist/lib/long-task-semantic-fact-provenance-closure.js +140 -0
- package/dist/lib/long-task-semantic-fact-shape.d.ts +3 -0
- package/dist/lib/long-task-semantic-fact-shape.js +89 -0
- package/dist/lib/long-task-semantic-fact-value-closure.d.ts +3 -0
- package/dist/lib/long-task-semantic-fact-value-closure.js +110 -0
- package/dist/lib/long-task-shape-primitives.d.ts +2 -1
- package/dist/lib/long-task-shape-primitives.js +7 -0
- package/dist/lib/long-task-source-item-parser.js +25 -6
- package/dist/lib/long-task-source-target-continuity.js +4 -1
- package/dist/lib/long-task-source-target-index.d.ts +1 -1
- package/dist/lib/long-task-source-target-index.js +5 -1
- package/dist/lib/long-task-ui-design-policy.js +8 -4
- package/dist/lib/long-task-ui-surface-shape.js +83 -1
- package/dist/lib/long-task-ui-surface-types.d.ts +29 -0
- package/dist/lib/modularity.js +7 -1
- package/dist/lib/semantic-fact-base-types.d.ts +14 -0
- package/dist/lib/semantic-fact-base-types.js +1 -0
- package/dist/lib/semantic-fact-catalog.d.ts +8 -0
- package/dist/lib/semantic-fact-catalog.js +191 -0
- package/dist/lib/semantic-fact-condition-shape.d.ts +48 -0
- package/dist/lib/semantic-fact-condition-shape.js +111 -0
- package/dist/lib/semantic-fact-input-shape.d.ts +34 -0
- package/dist/lib/semantic-fact-input-shape.js +111 -0
- package/dist/lib/semantic-fact-inventory-types.d.ts +147 -0
- package/dist/lib/semantic-fact-inventory-types.js +1 -0
- package/dist/lib/semantic-fact-manifest-shape.d.ts +4 -0
- package/dist/lib/semantic-fact-manifest-shape.js +135 -0
- package/dist/lib/semantic-fact-manifest-types.d.ts +58 -0
- package/dist/lib/semantic-fact-manifest-types.js +19 -0
- package/dist/lib/semantic-fact-policy-authority.d.ts +8 -0
- package/dist/lib/semantic-fact-policy-authority.js +79 -0
- package/dist/lib/semantic-fact-policy-census.d.ts +2 -0
- package/dist/lib/semantic-fact-policy-census.js +80 -0
- package/dist/lib/semantic-fact-policy-condition-references.d.ts +7 -0
- package/dist/lib/semantic-fact-policy-condition-references.js +19 -0
- package/dist/lib/semantic-fact-policy-conditions.d.ts +2 -0
- package/dist/lib/semantic-fact-policy-conditions.js +105 -0
- package/dist/lib/semantic-fact-policy-facts.d.ts +3 -0
- package/dist/lib/semantic-fact-policy-facts.js +73 -0
- package/dist/lib/semantic-fact-policy-primitives.d.ts +26 -0
- package/dist/lib/semantic-fact-policy-primitives.js +169 -0
- package/dist/lib/semantic-fact-policy-proofs.d.ts +2 -0
- package/dist/lib/semantic-fact-policy-proofs.js +75 -0
- package/dist/lib/semantic-fact-policy-properties.d.ts +3 -0
- package/dist/lib/semantic-fact-policy-properties.js +84 -0
- package/dist/lib/semantic-fact-policy-units.d.ts +4 -0
- package/dist/lib/semantic-fact-policy-units.js +103 -0
- package/dist/lib/semantic-fact-policy.d.ts +17 -0
- package/dist/lib/semantic-fact-policy.js +41 -0
- package/dist/lib/semantic-fact-proof-shape.d.ts +51 -0
- package/dist/lib/semantic-fact-proof-shape.js +121 -0
- package/dist/lib/semantic-fact-proof-types.d.ts +74 -0
- package/dist/lib/semantic-fact-proof-types.js +1 -0
- package/dist/lib/semantic-fact-property-shape.d.ts +29 -0
- package/dist/lib/semantic-fact-property-shape.js +77 -0
- package/dist/lib/semantic-fact-shape-constants.d.ts +3 -0
- package/dist/lib/semantic-fact-shape-constants.js +38 -0
- package/dist/lib/semantic-fact-shape-primitives.d.ts +15 -0
- package/dist/lib/semantic-fact-shape-primitives.js +68 -0
- package/dist/lib/semantic-fact-source-parser.d.ts +9 -0
- package/dist/lib/semantic-fact-source-parser.js +46 -0
- package/dist/lib/semantic-fact-support-shape.d.ts +21 -0
- package/dist/lib/semantic-fact-support-shape.js +59 -0
- package/dist/lib/semantic-fact-types.d.ts +5 -0
- package/dist/lib/semantic-fact-types.js +5 -0
- package/dist/lib/semantic-fact-unit-shape.d.ts +34 -0
- package/dist/lib/semantic-fact-unit-shape.js +89 -0
- package/dist/lib/semantic-fact-value-shape.d.ts +12 -0
- package/dist/lib/semantic-fact-value-shape.js +39 -0
- package/dist/schemas/long-task-delivery-v2/long-task-delivery-v2.schema.json +1339 -131
- package/migrations/README.md +15 -15
- package/package.json +84 -84
- package/source-mappings.yaml +25 -25
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DESIGN_RESOURCE_EVIDENCE_BY_DIMENSION, DESIGN_RESOURCE_METHODS_BY_DIMENSION, } from "./design-resource-handoff-policy.js";
|
|
1
|
+
import { DESIGN_RESOURCE_EVIDENCE_BY_METHOD, DESIGN_RESOURCE_EVIDENCE_BY_DIMENSION, DESIGN_RESOURCE_METHODS_BY_DIMENSION, } from "./design-resource-handoff-policy.js";
|
|
2
2
|
export const DESIGN_RESOURCE_FACT_INVARIANTS = Object.freeze({
|
|
3
3
|
complete_observable_design_fact_delivery: true,
|
|
4
4
|
resource_fact_inventory_closure_required: true,
|
|
@@ -12,6 +12,20 @@ export const DESIGN_RESOURCE_FACT_INVARIANTS = Object.freeze({
|
|
|
12
12
|
no_second_design_fact_authority: true,
|
|
13
13
|
fact_inventory_required: true,
|
|
14
14
|
contract_evidence_fact_binding_required: true,
|
|
15
|
+
authoring_obligation_universe_precedes_generation: true,
|
|
16
|
+
frozen_inspector_census_required: true,
|
|
17
|
+
first_class_condition_variation_property_axes_required: true,
|
|
18
|
+
atomic_fact_cell_identity_required: true,
|
|
19
|
+
expected_canonical_handoff_fact_universe_equality_required: true,
|
|
20
|
+
aggregate_state_or_condition_labels_forbidden: true,
|
|
21
|
+
complete_generation_without_sampling_or_truncation_required: true,
|
|
22
|
+
fact_identity_and_proof_method_obligation_separation_required: true,
|
|
23
|
+
property_required_methods_cannot_be_weakened: true,
|
|
24
|
+
design_system_effective_value_lineage_required: true,
|
|
25
|
+
dynamic_relation_and_asset_fact_closure_required: true,
|
|
26
|
+
per_fact_expected_comparison_authority_required: true,
|
|
27
|
+
per_fact_current_result_required: true,
|
|
28
|
+
protected_fact_observation_redaction_required: true,
|
|
15
29
|
selected_design_fact_antidegradation_required: true,
|
|
16
30
|
design_fact_distribution_context_cost: true,
|
|
17
31
|
forbidden_design_fact_shortcuts_absent: true,
|
|
@@ -23,6 +37,53 @@ export const EXACT_TARGET_FULL_TARGET_METHODS = [
|
|
|
23
37
|
"layout_geometry",
|
|
24
38
|
"visual_pixel",
|
|
25
39
|
];
|
|
40
|
+
const STANDARD_COMPARATORS_BY_METHOD = {
|
|
41
|
+
layout_geometry: ["exact_value", "numeric_delta", "geometry_delta"],
|
|
42
|
+
visual_pixel: ["pixel_diff"],
|
|
43
|
+
design_token: ["token_resolution"],
|
|
44
|
+
content: ["exact_value", "content_equal"],
|
|
45
|
+
component_state: ["exact_value", "state_equal"],
|
|
46
|
+
interaction_trace: ["trace_equal", "state_equal"],
|
|
47
|
+
motion_timeline: ["timeline_equal", "trace_equal"],
|
|
48
|
+
responsive_reflow: ["reflow_equal", "geometry_delta"],
|
|
49
|
+
input_method: ["state_equal", "trace_equal"],
|
|
50
|
+
accessibility_semantics: ["semantic_equal", "state_equal"],
|
|
51
|
+
accessibility_navigation: ["semantic_equal", "trace_equal"],
|
|
52
|
+
accessibility_visual: ["pixel_diff", "semantic_equal"],
|
|
53
|
+
gesture_trace: ["trace_equal"],
|
|
54
|
+
scroll_navigation: ["trace_equal"],
|
|
55
|
+
localization: ["content_equal", "semantic_equal"],
|
|
56
|
+
system_ui: ["semantic_equal", "state_equal", "pixel_diff"],
|
|
57
|
+
haptic_feedback: ["timeline_equal", "trace_equal"],
|
|
58
|
+
sound_feedback: ["timeline_equal", "trace_equal"],
|
|
59
|
+
asset_integrity: ["asset_equal"],
|
|
60
|
+
};
|
|
61
|
+
const ORACLE_CAPABILITIES_BY_METHOD = {
|
|
62
|
+
layout_geometry: [
|
|
63
|
+
"geometry_measurement",
|
|
64
|
+
"component_anatomy",
|
|
65
|
+
"css_cascade",
|
|
66
|
+
"relations",
|
|
67
|
+
],
|
|
68
|
+
visual_pixel: ["render_capture", "css_cascade", "html_dom", "system_ui"],
|
|
69
|
+
design_token: ["design_tokens"],
|
|
70
|
+
content: ["html_dom", "localization"],
|
|
71
|
+
component_state: ["component_anatomy", "prototype_transitions"],
|
|
72
|
+
interaction_trace: ["prototype_transitions", "input_rules"],
|
|
73
|
+
motion_timeline: ["motion", "prototype_transitions"],
|
|
74
|
+
responsive_reflow: ["responsive_rules", "geometry_measurement"],
|
|
75
|
+
input_method: ["input_rules"],
|
|
76
|
+
accessibility_semantics: ["accessibility"],
|
|
77
|
+
accessibility_navigation: ["accessibility", "input_rules"],
|
|
78
|
+
accessibility_visual: ["accessibility", "render_capture"],
|
|
79
|
+
gesture_trace: ["input_rules", "prototype_transitions"],
|
|
80
|
+
scroll_navigation: ["input_rules", "prototype_transitions"],
|
|
81
|
+
localization: ["localization"],
|
|
82
|
+
system_ui: ["system_ui"],
|
|
83
|
+
haptic_feedback: ["haptics"],
|
|
84
|
+
sound_feedback: ["audio"],
|
|
85
|
+
asset_integrity: ["assets"],
|
|
86
|
+
};
|
|
26
87
|
export function assertDesignResourceFactPolicyEnabled() {
|
|
27
88
|
if (Object.values(DESIGN_RESOURCE_FACT_INVARIANTS).some((enabled) => enabled !== true))
|
|
28
89
|
throw new Error("design_resource_fact_policy_disabled");
|
|
@@ -33,3 +94,13 @@ export function designFactMethodIsCompatible(dimension, method) {
|
|
|
33
94
|
export function designFactEvidenceIsCompatible(dimension, kind) {
|
|
34
95
|
return DESIGN_RESOURCE_EVIDENCE_BY_DIMENSION[dimension].includes(kind);
|
|
35
96
|
}
|
|
97
|
+
export function designFactEvidenceSupportsMethod(method, kind) {
|
|
98
|
+
return DESIGN_RESOURCE_EVIDENCE_BY_METHOD[method].includes(kind);
|
|
99
|
+
}
|
|
100
|
+
export function designFactComparatorSupportsMethod(method, comparator) {
|
|
101
|
+
return (comparator.startsWith("custom.") ||
|
|
102
|
+
STANDARD_COMPARATORS_BY_METHOD[method].includes(comparator));
|
|
103
|
+
}
|
|
104
|
+
export function designFactOracleSupportsMethod(method, capabilities) {
|
|
105
|
+
return ORACLE_CAPABILITIES_BY_METHOD[method].some((capability) => capabilities.includes(capability));
|
|
106
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DesignResourcePropertyFamily } from "./design-resource-fact-manifest-types.js";
|
|
2
|
+
import type { DesignResourceVerificationMethod } from "./design-resource-handoff-types.js";
|
|
3
|
+
export declare function designResourceRequiredMethods(key: string, family: DesignResourcePropertyFamily): DesignResourceVerificationMethod[];
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
const LAYOUT_PIXEL_KEYS = new Set([
|
|
2
|
+
"layout.transform",
|
|
3
|
+
"layout.transform-origin",
|
|
4
|
+
"layout.elevation",
|
|
5
|
+
"layout.clip",
|
|
6
|
+
"layout.mask",
|
|
7
|
+
]);
|
|
8
|
+
const CONTENT_LOCALIZATION_KEYS = new Set([
|
|
9
|
+
"content.date-format",
|
|
10
|
+
"content.time-format",
|
|
11
|
+
"content.number-format",
|
|
12
|
+
"content.unit-format",
|
|
13
|
+
]);
|
|
14
|
+
const CONTENT_REFLOW_KEYS = new Set([
|
|
15
|
+
"content.max-lines",
|
|
16
|
+
"content.truncation",
|
|
17
|
+
"content.wrapping",
|
|
18
|
+
]);
|
|
19
|
+
const CONTENT_STATE_KEYS = new Set([
|
|
20
|
+
"content.visibility",
|
|
21
|
+
"content.availability",
|
|
22
|
+
"content.population-identity",
|
|
23
|
+
"content.population-item-identity",
|
|
24
|
+
"content.population-cardinality",
|
|
25
|
+
"content.population-ordering",
|
|
26
|
+
"content.population-edge-cases",
|
|
27
|
+
]);
|
|
28
|
+
const GESTURE_KEYS = new Set([
|
|
29
|
+
"interaction.drag-threshold",
|
|
30
|
+
"interaction.drag-axis",
|
|
31
|
+
"interaction.drag-bounds",
|
|
32
|
+
"interaction.velocity-threshold",
|
|
33
|
+
"interaction.snap-points",
|
|
34
|
+
"interaction.long-press-threshold",
|
|
35
|
+
"interaction.double-tap-window",
|
|
36
|
+
]);
|
|
37
|
+
const INPUT_KEYS = new Set([
|
|
38
|
+
"interaction.input-type",
|
|
39
|
+
"interaction.return-action",
|
|
40
|
+
"interaction.autocorrect",
|
|
41
|
+
"interaction.autocapitalization",
|
|
42
|
+
"interaction.input-mask",
|
|
43
|
+
"interaction.secure-entry",
|
|
44
|
+
"interaction.clipboard",
|
|
45
|
+
"interaction.password-manager",
|
|
46
|
+
"interaction.keyboard-traversal",
|
|
47
|
+
]);
|
|
48
|
+
const ACCESSIBILITY_NAVIGATION_KEYS = new Set([
|
|
49
|
+
"accessibility.reading-order",
|
|
50
|
+
"accessibility.focus-order",
|
|
51
|
+
"accessibility.screen-reader",
|
|
52
|
+
"accessibility.switch-control",
|
|
53
|
+
"accessibility.voice-control",
|
|
54
|
+
]);
|
|
55
|
+
const ACCESSIBILITY_VISUAL_KEYS = new Set([
|
|
56
|
+
"accessibility.focus-visibility",
|
|
57
|
+
"accessibility.non-color-cue",
|
|
58
|
+
"accessibility.contrast",
|
|
59
|
+
"accessibility.text-scale-reflow",
|
|
60
|
+
"accessibility.preference-adaptation",
|
|
61
|
+
]);
|
|
62
|
+
export function designResourceRequiredMethods(key, family) {
|
|
63
|
+
const resolver = FAMILY_METHODS[family];
|
|
64
|
+
return resolver ? resolver(key) : ["visual_pixel"];
|
|
65
|
+
}
|
|
66
|
+
const FAMILY_METHODS = {
|
|
67
|
+
geometry: (key) => key === "geometry.pixel-snapping" ? ["visual_pixel"] : ["layout_geometry"],
|
|
68
|
+
layout: (key) => {
|
|
69
|
+
if (key === "layout.safe-area-insets")
|
|
70
|
+
return ["layout_geometry", "responsive_reflow"];
|
|
71
|
+
return LAYOUT_PIXEL_KEYS.has(key)
|
|
72
|
+
? ["layout_geometry", "visual_pixel"]
|
|
73
|
+
: ["layout_geometry"];
|
|
74
|
+
},
|
|
75
|
+
scroll: (key) => {
|
|
76
|
+
if (key === "scroll.indicator")
|
|
77
|
+
return ["visual_pixel"];
|
|
78
|
+
return key === "scroll.content-inset"
|
|
79
|
+
? ["responsive_reflow", "scroll_navigation"]
|
|
80
|
+
: ["scroll_navigation"];
|
|
81
|
+
},
|
|
82
|
+
typography: (key) => new Set([
|
|
83
|
+
"typography.numeral-style",
|
|
84
|
+
"typography.hyphenation",
|
|
85
|
+
"typography.formatting",
|
|
86
|
+
]).has(key)
|
|
87
|
+
? ["visual_pixel", "content"]
|
|
88
|
+
: ["layout_geometry", "visual_pixel"],
|
|
89
|
+
color: () => ["visual_pixel"],
|
|
90
|
+
decoration: () => ["visual_pixel"],
|
|
91
|
+
content: contentMethods,
|
|
92
|
+
icon: (key) => new Set(["icon.position", "icon.text-gap"]).has(key)
|
|
93
|
+
? ["layout_geometry"]
|
|
94
|
+
: ["visual_pixel"],
|
|
95
|
+
media: () => ["asset_integrity"],
|
|
96
|
+
asset: () => ["asset_integrity"],
|
|
97
|
+
interaction: interactionMethods,
|
|
98
|
+
navigation: () => ["interaction_trace"],
|
|
99
|
+
motion: () => ["motion_timeline"],
|
|
100
|
+
feedback: feedbackMethods,
|
|
101
|
+
responsive: () => ["responsive_reflow"],
|
|
102
|
+
accessibility: accessibilityMethods,
|
|
103
|
+
system: systemMethods,
|
|
104
|
+
relation: relationMethods,
|
|
105
|
+
};
|
|
106
|
+
function contentMethods(key) {
|
|
107
|
+
if (CONTENT_LOCALIZATION_KEYS.has(key))
|
|
108
|
+
return ["content", "localization"];
|
|
109
|
+
if (CONTENT_REFLOW_KEYS.has(key))
|
|
110
|
+
return ["content", "responsive_reflow"];
|
|
111
|
+
if (key === "content.virtualization-window")
|
|
112
|
+
return ["responsive_reflow"];
|
|
113
|
+
if (key === "content.layout-impact")
|
|
114
|
+
return ["component_state", "layout_geometry"];
|
|
115
|
+
return CONTENT_STATE_KEYS.has(key) ? ["component_state"] : ["content"];
|
|
116
|
+
}
|
|
117
|
+
function interactionMethods(key) {
|
|
118
|
+
if (GESTURE_KEYS.has(key))
|
|
119
|
+
return ["gesture_trace"];
|
|
120
|
+
if (INPUT_KEYS.has(key))
|
|
121
|
+
return ["input_method"];
|
|
122
|
+
return key === "interaction.trigger"
|
|
123
|
+
? ["component_state", "interaction_trace"]
|
|
124
|
+
: ["interaction_trace"];
|
|
125
|
+
}
|
|
126
|
+
function feedbackMethods(key) {
|
|
127
|
+
if (key === "feedback.spoken")
|
|
128
|
+
return ["accessibility_semantics"];
|
|
129
|
+
if (key === "feedback.sound-type-time")
|
|
130
|
+
return ["sound_feedback"];
|
|
131
|
+
if (key === "feedback.haptic-type-time")
|
|
132
|
+
return ["haptic_feedback"];
|
|
133
|
+
return ["component_state"];
|
|
134
|
+
}
|
|
135
|
+
function accessibilityMethods(key) {
|
|
136
|
+
if (ACCESSIBILITY_NAVIGATION_KEYS.has(key))
|
|
137
|
+
return ["accessibility_navigation"];
|
|
138
|
+
return ACCESSIBILITY_VISUAL_KEYS.has(key)
|
|
139
|
+
? ["accessibility_visual"]
|
|
140
|
+
: ["accessibility_semantics"];
|
|
141
|
+
}
|
|
142
|
+
function systemMethods(key) {
|
|
143
|
+
if (new Set(["system.font-rasterization", "system.render-environment"]).has(key))
|
|
144
|
+
return ["visual_pixel"];
|
|
145
|
+
return key === "system.keyboard-ime-avoidance"
|
|
146
|
+
? ["input_method"]
|
|
147
|
+
: ["system_ui"];
|
|
148
|
+
}
|
|
149
|
+
function relationMethods(key) {
|
|
150
|
+
if (key === "relation.synchronized-state-motion")
|
|
151
|
+
return ["interaction_trace"];
|
|
152
|
+
return new Set([
|
|
153
|
+
"relation.family-instance-consistency",
|
|
154
|
+
"relation.cross-surface-consistency",
|
|
155
|
+
]).has(key)
|
|
156
|
+
? ["component_state"]
|
|
157
|
+
: ["layout_geometry"];
|
|
158
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DesignResourceLocatedDigestV1, DesignResourceTypedLocatorV1 } from "./design-resource-fact-manifest-types.js";
|
|
2
|
+
export declare function parseDesignResourceTypedLocator(value: unknown, label: string): DesignResourceTypedLocatorV1;
|
|
3
|
+
export declare function parseDesignResourceLocatedDigest(value: unknown, label: string): DesignResourceLocatedDigestV1;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DESIGN_RESOURCE_LOCATOR_KINDS } from "./design-resource-handoff-types.js";
|
|
2
|
+
import { sha256, stableKey, } from "./design-resource-handoff-shape-primitives.js";
|
|
3
|
+
import { literal, object, string } from "./long-task-shape-primitives.js";
|
|
4
|
+
export function parseDesignResourceTypedLocator(value, label) {
|
|
5
|
+
const row = object(value, label, ["resource_ref", "kind", "value"]);
|
|
6
|
+
return {
|
|
7
|
+
resource_ref: stableKey(row.resource_ref, `${label}.resource_ref`),
|
|
8
|
+
kind: literal(row.kind, DESIGN_RESOURCE_LOCATOR_KINDS, `${label}.kind`),
|
|
9
|
+
value: string(row.value, `${label}.value`),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function parseDesignResourceLocatedDigest(value, label) {
|
|
13
|
+
const row = object(value, label, ["locator", "sha256"]);
|
|
14
|
+
return {
|
|
15
|
+
locator: parseDesignResourceTypedLocator(row.locator, `${label}.locator`),
|
|
16
|
+
sha256: sha256(row.sha256, `${label}.sha256`),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type { DesignResourceCoverageDisposition, DesignResourceDimension, DesignResourceLocatorKind, DesignResourceVerificationMethod } from "./design-resource-handoff-types.js";
|
|
2
|
+
import type { DesignResourceComparator, DesignResourceInspectorCapability, DesignResourceLineageNodeKind, DesignResourcePropertyFamily, DesignResourceStandardConditionAxis, DesignResourceSubjectKind, DesignResourceSubjectPresenceKind, DesignResourceValueKind, DesignResourceVariationAxis } from "./design-resource-fact-enums.js";
|
|
3
|
+
export interface DesignResourceTypedLocatorV1 {
|
|
4
|
+
resource_ref: string;
|
|
5
|
+
kind: DesignResourceLocatorKind;
|
|
6
|
+
value: string;
|
|
7
|
+
}
|
|
8
|
+
export interface DesignResourceLocatedDigestV1 {
|
|
9
|
+
locator: DesignResourceTypedLocatorV1;
|
|
10
|
+
sha256: string;
|
|
11
|
+
}
|
|
12
|
+
export interface DesignResourceAxisValueV1 {
|
|
13
|
+
key: string;
|
|
14
|
+
census_refs: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface DesignResourceAxisDispositionV1 {
|
|
17
|
+
key: string;
|
|
18
|
+
target_ref: string;
|
|
19
|
+
axis: DesignResourceStandardConditionAxis | string;
|
|
20
|
+
disposition: "applicable" | "not_applicable";
|
|
21
|
+
values: DesignResourceAxisValueV1[];
|
|
22
|
+
source_item_refs: string[];
|
|
23
|
+
basis_refs: string[];
|
|
24
|
+
rationale: string;
|
|
25
|
+
}
|
|
26
|
+
export interface DesignResourceConditionCombinationDispositionV1 {
|
|
27
|
+
key: string;
|
|
28
|
+
target_ref: string;
|
|
29
|
+
axis_values: Array<{
|
|
30
|
+
axis_ref: string;
|
|
31
|
+
value_ref: string;
|
|
32
|
+
}>;
|
|
33
|
+
disposition: Exclude<DesignResourceCoverageDisposition, "covered">;
|
|
34
|
+
source_item_refs: string[];
|
|
35
|
+
basis_refs: string[];
|
|
36
|
+
rationale: string;
|
|
37
|
+
}
|
|
38
|
+
export interface DesignResourceVariationAxisDispositionV1 {
|
|
39
|
+
key: string;
|
|
40
|
+
subject_ref: string;
|
|
41
|
+
axis: DesignResourceVariationAxis;
|
|
42
|
+
disposition: "applicable" | "not_applicable";
|
|
43
|
+
values: DesignResourceAxisValueV1[];
|
|
44
|
+
source_item_refs: string[];
|
|
45
|
+
basis_refs: string[];
|
|
46
|
+
rationale: string;
|
|
47
|
+
}
|
|
48
|
+
export interface DesignResourceVariationCombinationDispositionV1 {
|
|
49
|
+
key: string;
|
|
50
|
+
subject_ref: string;
|
|
51
|
+
axis_values: Array<{
|
|
52
|
+
axis_ref: DesignResourceVariationAxis;
|
|
53
|
+
value_ref: string;
|
|
54
|
+
}>;
|
|
55
|
+
disposition: Exclude<DesignResourceCoverageDisposition, "covered">;
|
|
56
|
+
source_item_refs: string[];
|
|
57
|
+
basis_refs: string[];
|
|
58
|
+
rationale: string;
|
|
59
|
+
}
|
|
60
|
+
export interface DesignResourceSubjectVariationV1 {
|
|
61
|
+
key: string;
|
|
62
|
+
subject_ref: string;
|
|
63
|
+
variant: string;
|
|
64
|
+
state: string;
|
|
65
|
+
interaction_phase: string;
|
|
66
|
+
presence_phase: string;
|
|
67
|
+
instance_case: string;
|
|
68
|
+
}
|
|
69
|
+
export interface DesignResourceRelationEndpointV1 {
|
|
70
|
+
role: string;
|
|
71
|
+
subject_ref: string;
|
|
72
|
+
}
|
|
73
|
+
export interface DesignResourcePropertyDefinitionV1 {
|
|
74
|
+
key: string;
|
|
75
|
+
family: DesignResourcePropertyFamily;
|
|
76
|
+
dimension: DesignResourceDimension;
|
|
77
|
+
value_kind: DesignResourceValueKind;
|
|
78
|
+
required_methods: DesignResourceVerificationMethod[];
|
|
79
|
+
standard: boolean;
|
|
80
|
+
inspector_capability_refs: DesignResourceInspectorCapability[];
|
|
81
|
+
census_refs: string[];
|
|
82
|
+
}
|
|
83
|
+
export interface DesignResourceFactCellV1 {
|
|
84
|
+
key: string;
|
|
85
|
+
subject_ref: string;
|
|
86
|
+
target_ref: string;
|
|
87
|
+
condition_ref: string;
|
|
88
|
+
variation_ref: string;
|
|
89
|
+
property_ref: string;
|
|
90
|
+
disposition: DesignResourceCoverageDisposition;
|
|
91
|
+
fact_ref: string | null;
|
|
92
|
+
source_item_refs: string[];
|
|
93
|
+
basis_refs: string[];
|
|
94
|
+
rationale: string;
|
|
95
|
+
}
|
|
96
|
+
export interface DesignResourceFactLineageV1 {
|
|
97
|
+
design_system_ref: string | null;
|
|
98
|
+
token_chain_refs: string[];
|
|
99
|
+
override_chain_refs: string[];
|
|
100
|
+
resolved_value: DesignResourceLocatedDigestV1;
|
|
101
|
+
conflict_status: "none" | "resolved";
|
|
102
|
+
conflict_resolution: string;
|
|
103
|
+
}
|
|
104
|
+
export interface DesignResourceLineageNodeV1 {
|
|
105
|
+
key: string;
|
|
106
|
+
kind: DesignResourceLineageNodeKind;
|
|
107
|
+
predecessor_refs: string[];
|
|
108
|
+
value: DesignResourceLocatedDigestV1;
|
|
109
|
+
census_refs: string[];
|
|
110
|
+
}
|
|
111
|
+
export interface DesignResourceFactV1 {
|
|
112
|
+
key: string;
|
|
113
|
+
cell_ref: string;
|
|
114
|
+
subject_ref: string;
|
|
115
|
+
target_ref: string;
|
|
116
|
+
condition_ref: string;
|
|
117
|
+
variation_ref: string;
|
|
118
|
+
property_ref: string;
|
|
119
|
+
dimension: DesignResourceDimension;
|
|
120
|
+
observation_scope: "subject" | "full_target";
|
|
121
|
+
observation_sensitivity: "plain" | "protected";
|
|
122
|
+
value_kind: DesignResourceValueKind;
|
|
123
|
+
value: DesignResourceLocatedDigestV1;
|
|
124
|
+
evidence_refs: string[];
|
|
125
|
+
source_item_refs: string[];
|
|
126
|
+
lineage: DesignResourceFactLineageV1;
|
|
127
|
+
}
|
|
128
|
+
export interface DesignResourceOracleV1 {
|
|
129
|
+
key: string;
|
|
130
|
+
trust: "frozen_executable" | "named_external_tcb";
|
|
131
|
+
identity: string;
|
|
132
|
+
version: string;
|
|
133
|
+
sha256: string | null;
|
|
134
|
+
capability_refs: DesignResourceInspectorCapability[];
|
|
135
|
+
}
|
|
136
|
+
export interface DesignResourceEnvironmentV1 {
|
|
137
|
+
key: string;
|
|
138
|
+
identity: string;
|
|
139
|
+
definition: DesignResourceLocatedDigestV1;
|
|
140
|
+
}
|
|
141
|
+
export interface DesignResourceProofObligationV1 {
|
|
142
|
+
key: string;
|
|
143
|
+
fact_ref: string;
|
|
144
|
+
method: DesignResourceVerificationMethod;
|
|
145
|
+
comparison: {
|
|
146
|
+
comparator: DesignResourceComparator | string;
|
|
147
|
+
mode: "exact" | "tolerance";
|
|
148
|
+
parameters: DesignResourceLocatedDigestV1;
|
|
149
|
+
tolerance: DesignResourceLocatedDigestV1 | null;
|
|
150
|
+
mask: DesignResourceLocatedDigestV1 | null;
|
|
151
|
+
};
|
|
152
|
+
oracle_ref: string;
|
|
153
|
+
environment_ref: string;
|
|
154
|
+
}
|
|
155
|
+
export interface DesignResourceAssetBindingV1 {
|
|
156
|
+
key: string;
|
|
157
|
+
asset_subject_ref: string;
|
|
158
|
+
resource_ref: string;
|
|
159
|
+
target_refs: string[];
|
|
160
|
+
condition_refs: string[];
|
|
161
|
+
fact_refs: string[];
|
|
162
|
+
consumer_subject_refs: string[];
|
|
163
|
+
}
|
|
164
|
+
export type { DesignResourceSubjectKind, DesignResourceSubjectPresenceKind };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type DesignResourceObservableFactManifestV1 } from "./design-resource-fact-manifest-types.js";
|
|
2
|
+
import type { DesignResource } from "./design-resource-handoff-file-primitives.js";
|
|
3
|
+
export declare function validateManifestAssets(manifest: DesignResourceObservableFactManifestV1, resources: Map<string, DesignResource>): void;
|
|
4
|
+
export declare function validateManifestGeneration(manifest: DesignResourceObservableFactManifestV1): void;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { DESIGN_RESOURCE_MANIFEST_COLLECTIONS, } from "./design-resource-fact-manifest-types.js";
|
|
2
|
+
import { invalid, manifestCollectionRows, manifestIdentityDigest, nonempty, refsKnown, sameSet, unique, } from "./design-resource-fact-universe-helpers.js";
|
|
3
|
+
export function validateManifestAssets(manifest, resources) {
|
|
4
|
+
const subjects = new Map(manifest.subjects.map((subject) => [subject.key, subject]));
|
|
5
|
+
const assetSubjects = manifest.subjects.filter((subject) => subject.kind === "asset");
|
|
6
|
+
const bound = new Set();
|
|
7
|
+
for (const binding of manifest.asset_bindings) {
|
|
8
|
+
validateAssetBinding(binding, manifest, subjects, resources);
|
|
9
|
+
if (bound.has(binding.asset_subject_ref))
|
|
10
|
+
invalid("manifest_asset_subject_binding_duplicate", binding.asset_subject_ref);
|
|
11
|
+
bound.add(binding.asset_subject_ref);
|
|
12
|
+
}
|
|
13
|
+
for (const subject of assetSubjects)
|
|
14
|
+
if (!bound.has(subject.key))
|
|
15
|
+
invalid("manifest_asset_subject_binding_missing", subject.key);
|
|
16
|
+
}
|
|
17
|
+
function validateAssetBinding(binding, manifest, subjects, resources) {
|
|
18
|
+
const subject = subjects.get(binding.asset_subject_ref);
|
|
19
|
+
if (!subject || subject.kind !== "asset")
|
|
20
|
+
invalid("manifest_asset_binding_subject_invalid", binding.key);
|
|
21
|
+
if (!resources.has(binding.resource_ref))
|
|
22
|
+
invalid("manifest_asset_binding_resource_unknown", binding.key);
|
|
23
|
+
for (const [name, refs] of [
|
|
24
|
+
["target", binding.target_refs],
|
|
25
|
+
["condition", binding.condition_refs],
|
|
26
|
+
["fact", binding.fact_refs],
|
|
27
|
+
["consumer", binding.consumer_subject_refs],
|
|
28
|
+
]) {
|
|
29
|
+
nonempty(refs, `manifest_asset_binding_${name}s_required:${binding.key}`);
|
|
30
|
+
unique(refs, `manifest_asset_binding_${name}_duplicate:${binding.key}`);
|
|
31
|
+
}
|
|
32
|
+
refsKnown(binding.target_refs, new Map([[manifest.target_key, true]]), "manifest_asset_binding_target_unknown", binding.key);
|
|
33
|
+
const assetFacts = manifest.facts.filter((fact) => fact.subject_ref === binding.asset_subject_ref);
|
|
34
|
+
sameSet(binding.fact_refs, assetFacts.map((fact) => fact.key), "manifest_asset_binding_fact_set_mismatch", binding.key);
|
|
35
|
+
sameSet(binding.condition_refs, [...new Set(assetFacts.map((fact) => fact.condition_ref))], "manifest_asset_binding_condition_set_mismatch", binding.key);
|
|
36
|
+
sameSet(binding.target_refs, subject.target_refs, "manifest_asset_binding_target_set_mismatch", binding.key);
|
|
37
|
+
validateAssetFacts(binding, manifest, assetFacts);
|
|
38
|
+
refsKnown(binding.condition_refs, new Map(manifest.conditions.map((item) => [item.key, item])), "manifest_asset_binding_condition_unknown", binding.key);
|
|
39
|
+
refsKnown(binding.fact_refs, new Map(manifest.facts.map((item) => [item.key, item])), "manifest_asset_binding_fact_unknown", binding.key);
|
|
40
|
+
refsKnown(binding.consumer_subject_refs, subjects, "manifest_asset_binding_consumer_unknown", binding.key);
|
|
41
|
+
}
|
|
42
|
+
function validateAssetFacts(binding, manifest, facts) {
|
|
43
|
+
for (const fact of facts) {
|
|
44
|
+
if (fact.dimension !== "assets")
|
|
45
|
+
invalid("manifest_asset_fact_dimension_invalid", `${binding.key}:${fact.key}:${fact.dimension}`);
|
|
46
|
+
const resourceBound = fact.value.locator.resource_ref === binding.resource_ref ||
|
|
47
|
+
fact.lineage.resolved_value.locator.resource_ref ===
|
|
48
|
+
binding.resource_ref ||
|
|
49
|
+
fact.evidence_refs.some((ref) => manifest.evidence.find((item) => item.key === ref)?.resource_ref ===
|
|
50
|
+
binding.resource_ref);
|
|
51
|
+
if (!resourceBound)
|
|
52
|
+
invalid("manifest_asset_binding_resource_unattributed", `${binding.key}:${fact.key}:${binding.resource_ref}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function validateManifestGeneration(manifest) {
|
|
56
|
+
const generation = manifest.generation;
|
|
57
|
+
if (generation.chunk_indexes.length !== generation.chunk_count ||
|
|
58
|
+
generation.chunk_indexes.some((value, index) => value !== index))
|
|
59
|
+
invalid("manifest_generation_chunk_closure_mismatch", manifest.target_key);
|
|
60
|
+
unique(generation.collections.map((item) => item.name), "manifest_generation_collection_duplicate");
|
|
61
|
+
sameSet(generation.collections.map((item) => item.name), [...DESIGN_RESOURCE_MANIFEST_COLLECTIONS], "manifest_generation_collection_set_mismatch", manifest.target_key);
|
|
62
|
+
const rowsByCollection = manifestCollectionRows(manifest);
|
|
63
|
+
for (const declaration of generation.collections) {
|
|
64
|
+
const rows = rowsByCollection.get(declaration.name);
|
|
65
|
+
if (rows.length !== declaration.expected_count)
|
|
66
|
+
invalid("manifest_generation_count_mismatch", `${declaration.name}:${rows.length}:${declaration.expected_count}`);
|
|
67
|
+
const actual = manifestIdentityDigest(rows);
|
|
68
|
+
if (actual !== declaration.identity_sha256)
|
|
69
|
+
invalid("manifest_generation_identity_mismatch", `${declaration.name}:${declaration.identity_sha256}:${actual}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DesignResourceObservableFactManifestV1 } from "./design-resource-fact-manifest-types.js";
|
|
2
|
+
export declare function validateManifestPropertyCatalog(manifest: DesignResourceObservableFactManifestV1, census: Map<string, DesignResourceObservableFactManifestV1["inspector"]["census"][number]>): void;
|
|
3
|
+
export declare function validateManifestCensusOwnership(manifest: DesignResourceObservableFactManifestV1): void;
|
|
4
|
+
export declare function validateManifestFactCells(manifest: DesignResourceObservableFactManifestV1, sourceItems: Map<string, string>, census: Map<string, DesignResourceObservableFactManifestV1["inspector"]["census"][number]>): void;
|