project-tiny-context-harness 0.8.4 → 0.8.5
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 +393 -371
- package/assets/README.md +573 -526
- package/assets/README.zh-CN.md +333 -311
- package/assets/agents/.gitkeep +1 -1
- package/assets/agents/AGENTS_CORE.md +44 -25
- package/assets/context_templates/architecture.md +28 -28
- package/assets/context_templates/area.md +34 -34
- package/assets/context_templates/context.toml +30 -30
- 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 +32 -32
- 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 +148 -125
- 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-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,9 +1,15 @@
|
|
|
1
1
|
import type { EvidenceCapabilityV2 } from "./long-task-semantic-contract-types.js";
|
|
2
2
|
import type { DesignResourceVerificationMethod } from "./design-resource-handoff-types.js";
|
|
3
|
+
import type { DesignResourceComparator, DesignResourceLocatedDigestV1 } from "./design-resource-fact-manifest-types.js";
|
|
4
|
+
import type { SemanticFactEnvironmentV1, SemanticFactLocatedValueV1, SemanticFactOracleV1 } from "./semantic-fact-types.js";
|
|
3
5
|
interface EvidenceRecordBaseV2 {
|
|
4
6
|
assertion_key: string;
|
|
5
7
|
capability: EvidenceCapabilityV2;
|
|
6
8
|
}
|
|
9
|
+
export interface DesignEvidenceLocatorV2 {
|
|
10
|
+
kind: "json_pointer" | "image_region" | "semantic_node" | "trace_event" | "timeline_sample" | "asset_ref" | "custom";
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
7
13
|
export interface InteractionTraceEvidenceV2 extends EvidenceRecordBaseV2 {
|
|
8
14
|
capability: "interaction_trace";
|
|
9
15
|
target_ref: string;
|
|
@@ -81,6 +87,113 @@ export interface DesignMethodEvidenceV2 extends EvidenceRecordBaseV2 {
|
|
|
81
87
|
artifact_path: string;
|
|
82
88
|
observation_artifact_path: string;
|
|
83
89
|
fact_refs: string[];
|
|
90
|
+
fact_results: DesignFactResultV2[];
|
|
91
|
+
}>;
|
|
92
|
+
}
|
|
93
|
+
export interface DesignFactResultV2 {
|
|
94
|
+
fact_ref: string;
|
|
95
|
+
subject_ref: string;
|
|
96
|
+
variation_ref: string;
|
|
97
|
+
property_ref: string;
|
|
98
|
+
actual_observation: {
|
|
99
|
+
artifact_path: string;
|
|
100
|
+
artifact_sha256: string;
|
|
101
|
+
locator: DesignEvidenceLocatorV2;
|
|
102
|
+
value_sha256: string;
|
|
103
|
+
sensitivity: "plain" | "protected";
|
|
104
|
+
redaction: {
|
|
105
|
+
policy_ref: string;
|
|
106
|
+
representation: "digest_only" | "redacted_structured";
|
|
107
|
+
raw_persisted: false;
|
|
108
|
+
} | null;
|
|
109
|
+
};
|
|
110
|
+
actual_environment: {
|
|
111
|
+
artifact_path: string;
|
|
112
|
+
artifact_sha256: string;
|
|
113
|
+
locator: DesignEvidenceLocatorV2;
|
|
114
|
+
value_sha256: string;
|
|
115
|
+
};
|
|
116
|
+
expected: DesignResourceLocatedDigestV1;
|
|
117
|
+
comparison: {
|
|
118
|
+
artifact_path: string;
|
|
119
|
+
artifact_sha256: string;
|
|
120
|
+
locator: DesignEvidenceLocatorV2;
|
|
121
|
+
result_sha256: string;
|
|
122
|
+
comparator: DesignResourceComparator | string;
|
|
123
|
+
mode: "exact" | "tolerance";
|
|
124
|
+
parameters: DesignResourceLocatedDigestV1;
|
|
125
|
+
tolerance: DesignResourceLocatedDigestV1 | null;
|
|
126
|
+
mask: DesignResourceLocatedDigestV1 | null;
|
|
127
|
+
passed: boolean;
|
|
128
|
+
};
|
|
129
|
+
verdict: "passed" | "failed";
|
|
130
|
+
oracle: {
|
|
131
|
+
key: string;
|
|
132
|
+
trust: "frozen_executable" | "named_external_tcb";
|
|
133
|
+
identity: string;
|
|
134
|
+
version: string;
|
|
135
|
+
sha256: string | null;
|
|
136
|
+
};
|
|
137
|
+
environment: {
|
|
138
|
+
key: string;
|
|
139
|
+
identity: string;
|
|
140
|
+
definition: DesignResourceLocatedDigestV1;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export interface SemanticFactEvidenceV2 extends EvidenceRecordBaseV2 {
|
|
144
|
+
capability: "semantic_fact";
|
|
145
|
+
manifest_ref: string;
|
|
146
|
+
manifest_sha256: string;
|
|
147
|
+
outcome_ref: string;
|
|
148
|
+
target_ref: string;
|
|
149
|
+
fact_ref: string;
|
|
150
|
+
proof_ref: string;
|
|
151
|
+
method: string;
|
|
152
|
+
subject_ref: string;
|
|
153
|
+
condition_ref: string;
|
|
154
|
+
property_ref: string;
|
|
155
|
+
actual_observation: {
|
|
156
|
+
artifact_path: string;
|
|
157
|
+
artifact_sha256: string;
|
|
158
|
+
locator: DesignEvidenceLocatorV2;
|
|
159
|
+
value_sha256: string;
|
|
160
|
+
sensitivity: "plain" | "protected";
|
|
161
|
+
redaction: {
|
|
162
|
+
policy_ref: string;
|
|
163
|
+
representation: "digest_only" | "redacted_structured";
|
|
164
|
+
raw_persisted: false;
|
|
165
|
+
} | null;
|
|
166
|
+
};
|
|
167
|
+
actual_environment: {
|
|
168
|
+
artifact_path: string;
|
|
169
|
+
artifact_sha256: string;
|
|
170
|
+
locator: DesignEvidenceLocatorV2;
|
|
171
|
+
value_sha256: string;
|
|
172
|
+
};
|
|
173
|
+
expected: SemanticFactLocatedValueV1;
|
|
174
|
+
comparison: {
|
|
175
|
+
artifact_path: string;
|
|
176
|
+
artifact_sha256: string;
|
|
177
|
+
locator: DesignEvidenceLocatorV2;
|
|
178
|
+
result_sha256: string;
|
|
179
|
+
comparator: string;
|
|
180
|
+
mode: "exact" | "tolerance";
|
|
181
|
+
parameters: SemanticFactLocatedValueV1;
|
|
182
|
+
tolerance: SemanticFactLocatedValueV1 | null;
|
|
183
|
+
mask: SemanticFactLocatedValueV1 | null;
|
|
184
|
+
passed: boolean;
|
|
185
|
+
};
|
|
186
|
+
verdict: "passed" | "failed";
|
|
187
|
+
oracle: SemanticFactOracleV1;
|
|
188
|
+
environment: SemanticFactEnvironmentV1;
|
|
189
|
+
observer_results: Array<{
|
|
190
|
+
target_ref: string;
|
|
191
|
+
artifact_path: string;
|
|
192
|
+
artifact_sha256: string;
|
|
193
|
+
locator: DesignEvidenceLocatorV2;
|
|
194
|
+
value_sha256: string;
|
|
195
|
+
comparison_result_sha256: string;
|
|
196
|
+
passed: boolean;
|
|
84
197
|
}>;
|
|
85
198
|
}
|
|
86
199
|
export interface InputVariationEvidenceV2 extends EvidenceRecordBaseV2 {
|
|
@@ -91,5 +204,5 @@ export interface InputVariationEvidenceV2 extends EvidenceRecordBaseV2 {
|
|
|
91
204
|
}>;
|
|
92
205
|
failure_case_observed: boolean;
|
|
93
206
|
}
|
|
94
|
-
export type EvidenceCapabilityRecordV2 = InteractionTraceEvidenceV2 | StateDeltaEvidenceV2 | CrossSurfaceConsistencyEvidenceV2 | DurableReadbackEvidenceV2 | BoundaryInvocationEvidenceV2 | ExternalSideEffectEvidenceV2 | FailureInjectionEvidenceV2 | VisualRenderEvidenceV2 | DesignConformanceEvidenceV2 | DesignMethodEvidenceV2 | TargetRuntimeEvidenceV2 | InputVariationEvidenceV2;
|
|
207
|
+
export type EvidenceCapabilityRecordV2 = InteractionTraceEvidenceV2 | StateDeltaEvidenceV2 | CrossSurfaceConsistencyEvidenceV2 | DurableReadbackEvidenceV2 | BoundaryInvocationEvidenceV2 | ExternalSideEffectEvidenceV2 | FailureInjectionEvidenceV2 | VisualRenderEvidenceV2 | DesignConformanceEvidenceV2 | DesignMethodEvidenceV2 | SemanticFactEvidenceV2 | TargetRuntimeEvidenceV2 | InputVariationEvidenceV2;
|
|
95
208
|
export {};
|
|
@@ -5,6 +5,7 @@ import { array, boolean, key, literal, nullable, object, parseBindings, parseCon
|
|
|
5
5
|
import { parseStrictYaml } from "./strict-codec.js";
|
|
6
6
|
import { assertNoSemanticDriftMigration, semanticDriftOutcomeMigrationFields, } from "./long-task-semantic-drift-migration.js";
|
|
7
7
|
import { parseSurfaceBindings } from "./long-task-ui-surface-shape.js";
|
|
8
|
+
import { parseSemanticFactOutcomeBindings } from "./long-task-semantic-fact-shape.js";
|
|
8
9
|
export function parseOutcome(value, label) {
|
|
9
10
|
assertNoSemanticDriftMigration(semanticDriftOutcomeMigrationFields(value, label));
|
|
10
11
|
const row = object(value, label, [
|
|
@@ -12,6 +13,7 @@ export function parseOutcome(value, label) {
|
|
|
12
13
|
"title",
|
|
13
14
|
"stage",
|
|
14
15
|
"applicability",
|
|
16
|
+
"semantic_fact_bindings",
|
|
15
17
|
"product",
|
|
16
18
|
"technical",
|
|
17
19
|
"acceptance",
|
|
@@ -48,6 +50,7 @@ export function parseOutcome(value, label) {
|
|
|
48
50
|
? strings(row.depends_on, `${label}.depends_on`).map((item, index) => key(item, `${label}.depends_on[${index}]`))
|
|
49
51
|
: [],
|
|
50
52
|
applicability: parseClaimApplicability(row.applicability, `${label}.applicability`),
|
|
53
|
+
semantic_fact_bindings: parseSemanticFactOutcomeBindings(row.semantic_fact_bindings, `${label}.semantic_fact_bindings`),
|
|
51
54
|
product: {
|
|
52
55
|
observable_result: string(product.observable_result, `${label}.product.observable_result`),
|
|
53
56
|
result_applicability_refs: strings(product.result_applicability_refs, `${label}.product.result_applicability_refs`).map((item, index) => key(item, `${label}.product.result_applicability_refs[${index}]`)),
|
|
@@ -118,6 +121,7 @@ export function parseOutcomeFragment(raw, relative) {
|
|
|
118
121
|
"stage",
|
|
119
122
|
"depends_on",
|
|
120
123
|
"applicability",
|
|
124
|
+
"semantic_fact_bindings",
|
|
121
125
|
"product",
|
|
122
126
|
"technical",
|
|
123
127
|
"acceptance",
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CompiledCheckV2, EvidenceCapabilityRecordV2 } from "./long-task-delivery-types.js";
|
|
2
|
+
import type { PlaywrightCase } from "./long-task-playwright-case-evidence.js";
|
|
3
|
+
export declare function evidenceRecordsForPlaywrightCases(check: CompiledCheckV2, cases: PlaywrightCase[]): EvidenceCapabilityRecordV2[];
|
|
4
|
+
export declare function semanticFactAttachmentName(proofRef: string): string;
|
|
5
|
+
export declare function designMethodAttachmentName(target: string, method: string, condition: string, kind: "record" | "observation"): string;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { decodeDesignFactResults, decodeEvidenceCapabilityRecords, } from "./long-task-evidence-capability-codec.js";
|
|
2
|
+
export function evidenceRecordsForPlaywrightCases(check, cases) {
|
|
3
|
+
const records = [];
|
|
4
|
+
for (const item of cases) {
|
|
5
|
+
const assertion = [
|
|
6
|
+
...check.positive_assertions,
|
|
7
|
+
...check.negative_assertions,
|
|
8
|
+
].find((candidate) => candidate.key === item.id);
|
|
9
|
+
if (!assertion)
|
|
10
|
+
continue;
|
|
11
|
+
records.push(...baseEvidenceRecords(check, item, assertion), ...designConformanceRecords(check, item, assertion), ...designMethodRecords(check, item, assertion), ...semanticFactRecords(check, item, assertion));
|
|
12
|
+
}
|
|
13
|
+
return records;
|
|
14
|
+
}
|
|
15
|
+
function baseEvidenceRecords(check, item, assertion) {
|
|
16
|
+
if (!item.executed)
|
|
17
|
+
return [];
|
|
18
|
+
const records = [];
|
|
19
|
+
if (assertion.evidence_capabilities.includes("interaction_trace"))
|
|
20
|
+
records.push({
|
|
21
|
+
assertion_key: assertion.key,
|
|
22
|
+
capability: "interaction_trace",
|
|
23
|
+
target_ref: check.execution_target.target_ref,
|
|
24
|
+
given_keys: item.given_keys,
|
|
25
|
+
action_keys: item.action_keys,
|
|
26
|
+
});
|
|
27
|
+
if (assertion.evidence_capabilities.includes("target_runtime"))
|
|
28
|
+
records.push({
|
|
29
|
+
assertion_key: assertion.key,
|
|
30
|
+
capability: "target_runtime",
|
|
31
|
+
target_ref: check.execution_target.target_ref,
|
|
32
|
+
root_entrypoint: check.execution_target_definition.root_entrypoint,
|
|
33
|
+
session_id: `playwright:${item.id}:${item.project_ids.join(",")}`,
|
|
34
|
+
cold_start: check.execution_target.entrypoint === "root",
|
|
35
|
+
});
|
|
36
|
+
return records;
|
|
37
|
+
}
|
|
38
|
+
function designConformanceRecords(check, item, assertion) {
|
|
39
|
+
if (!item.executed ||
|
|
40
|
+
!assertion.evidence_capabilities.includes("design_conformance"))
|
|
41
|
+
return [];
|
|
42
|
+
return (check.design_conformance_targets ?? [])
|
|
43
|
+
.filter((candidate) => candidate.conformance_assertion_ref === assertion.key ||
|
|
44
|
+
candidate.verification_method_bindings.some((binding) => binding.assertion_ref === assertion.key))
|
|
45
|
+
.map((target) => ({
|
|
46
|
+
assertion_key: assertion.key,
|
|
47
|
+
capability: "design_conformance",
|
|
48
|
+
design_target_ref: target.key,
|
|
49
|
+
target_ref: target.target_ref,
|
|
50
|
+
condition_keys: target.condition_keys,
|
|
51
|
+
actual_artifact_path: target.actual_artifact_path,
|
|
52
|
+
comparison_artifact_path: target.comparison_artifact_path,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
function designMethodRecords(check, item, assertion) {
|
|
56
|
+
if (!item.executed ||
|
|
57
|
+
!assertion.evidence_capabilities.includes("design_method"))
|
|
58
|
+
return [];
|
|
59
|
+
const records = [];
|
|
60
|
+
for (const target of check.design_conformance_targets ?? []) {
|
|
61
|
+
const binding = target.verification_method_bindings.find((candidate) => candidate.assertion_ref === assertion.key);
|
|
62
|
+
if (!binding)
|
|
63
|
+
continue;
|
|
64
|
+
const requiredAttachments = binding.evidence_artifacts.flatMap((artifact) => [
|
|
65
|
+
designMethodAttachmentName(target.key, binding.method, artifact.condition_key, "record"),
|
|
66
|
+
designMethodAttachmentName(target.key, binding.method, artifact.condition_key, "observation"),
|
|
67
|
+
]);
|
|
68
|
+
if (!requiredAttachments.every((name) => item.attachment_names.includes(name)))
|
|
69
|
+
continue;
|
|
70
|
+
const cells = binding.evidence_artifacts.map((artifact) => {
|
|
71
|
+
const recordName = designMethodAttachmentName(target.key, binding.method, artifact.condition_key, "record");
|
|
72
|
+
return {
|
|
73
|
+
condition_key: artifact.condition_key,
|
|
74
|
+
artifact_path: artifact.path,
|
|
75
|
+
observation_artifact_path: artifact.observation_path,
|
|
76
|
+
fact_refs: artifact.fact_refs,
|
|
77
|
+
fact_results: designFactResultAttachment(item.attachment_payloads[recordName], `${target.key}:${binding.method}:${artifact.condition_key}`),
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
if (cells.some((cell) => cell.fact_results === null))
|
|
81
|
+
continue;
|
|
82
|
+
records.push({
|
|
83
|
+
assertion_key: assertion.key,
|
|
84
|
+
capability: "design_method",
|
|
85
|
+
design_target_ref: target.key,
|
|
86
|
+
target_ref: target.target_ref,
|
|
87
|
+
method: binding.method,
|
|
88
|
+
cells: cells.map((cell) => ({
|
|
89
|
+
...cell,
|
|
90
|
+
fact_results: cell.fact_results,
|
|
91
|
+
})),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return records;
|
|
95
|
+
}
|
|
96
|
+
function semanticFactRecords(check, item, assertion) {
|
|
97
|
+
if (!item.executed ||
|
|
98
|
+
!assertion.evidence_capabilities.includes("semantic_fact"))
|
|
99
|
+
return [];
|
|
100
|
+
const expectation = check.semantic_fact_expectations.find((candidate) => candidate.assertion_ref === assertion.key);
|
|
101
|
+
if (!expectation)
|
|
102
|
+
return [];
|
|
103
|
+
const attachmentName = semanticFactAttachmentName(expectation.proof_ref);
|
|
104
|
+
if (!item.attachment_names.includes(attachmentName))
|
|
105
|
+
return [];
|
|
106
|
+
const record = semanticFactAttachment(item.attachment_payloads[attachmentName]);
|
|
107
|
+
return record &&
|
|
108
|
+
record.assertion_key === assertion.key &&
|
|
109
|
+
record.proof_ref === expectation.proof_ref
|
|
110
|
+
? [record]
|
|
111
|
+
: [];
|
|
112
|
+
}
|
|
113
|
+
function semanticFactAttachment(payload) {
|
|
114
|
+
if (!payload)
|
|
115
|
+
return null;
|
|
116
|
+
try {
|
|
117
|
+
const records = decodeEvidenceCapabilityRecords([JSON.parse(payload)]);
|
|
118
|
+
const record = records[0];
|
|
119
|
+
return records.length === 1 && record.capability === "semantic_fact"
|
|
120
|
+
? record
|
|
121
|
+
: null;
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export function semanticFactAttachmentName(proofRef) {
|
|
128
|
+
return `ty-semantic-fact:${proofRef}`;
|
|
129
|
+
}
|
|
130
|
+
function designFactResultAttachment(content, label) {
|
|
131
|
+
if (!content)
|
|
132
|
+
return null;
|
|
133
|
+
try {
|
|
134
|
+
const payload = JSON.parse(content);
|
|
135
|
+
if (payload.schema_version !== "design-method-fact-results-v1" ||
|
|
136
|
+
!Object.hasOwn(payload, "fact_results"))
|
|
137
|
+
return null;
|
|
138
|
+
return decodeDesignFactResults(payload.fact_results, `playwright_design_method.${label}.fact_results`);
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export function designMethodAttachmentName(target, method, condition, kind) {
|
|
145
|
+
return `ty-context-design-method:${target}:${method}:${condition}:${kind}`;
|
|
146
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CompiledCheckV2 } from "./long-task-delivery-types.js";
|
|
2
|
+
export { record, same } from "./long-task-playwright-case-primitives.js";
|
|
2
3
|
export interface PlaywrightCaseInstance {
|
|
3
4
|
id: string;
|
|
4
5
|
project_id: string;
|
|
@@ -13,6 +14,7 @@ export interface PlaywrightCaseInstance {
|
|
|
13
14
|
given_keys: string[];
|
|
14
15
|
action_keys: string[];
|
|
15
16
|
attachment_names: string[];
|
|
17
|
+
attachment_payloads: Record<string, string>;
|
|
16
18
|
}
|
|
17
19
|
export interface PlaywrightCase {
|
|
18
20
|
id: string;
|
|
@@ -33,6 +35,7 @@ export interface PlaywrightCase {
|
|
|
33
35
|
given_keys: string[];
|
|
34
36
|
action_keys: string[];
|
|
35
37
|
attachment_names: string[];
|
|
38
|
+
attachment_payloads: Record<string, string>;
|
|
36
39
|
}
|
|
37
40
|
export declare function collectCases(report: Record<string, unknown>, declaredIds: Set<string>): {
|
|
38
41
|
cases: PlaywrightCaseInstance[];
|
|
@@ -41,5 +44,3 @@ export declare function collectCases(report: Record<string, unknown>, declaredId
|
|
|
41
44
|
};
|
|
42
45
|
export declare function declaredCaseIds(check: CompiledCheckV2): Set<string>;
|
|
43
46
|
export declare function duplicateCaseInstance(values: PlaywrightCaseInstance[]): PlaywrightCaseInstance | null;
|
|
44
|
-
export declare function record(value: unknown): Record<string, unknown> | null;
|
|
45
|
-
export declare function same(left: string[], right: string[]): boolean;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { consistentScenarioTrace, playwrightAttachments, playwrightExecutionState, playwrightIdentity, playwrightResults, record, } from "./long-task-playwright-case-primitives.js";
|
|
2
|
+
export { record, same } from "./long-task-playwright-case-primitives.js";
|
|
1
3
|
export function collectCases(report, declaredIds) {
|
|
2
4
|
const cases = [];
|
|
3
5
|
const collection = { unbound_unexpected_instances: 0 };
|
|
@@ -48,59 +50,21 @@ function declaredIdsInTitle(title, declared) {
|
|
|
48
50
|
].sort();
|
|
49
51
|
}
|
|
50
52
|
function playwrightCase(id, test) {
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
? test.projectId
|
|
54
|
-
: typeof test.projectName === "string"
|
|
55
|
-
? test.projectName
|
|
56
|
-
: "default";
|
|
57
|
-
const results = Array.isArray(test.results)
|
|
58
|
-
? test.results.map(record).filter(Boolean)
|
|
59
|
-
: [];
|
|
53
|
+
const { status, projectId } = playwrightIdentity(test);
|
|
54
|
+
const results = playwrightResults(test);
|
|
60
55
|
const resultStatuses = results
|
|
61
56
|
.map((result) => result.status)
|
|
62
57
|
.filter((value) => typeof value === "string");
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const executed = !skipped && resultStatuses.length > 0;
|
|
67
|
-
const flaky = status === "flaky";
|
|
68
|
-
const unexpected = status === "unexpected";
|
|
69
|
-
const timedOut = resultStatuses.includes("timedOut");
|
|
70
|
-
const interrupted = resultStatuses.includes("interrupted");
|
|
71
|
-
const passed = executed &&
|
|
72
|
-
!flaky &&
|
|
73
|
-
!unexpected &&
|
|
74
|
-
status === "expected" &&
|
|
75
|
-
resultStatuses.length > 0 &&
|
|
76
|
-
resultStatuses.at(-1) === "passed";
|
|
77
|
-
const traces = results.map((result) => scenarioTrace(result));
|
|
78
|
-
const attachmentNames = [
|
|
79
|
-
...new Set(results.flatMap((result) => Array.isArray(result.attachments)
|
|
80
|
-
? result.attachments
|
|
81
|
-
.map(record)
|
|
82
|
-
.filter(Boolean)
|
|
83
|
-
.map((attachment) => attachment.name)
|
|
84
|
-
.filter((name) => typeof name === "string")
|
|
85
|
-
: [])),
|
|
86
|
-
].sort();
|
|
87
|
-
const givenKeys = traces[0]?.given_keys ?? [];
|
|
88
|
-
const actionKeys = traces[0]?.action_keys ?? [];
|
|
89
|
-
const traceConsistent = traces.every((trace) => same(trace.given_keys, givenKeys) && same(trace.action_keys, actionKeys));
|
|
58
|
+
const state = playwrightExecutionState(status, resultStatuses);
|
|
59
|
+
const trace = consistentScenarioTrace(results);
|
|
60
|
+
const attachments = playwrightAttachments(results);
|
|
90
61
|
return {
|
|
91
62
|
id,
|
|
92
63
|
project_id: projectId,
|
|
93
|
-
|
|
94
|
-
passed,
|
|
95
|
-
skipped,
|
|
96
|
-
flaky,
|
|
97
|
-
unexpected,
|
|
98
|
-
timed_out: timedOut,
|
|
99
|
-
interrupted,
|
|
64
|
+
...state,
|
|
100
65
|
status,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
attachment_names: attachmentNames,
|
|
66
|
+
...trace,
|
|
67
|
+
...attachments,
|
|
104
68
|
};
|
|
105
69
|
}
|
|
106
70
|
export function declaredCaseIds(check) {
|
|
@@ -125,36 +89,3 @@ export function duplicateCaseInstance(values) {
|
|
|
125
89
|
}
|
|
126
90
|
return null;
|
|
127
91
|
}
|
|
128
|
-
export function record(value) {
|
|
129
|
-
return value && typeof value === "object" && !Array.isArray(value)
|
|
130
|
-
? value
|
|
131
|
-
: null;
|
|
132
|
-
}
|
|
133
|
-
function scenarioTrace(result) {
|
|
134
|
-
const givenKeys = [];
|
|
135
|
-
const actionKeys = [];
|
|
136
|
-
const visit = (value) => {
|
|
137
|
-
if (!Array.isArray(value))
|
|
138
|
-
return;
|
|
139
|
-
for (const item of value) {
|
|
140
|
-
const step = record(item);
|
|
141
|
-
if (!step)
|
|
142
|
-
continue;
|
|
143
|
-
if (typeof step.title === "string") {
|
|
144
|
-
const given = /^\[given:([a-z0-9][a-z0-9-]*)\]$/u.exec(step.title);
|
|
145
|
-
const action = /^\[action:([a-z0-9][a-z0-9-]*)\]$/u.exec(step.title);
|
|
146
|
-
if (given)
|
|
147
|
-
givenKeys.push(given[1]);
|
|
148
|
-
if (action)
|
|
149
|
-
actionKeys.push(action[1]);
|
|
150
|
-
}
|
|
151
|
-
visit(step.steps);
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
visit(result.steps);
|
|
155
|
-
return { given_keys: givenKeys, action_keys: actionKeys };
|
|
156
|
-
}
|
|
157
|
-
export function same(left, right) {
|
|
158
|
-
return (left.length === right.length &&
|
|
159
|
-
left.every((value, index) => value === right[index]));
|
|
160
|
-
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
interface PlaywrightExecutionState {
|
|
2
|
+
executed: boolean;
|
|
3
|
+
passed: boolean;
|
|
4
|
+
skipped: boolean;
|
|
5
|
+
flaky: boolean;
|
|
6
|
+
unexpected: boolean;
|
|
7
|
+
timed_out: boolean;
|
|
8
|
+
interrupted: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface PlaywrightAttachments {
|
|
11
|
+
attachment_names: string[];
|
|
12
|
+
attachment_payloads: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
interface PlaywrightScenarioTrace {
|
|
15
|
+
given_keys: string[];
|
|
16
|
+
action_keys: string[];
|
|
17
|
+
}
|
|
18
|
+
export declare function playwrightIdentity(test: Record<string, unknown>): {
|
|
19
|
+
status: string;
|
|
20
|
+
projectId: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function playwrightResults(test: Record<string, unknown>): Record<string, unknown>[];
|
|
23
|
+
export declare function playwrightExecutionState(status: string, resultStatuses: string[]): PlaywrightExecutionState;
|
|
24
|
+
export declare function playwrightAttachments(results: Record<string, unknown>[]): PlaywrightAttachments;
|
|
25
|
+
export declare function consistentScenarioTrace(results: Record<string, unknown>[]): PlaywrightScenarioTrace;
|
|
26
|
+
export declare function record(value: unknown): Record<string, unknown> | null;
|
|
27
|
+
export declare function same(left: string[], right: string[]): boolean;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export function playwrightIdentity(test) {
|
|
2
|
+
const status = typeof test.status === "string" ? test.status : "invalid";
|
|
3
|
+
const projectId = typeof test.projectId === "string"
|
|
4
|
+
? test.projectId
|
|
5
|
+
: typeof test.projectName === "string"
|
|
6
|
+
? test.projectName
|
|
7
|
+
: "default";
|
|
8
|
+
return { status, projectId };
|
|
9
|
+
}
|
|
10
|
+
export function playwrightResults(test) {
|
|
11
|
+
if (!Array.isArray(test.results))
|
|
12
|
+
return [];
|
|
13
|
+
return test.results
|
|
14
|
+
.map(record)
|
|
15
|
+
.filter((item) => item !== null);
|
|
16
|
+
}
|
|
17
|
+
export function playwrightExecutionState(status, resultStatuses) {
|
|
18
|
+
const skipped = status === "skipped" ||
|
|
19
|
+
(resultStatuses.length > 0 &&
|
|
20
|
+
resultStatuses.every((value) => value === "skipped"));
|
|
21
|
+
const executed = !skipped && resultStatuses.length > 0;
|
|
22
|
+
const flaky = status === "flaky";
|
|
23
|
+
const unexpected = status === "unexpected";
|
|
24
|
+
const timedOut = resultStatuses.includes("timedOut");
|
|
25
|
+
const interrupted = resultStatuses.includes("interrupted");
|
|
26
|
+
const passed = executed &&
|
|
27
|
+
!flaky &&
|
|
28
|
+
!unexpected &&
|
|
29
|
+
status === "expected" &&
|
|
30
|
+
resultStatuses.length > 0 &&
|
|
31
|
+
resultStatuses.at(-1) === "passed";
|
|
32
|
+
return {
|
|
33
|
+
executed,
|
|
34
|
+
passed,
|
|
35
|
+
skipped,
|
|
36
|
+
flaky,
|
|
37
|
+
unexpected,
|
|
38
|
+
timed_out: timedOut,
|
|
39
|
+
interrupted,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export function playwrightAttachments(results) {
|
|
43
|
+
const attachmentNames = [
|
|
44
|
+
...new Set(results.flatMap((result) => Array.isArray(result.attachments)
|
|
45
|
+
? result.attachments
|
|
46
|
+
.map(record)
|
|
47
|
+
.filter((item) => item !== null)
|
|
48
|
+
.map((attachment) => attachment.name)
|
|
49
|
+
.filter((name) => typeof name === "string")
|
|
50
|
+
: [])),
|
|
51
|
+
].sort();
|
|
52
|
+
const attachmentPayloads = {};
|
|
53
|
+
for (const result of results)
|
|
54
|
+
collectAttachmentPayloads(result.attachments, attachmentPayloads);
|
|
55
|
+
return {
|
|
56
|
+
attachment_names: attachmentNames,
|
|
57
|
+
attachment_payloads: attachmentPayloads,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function collectAttachmentPayloads(values, payloads) {
|
|
61
|
+
if (!Array.isArray(values))
|
|
62
|
+
return;
|
|
63
|
+
for (const value of values) {
|
|
64
|
+
const attachment = record(value);
|
|
65
|
+
if (!attachment || typeof attachment.name !== "string")
|
|
66
|
+
continue;
|
|
67
|
+
const body = attachmentBody(attachment.body);
|
|
68
|
+
if (body === null)
|
|
69
|
+
continue;
|
|
70
|
+
const previous = payloads[attachment.name];
|
|
71
|
+
if (previous !== undefined && previous !== body)
|
|
72
|
+
delete payloads[attachment.name];
|
|
73
|
+
else
|
|
74
|
+
payloads[attachment.name] = body;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export function consistentScenarioTrace(results) {
|
|
78
|
+
const traces = results.map((result) => scenarioTrace(result));
|
|
79
|
+
const givenKeys = traces[0]?.given_keys ?? [];
|
|
80
|
+
const actionKeys = traces[0]?.action_keys ?? [];
|
|
81
|
+
const traceConsistent = traces.every((trace) => same(trace.given_keys, givenKeys) && same(trace.action_keys, actionKeys));
|
|
82
|
+
return {
|
|
83
|
+
given_keys: traceConsistent ? givenKeys : [],
|
|
84
|
+
action_keys: traceConsistent ? actionKeys : [],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function attachmentBody(value) {
|
|
88
|
+
if (typeof value === "string")
|
|
89
|
+
return stringAttachmentBody(value);
|
|
90
|
+
const body = record(value);
|
|
91
|
+
if (body?.type === "Buffer" &&
|
|
92
|
+
Array.isArray(body.data) &&
|
|
93
|
+
body.data.every((item) => Number.isInteger(item) && Number(item) >= 0 && Number(item) <= 255))
|
|
94
|
+
return Buffer.from(body.data).toString("utf8");
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
function stringAttachmentBody(value) {
|
|
98
|
+
try {
|
|
99
|
+
const decoded = Buffer.from(value, "base64").toString("utf8");
|
|
100
|
+
if (decoded.trim().startsWith("{") || decoded.trim().startsWith("["))
|
|
101
|
+
return decoded;
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// Fall through to plain text.
|
|
105
|
+
}
|
|
106
|
+
return value;
|
|
107
|
+
}
|
|
108
|
+
export function record(value) {
|
|
109
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
110
|
+
? value
|
|
111
|
+
: null;
|
|
112
|
+
}
|
|
113
|
+
function scenarioTrace(result) {
|
|
114
|
+
const givenKeys = [];
|
|
115
|
+
const actionKeys = [];
|
|
116
|
+
visitScenarioSteps(result.steps, givenKeys, actionKeys);
|
|
117
|
+
return { given_keys: givenKeys, action_keys: actionKeys };
|
|
118
|
+
}
|
|
119
|
+
function visitScenarioSteps(value, givenKeys, actionKeys) {
|
|
120
|
+
if (!Array.isArray(value))
|
|
121
|
+
return;
|
|
122
|
+
for (const item of value) {
|
|
123
|
+
const step = record(item);
|
|
124
|
+
if (!step)
|
|
125
|
+
continue;
|
|
126
|
+
appendScenarioStep(step.title, givenKeys, actionKeys);
|
|
127
|
+
visitScenarioSteps(step.steps, givenKeys, actionKeys);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function appendScenarioStep(title, givenKeys, actionKeys) {
|
|
131
|
+
if (typeof title !== "string")
|
|
132
|
+
return;
|
|
133
|
+
const given = /^\[given:([a-z0-9][a-z0-9-]*)\]$/u.exec(title);
|
|
134
|
+
const action = /^\[action:([a-z0-9][a-z0-9-]*)\]$/u.exec(title);
|
|
135
|
+
if (given)
|
|
136
|
+
givenKeys.push(given[1]);
|
|
137
|
+
if (action)
|
|
138
|
+
actionKeys.push(action[1]);
|
|
139
|
+
}
|
|
140
|
+
export function same(left, right) {
|
|
141
|
+
return (left.length === right.length &&
|
|
142
|
+
left.every((value, index) => value === right[index]));
|
|
143
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CompiledCheckV2, EvidenceCapabilityRecordV2 } from "./long-task-delivery-types.js";
|
|
2
|
+
export { designMethodAttachmentName, semanticFactAttachmentName, } from "./long-task-playwright-capability-records.js";
|
|
2
3
|
export interface PlaywrightEvidence {
|
|
3
4
|
observations: Record<string, unknown>;
|
|
4
5
|
evidence_records: EvidenceCapabilityRecordV2[];
|
|
5
6
|
error: string | null;
|
|
6
7
|
}
|
|
7
8
|
export declare function extractPlaywrightEvidence(check: CompiledCheckV2, report: Record<string, unknown>, exitCode: number): PlaywrightEvidence;
|
|
8
|
-
export declare function designMethodAttachmentName(target: string, method: string, condition: string, kind: "record" | "observation"): string;
|