project-tiny-context-harness 0.7.3 → 0.7.4

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.
Files changed (75) hide show
  1. package/README.md +2 -2
  2. package/assets/README.md +44 -11
  3. package/assets/README.zh-CN.md +21 -10
  4. package/assets/agents/AGENTS_CORE.md +2 -2
  5. package/assets/skills/long-task-workflow/SKILL.md +9 -9
  6. package/assets/skills/long-task-workflow/references/authority-lifecycle.md +7 -5
  7. package/assets/skills/long-task-workflow/references/contract-authoring.md +17 -3
  8. package/assets/skills/long-task-workflow/references/evidence-design.md +12 -1
  9. package/dist/commands/long-task-authoring.js +25 -0
  10. package/dist/commands/long-task.js +3 -0
  11. package/dist/lib/long-task-activation-validation.js +13 -2
  12. package/dist/lib/long-task-authoring-authority-preview.js +1 -0
  13. package/dist/lib/long-task-authority-material-diff.js +26 -0
  14. package/dist/lib/long-task-authority-materials.d.ts +2 -2
  15. package/dist/lib/long-task-authority-materials.js +6 -0
  16. package/dist/lib/long-task-authority-policy.d.ts +12 -0
  17. package/dist/lib/long-task-authority-policy.js +9 -0
  18. package/dist/lib/long-task-authority-revision-analysis.d.ts +33 -0
  19. package/dist/lib/long-task-authority-revision-analysis.js +91 -0
  20. package/dist/lib/long-task-authority-revision.js +93 -158
  21. package/dist/lib/long-task-authority-types.d.ts +7 -0
  22. package/dist/lib/long-task-authority.js +32 -3
  23. package/dist/lib/long-task-check-evidence-decoder.d.ts +2 -2
  24. package/dist/lib/long-task-check-evidence-decoder.js +11 -1
  25. package/dist/lib/long-task-check-execution-policy.d.ts +3 -0
  26. package/dist/lib/long-task-check-execution-policy.js +5 -0
  27. package/dist/lib/long-task-check-runner.js +2 -0
  28. package/dist/lib/long-task-check-shape.js +33 -3
  29. package/dist/lib/long-task-conformance-policy.d.ts +5 -0
  30. package/dist/lib/long-task-conformance-policy.js +35 -0
  31. package/dist/lib/long-task-contract-types.d.ts +14 -4
  32. package/dist/lib/long-task-delivery-compiler.js +1 -0
  33. package/dist/lib/long-task-delivery-parser.js +5 -2
  34. package/dist/lib/long-task-delivery-types.d.ts +2 -0
  35. package/dist/lib/long-task-delivery-types.js +2 -0
  36. package/dist/lib/long-task-delivery-validation.js +11 -0
  37. package/dist/lib/long-task-evidence-capability-codec.d.ts +2 -0
  38. package/dist/lib/long-task-evidence-capability-codec.js +231 -0
  39. package/dist/lib/long-task-evidence-capability-policy.d.ts +8 -0
  40. package/dist/lib/long-task-evidence-capability-policy.js +147 -0
  41. package/dist/lib/long-task-evidence-capability-runtime.d.ts +2 -0
  42. package/dist/lib/long-task-evidence-capability-runtime.js +86 -0
  43. package/dist/lib/long-task-evidence-capability-types.d.ts +74 -0
  44. package/dist/lib/long-task-evidence-capability-types.js +1 -0
  45. package/dist/lib/long-task-evidence-findings.js +5 -1
  46. package/dist/lib/long-task-evidence-v2.js +38 -23
  47. package/dist/lib/long-task-final-v2.js +42 -1
  48. package/dist/lib/long-task-outcome-parser.js +14 -3
  49. package/dist/lib/long-task-playwright-evidence.d.ts +2 -1
  50. package/dist/lib/long-task-playwright-evidence.js +70 -2
  51. package/dist/lib/long-task-progress.js +4 -0
  52. package/dist/lib/long-task-root-shape.d.ts +1 -0
  53. package/dist/lib/long-task-root-shape.js +84 -3
  54. package/dist/lib/long-task-runner-environment.js +1 -1
  55. package/dist/lib/long-task-runner-freeze.d.ts +2 -2
  56. package/dist/lib/long-task-runner-freeze.js +3 -1
  57. package/dist/lib/long-task-runtime-types.d.ts +13 -0
  58. package/dist/lib/long-task-semantic-contract-types.d.ts +36 -0
  59. package/dist/lib/long-task-semantic-contract-types.js +1 -0
  60. package/dist/lib/long-task-semantic-drift-migration.d.ts +3 -0
  61. package/dist/lib/long-task-semantic-drift-migration.js +68 -0
  62. package/dist/lib/long-task-shape-primitives.d.ts +3 -0
  63. package/dist/lib/long-task-shape-primitives.js +25 -0
  64. package/dist/lib/long-task-stage-policy.d.ts +4 -0
  65. package/dist/lib/long-task-stage-policy.js +120 -0
  66. package/dist/lib/long-task-status-projection.d.ts +4 -1
  67. package/dist/lib/long-task-status-projection.js +63 -3
  68. package/dist/lib/long-task-status-v2.d.ts +11 -1
  69. package/dist/lib/long-task-status-v2.js +25 -3
  70. package/dist/lib/long-task-target-policy.d.ts +6 -0
  71. package/dist/lib/long-task-target-policy.js +127 -0
  72. package/dist/lib/migrations.js +29 -0
  73. package/dist/schemas/long-task-delivery-v2/long-task-delivery-v2.schema.json +61 -7
  74. package/migrations/README.md +7 -0
  75. package/package.json +2 -2
@@ -3,6 +3,7 @@ import { addDiagnosticError } from "./long-task-authoring-preflight-diagnostics.
3
3
  import { compileProductClaimCoverage, } from "./long-task-claims.js";
4
4
  import { hashDeclaredFiles, validateCounterfactualPaths, validateTechnicalPaths, validateVerificationInputSeparation, } from "./long-task-delivery-preflight.js";
5
5
  import { validateClaimEvidenceSensitivity } from "./long-task-evidence-sensitivity-policy.js";
6
+ import { validateSemanticConformance } from "./long-task-conformance-policy.js";
6
7
  import { deliveryContractStructureDiagnostics, validateDeliveryContractStructure, } from "./long-task-delivery-validation.js";
7
8
  import { validateRawExecutionObservationOwnership } from "./long-task-observation-ownership.js";
8
9
  import { freezeDeliveryCheck } from "./long-task-runner-freeze.js";
@@ -56,7 +57,10 @@ export async function validateContractForActivation(options) {
56
57
  return emptyCompiledResult(claims, risk, sourceHashes, sourceItems, context);
57
58
  const globalChecks = [];
58
59
  for (const check of contract.global.acceptance.checks) {
59
- const frozen = await attempt(mode, diagnostics, () => freezeDeliveryCheck(check, null, repository, workspace), null, check.key);
60
+ const executionTarget = contract.task.execution_targets.find((target) => target.key === check.execution_target.target_ref);
61
+ if (!executionTarget)
62
+ continue;
63
+ const frozen = await attempt(mode, diagnostics, () => freezeDeliveryCheck(check, null, repository, workspace, executionTarget, contract.task.execution_targets), null, check.key);
60
64
  if (frozen)
61
65
  globalChecks.push(frozen);
62
66
  }
@@ -64,7 +68,10 @@ export async function validateContractForActivation(options) {
64
68
  for (const outcome of contract.outcomes) {
65
69
  const checks = [];
66
70
  for (const check of outcome.acceptance.checks) {
67
- const frozen = await attempt(mode, diagnostics, () => freezeDeliveryCheck(check, outcome.key, repository, workspace), outcome.key, check.key);
71
+ const executionTarget = contract.task.execution_targets.find((target) => target.key === check.execution_target.target_ref);
72
+ if (!executionTarget)
73
+ continue;
74
+ const frozen = await attempt(mode, diagnostics, () => freezeDeliveryCheck(check, outcome.key, repository, workspace, executionTarget, contract.task.execution_targets), outcome.key, check.key);
68
75
  if (frozen)
69
76
  checks.push(frozen);
70
77
  }
@@ -91,6 +98,10 @@ export async function validateContractForActivation(options) {
91
98
  await attempt(mode, diagnostics, () => validateClaimEvidenceSensitivity(contract, globalChecks, outcomes, mode === "collect"
92
99
  ? (error) => addDiagnosticError(diagnostics, new Error(error))
93
100
  : undefined));
101
+ if (risk)
102
+ await attempt(mode, diagnostics, () => validateSemanticConformance(contract, risk.effective_level, allChecks, mode === "collect"
103
+ ? (error) => addDiagnosticError(diagnostics, new Error(error))
104
+ : undefined));
94
105
  }
95
106
  return {
96
107
  claims,
@@ -33,6 +33,7 @@ export function authoringRevisionPreview(contract, sourceHashes, sourceItems, co
33
33
  schema_version: "long-task-delivery-v2",
34
34
  task: active.authority_snapshot.task,
35
35
  source_claims: active.authority_snapshot.source_claims,
36
+ stages: active.authority_snapshot.stages,
36
37
  risk: active.authority_snapshot.risk,
37
38
  global: active.authority_snapshot.global,
38
39
  outcomes: active.authority_snapshot.outcomes,
@@ -89,13 +89,39 @@ function productClaimSemantics(contract) {
89
89
  function flattenProductSemantics(projection) {
90
90
  const fields = new Map([
91
91
  ["task.goal", projection.task_goal],
92
+ ["task.target_profile.key", projection.target_profile.key],
93
+ ["task.target_profile.description", projection.target_profile.description],
94
+ [
95
+ "task.target_profile.required_state",
96
+ projection.target_profile.required_state,
97
+ ],
98
+ [
99
+ "task.target_profile.required_target_refs",
100
+ [...projection.target_profile.required_target_refs].sort(),
101
+ ],
92
102
  ]);
103
+ for (const target of projection.execution_targets) {
104
+ const prefix = `task.execution_targets.${target.key}`;
105
+ fields.set(`${prefix}.description`, target.description);
106
+ fields.set(`${prefix}.role`, target.role);
107
+ fields.set(`${prefix}.runtime_family`, target.runtime_family);
108
+ fields.set(`${prefix}.root_entrypoint`, target.root_entrypoint);
109
+ }
110
+ for (const stage of projection.stages) {
111
+ const prefix = `stages.${stage.key}`;
112
+ fields.set(`${prefix}.title`, stage.title);
113
+ fields.set(`${prefix}.depends_on`, [...stage.depends_on].sort());
114
+ fields.set(`${prefix}.gate_outcome`, stage.gate_outcome);
115
+ }
93
116
  for (const item of projection.global_non_goals)
94
117
  fields.set(`global.product.non_goals.${item.key}`, item.statement);
95
118
  for (const outcome of projection.outcomes) {
96
119
  const prefix = `outcomes.${outcome.key}`;
97
120
  fields.set(`${prefix}.title`, outcome.title);
121
+ fields.set(`${prefix}.stage`, outcome.stage);
98
122
  fields.set(`${prefix}.observable_result`, outcome.observable_result);
123
+ fields.set(`${prefix}.success_path_required`, outcome.success_path_required);
124
+ fields.set(`${prefix}.degradation_path_required`, outcome.degradation_path_required);
99
125
  fields.set(`${prefix}.owner.label`, outcome.owner.label);
100
126
  fields.set(`${prefix}.owner.owner_surfaces`, outcome.owner.owner_surfaces);
101
127
  for (const requirement of outcome.requirements) {
@@ -1,7 +1,7 @@
1
1
  import type { AuthorityMaterialHashesV2, CompiledDeliveryContractV2, CompiledSourceItemV2, ContextAuthoritySnapshotV2, DeliveryContractV2, GlobalSemanticProjectionV2, NextAuthorityMaterialsV2, ProductSemanticProjectionV2 } from "./long-task-delivery-types.js";
2
- export declare function computeAuthorityMaterials(contract: Pick<DeliveryContractV2, "task" | "global" | "outcomes">, sourceHashes: Record<string, string>, sourceItems: CompiledSourceItemV2[], contextSnapshot: ContextAuthoritySnapshotV2): NextAuthorityMaterialsV2;
2
+ export declare function computeAuthorityMaterials(contract: Pick<DeliveryContractV2, "task" | "global" | "outcomes" | "stages">, sourceHashes: Record<string, string>, sourceItems: CompiledSourceItemV2[], contextSnapshot: ContextAuthoritySnapshotV2): NextAuthorityMaterialsV2;
3
3
  export declare function compiledAuthorityMaterials(compiled: CompiledDeliveryContractV2): NextAuthorityMaterialsV2;
4
4
  export declare function authorityMaterialHashes(materials: NextAuthorityMaterialsV2): AuthorityMaterialHashesV2;
5
5
  export declare function authorityMaterialsChanged(previous: NextAuthorityMaterialsV2, next: NextAuthorityMaterialsV2): boolean;
6
- export declare function projectProductSemantics(contract: Pick<DeliveryContractV2, "task" | "global" | "outcomes">): ProductSemanticProjectionV2;
6
+ export declare function projectProductSemantics(contract: Pick<DeliveryContractV2, "task" | "global" | "outcomes" | "stages">): ProductSemanticProjectionV2;
7
7
  export declare function projectGlobalSemantics(contract: Pick<DeliveryContractV2, "global">): GlobalSemanticProjectionV2;
@@ -28,11 +28,17 @@ export function authorityMaterialsChanged(previous, next) {
28
28
  export function projectProductSemantics(contract) {
29
29
  return {
30
30
  task_goal: contract.task.goal,
31
+ target_profile: contract.task.target_profile,
32
+ execution_targets: [...contract.task.execution_targets].sort(keyOrder),
33
+ stages: [...contract.stages].sort(keyOrder),
31
34
  global_non_goals: keyedStatements(contract.global.product.non_goals),
32
35
  outcomes: [...contract.outcomes].sort(keyOrder).map((outcome) => ({
33
36
  key: outcome.key,
34
37
  title: outcome.title,
38
+ stage: outcome.stage,
35
39
  observable_result: outcome.product.observable_result,
40
+ success_path_required: outcome.product.success_path_required,
41
+ degradation_path_required: outcome.product.degradation_path_required,
36
42
  owner: {
37
43
  label: outcome.product.owner.label,
38
44
  owner_surfaces: [...outcome.product.owner_surfaces].sort(),
@@ -1,6 +1,9 @@
1
1
  export type AuthorityFieldPolicy = "identity" | "semantic_user_review" | "proof_additive" | "runner_authority" | "input_coverage" | "output_requirement" | "scope" | "readiness_only" | "descriptive_non_authoritative";
2
2
  export declare const CHECK_AUTHORITY_POLICY: {
3
3
  key: "identity";
4
+ journey_roles: "proof_additive";
5
+ execution_target: "semantic_user_review";
6
+ scenario: "proof_additive";
4
7
  proof_surface: "semantic_user_review";
5
8
  runner: "runner_authority";
6
9
  verification_inputs: "proof_additive";
@@ -19,6 +22,8 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
19
22
  source_paths: "scope";
20
23
  context_refs: "scope";
21
24
  context_snapshot_mode: "scope";
25
+ target_profile: "semantic_user_review";
26
+ execution_targets: "semantic_user_review";
22
27
  };
23
28
  readonly source_claim: {
24
29
  key: "identity";
@@ -46,6 +51,7 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
46
51
  readonly outcome: {
47
52
  key: "identity";
48
53
  title: "descriptive_non_authoritative";
54
+ stage: "semantic_user_review";
49
55
  depends_on: "readiness_only";
50
56
  product: "semantic_user_review";
51
57
  technical: "semantic_user_review";
@@ -53,6 +59,8 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
53
59
  };
54
60
  readonly outcome_product: {
55
61
  observable_result: "semantic_user_review";
62
+ success_path_required: "semantic_user_review";
63
+ degradation_path_required: "semantic_user_review";
56
64
  owner: "semantic_user_review";
57
65
  requirements: "semantic_user_review";
58
66
  owner_surfaces: "semantic_user_review";
@@ -114,6 +122,9 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
114
122
  };
115
123
  readonly check: {
116
124
  key: "identity";
125
+ journey_roles: "proof_additive";
126
+ execution_target: "semantic_user_review";
127
+ scenario: "proof_additive";
117
128
  proof_surface: "semantic_user_review";
118
129
  runner: "runner_authority";
119
130
  verification_inputs: "proof_additive";
@@ -129,6 +140,7 @@ export declare const AUTHORITY_FIELD_POLICY_REGISTRIES: {
129
140
  criterion: "semantic_user_review";
130
141
  claims: "proof_additive";
131
142
  observation: "proof_additive";
143
+ evidence_capabilities: "proof_additive";
132
144
  operator: "proof_additive";
133
145
  expected: "proof_additive";
134
146
  };
@@ -5,6 +5,8 @@ const TASK_AUTHORITY_POLICY = {
5
5
  source_paths: "scope",
6
6
  context_refs: "scope",
7
7
  context_snapshot_mode: "scope",
8
+ target_profile: "semantic_user_review",
9
+ execution_targets: "semantic_user_review",
8
10
  };
9
11
  const SOURCE_CLAIM_AUTHORITY_POLICY = {
10
12
  key: "identity",
@@ -32,6 +34,7 @@ const GLOBAL_ACCEPTANCE_AUTHORITY_POLICY = {
32
34
  const OUTCOME_AUTHORITY_POLICY = {
33
35
  key: "identity",
34
36
  title: "descriptive_non_authoritative",
37
+ stage: "semantic_user_review",
35
38
  depends_on: "readiness_only",
36
39
  product: "semantic_user_review",
37
40
  technical: "semantic_user_review",
@@ -39,6 +42,8 @@ const OUTCOME_AUTHORITY_POLICY = {
39
42
  };
40
43
  const OUTCOME_PRODUCT_AUTHORITY_POLICY = {
41
44
  observable_result: "semantic_user_review",
45
+ success_path_required: "semantic_user_review",
46
+ degradation_path_required: "semantic_user_review",
42
47
  owner: "semantic_user_review",
43
48
  requirements: "semantic_user_review",
44
49
  owner_surfaces: "semantic_user_review",
@@ -100,6 +105,9 @@ const OUTCOME_ACCEPTANCE_AUTHORITY_POLICY = {
100
105
  };
101
106
  export const CHECK_AUTHORITY_POLICY = {
102
107
  key: "identity",
108
+ journey_roles: "proof_additive",
109
+ execution_target: "semantic_user_review",
110
+ scenario: "proof_additive",
103
111
  proof_surface: "semantic_user_review",
104
112
  runner: "runner_authority",
105
113
  verification_inputs: "proof_additive",
@@ -115,6 +123,7 @@ const ASSERTION_AUTHORITY_POLICY = {
115
123
  criterion: "semantic_user_review",
116
124
  claims: "proof_additive",
117
125
  observation: "proof_additive",
126
+ evidence_capabilities: "proof_additive",
118
127
  operator: "proof_additive",
119
128
  expected: "proof_additive",
120
129
  };
@@ -0,0 +1,33 @@
1
+ import type { CompiledCheckV2, CompiledDeliveryContractV2, DeliveryContractV2 } from "./long-task-delivery-types.js";
2
+ export interface CheckRevisionAnalysis {
3
+ negative_assertions_removed: string[];
4
+ proof_surfaces_changed: string[];
5
+ runner_definitions_changed: string[];
6
+ verification_inputs_added: string[];
7
+ verification_inputs_removed_or_replaced: string[];
8
+ input_paths_added: string[];
9
+ input_paths_removed_or_narrowed: string[];
10
+ expected_output_paths_removed_or_weakened: string[];
11
+ artifacts_removed: string[];
12
+ environment_requirements_removed: string[];
13
+ }
14
+ export declare function analyzeCheckRevisions(beforeChecks: Map<string, CompiledCheckV2>, afterChecks: Map<string, CompiledCheckV2>): CheckRevisionAnalysis;
15
+ export interface OutcomeRevisionAnalysis {
16
+ owner_paths_expanded: string[];
17
+ owner_context_refs_removed: string[];
18
+ expected_change_paths_expanded: string[];
19
+ allowed_paths_expanded: string[];
20
+ forbidden_paths_removed: string[];
21
+ bindings_removed_or_expanded: string[];
22
+ obligations_removed_or_weakened: string[];
23
+ rollback_or_recovery_weakened: string[];
24
+ counterfactuals_removed: string[];
25
+ population_weakened: string[];
26
+ }
27
+ export declare function analyzeOutcomeRevisions(previous: CompiledDeliveryContractV2, next: DeliveryContractV2): OutcomeRevisionAnalysis;
28
+ export declare function keyedAuthorityChanges(before: Array<{
29
+ key: string;
30
+ }>, after: Array<{
31
+ key: string;
32
+ }>): string[];
33
+ export declare function selectedRevisionReasons(entries: Array<[reason: string, changed: boolean | unknown[]]>): string[];
@@ -0,0 +1,91 @@
1
+ import { addedInputPaths, addedVerificationInputs, bindingReductions, changedRunnerFields, counterfactualReductions, expandedPatterns, globalCounterfactualReductions, obligationReductions, removedExactValues, removedGlobalForbiddenPaths, removedOrNarrowedInputPaths, removedOrReplacedVerificationInputs, removedOrWeakenedExpectedOutputPaths, removedStructuredValues, rollbackReductions, same, } from "./long-task-authority-revision-details.js";
2
+ export function analyzeCheckRevisions(beforeChecks, afterChecks) {
3
+ const result = {
4
+ negative_assertions_removed: [],
5
+ proof_surfaces_changed: [],
6
+ runner_definitions_changed: [],
7
+ verification_inputs_added: [],
8
+ verification_inputs_removed_or_replaced: [],
9
+ input_paths_added: [],
10
+ input_paths_removed_or_narrowed: [],
11
+ expected_output_paths_removed_or_weakened: [],
12
+ artifacts_removed: [],
13
+ environment_requirements_removed: [],
14
+ };
15
+ for (const [identity, before] of beforeChecks) {
16
+ const after = afterChecks.get(identity);
17
+ if (!after)
18
+ continue;
19
+ for (const assertion of before.negative_assertions)
20
+ if (!after.negative_assertions.some((item) => same(item, assertion)))
21
+ result.negative_assertions_removed.push(`${identity}:${assertion.key}`);
22
+ if (before.proof_surface !== after.proof_surface)
23
+ result.proof_surfaces_changed.push(`${identity}:${before.proof_surface}->${after.proof_surface}`);
24
+ result.runner_definitions_changed.push(...changedRunnerFields(identity, before, after));
25
+ result.verification_inputs_added.push(...addedVerificationInputs(identity, before, after));
26
+ result.verification_inputs_removed_or_replaced.push(...removedOrReplacedVerificationInputs(identity, before, after));
27
+ result.input_paths_added.push(...addedInputPaths(identity, before, after));
28
+ result.input_paths_removed_or_narrowed.push(...removedOrNarrowedInputPaths(identity, before, after));
29
+ result.expected_output_paths_removed_or_weakened.push(...removedOrWeakenedExpectedOutputPaths(identity, before, after));
30
+ result.artifacts_removed.push(...removedExactValues(identity, before.artifact_globs, after.artifact_globs));
31
+ result.environment_requirements_removed.push(...removedStructuredValues(identity, before.environment_requirements, after.environment_requirements));
32
+ }
33
+ return result;
34
+ }
35
+ export function analyzeOutcomeRevisions(previous, next) {
36
+ const result = {
37
+ owner_paths_expanded: [],
38
+ owner_context_refs_removed: [],
39
+ expected_change_paths_expanded: [],
40
+ allowed_paths_expanded: [],
41
+ forbidden_paths_removed: removedGlobalForbiddenPaths(previous, next),
42
+ bindings_removed_or_expanded: [],
43
+ obligations_removed_or_weakened: [],
44
+ rollback_or_recovery_weakened: [],
45
+ counterfactuals_removed: globalCounterfactualReductions(previous, next),
46
+ population_weakened: [],
47
+ };
48
+ const previousOutcomes = new Map(previous.outcomes.map((outcome) => [outcome.key, outcome]));
49
+ for (const after of next.outcomes) {
50
+ const before = previousOutcomes.get(after.key);
51
+ if (!before)
52
+ continue;
53
+ result.owner_paths_expanded.push(...expandedPatterns(after.key, before.product.owner.path_globs, after.product.owner.path_globs));
54
+ result.owner_context_refs_removed.push(...removedExactValues(after.key, before.product.owner.context_refs, after.product.owner.context_refs));
55
+ result.expected_change_paths_expanded.push(...expandedPatterns(after.key, before.technical.expected_change_paths, after.technical.expected_change_paths));
56
+ result.allowed_paths_expanded.push(...expandedPatterns(after.key, before.technical.allowed_support_paths, after.technical.allowed_support_paths));
57
+ result.forbidden_paths_removed.push(...removedExactValues(after.key, before.technical.forbidden_paths, after.technical.forbidden_paths));
58
+ result.bindings_removed_or_expanded.push(...bindingReductions(before, after));
59
+ result.obligations_removed_or_weakened.push(...obligationReductions(before, after));
60
+ result.rollback_or_recovery_weakened.push(...rollbackReductions(before, after));
61
+ result.counterfactuals_removed.push(...counterfactualReductions(before, after));
62
+ if (before.acceptance.population &&
63
+ (!after.acceptance.population ||
64
+ !same(before.acceptance.population, after.acceptance.population)))
65
+ result.population_weakened.push(after.key);
66
+ }
67
+ return result;
68
+ }
69
+ export function keyedAuthorityChanges(before, after) {
70
+ const beforeByKey = new Map(before.map((item) => [item.key, item]));
71
+ const afterByKey = new Map(after.map((item) => [item.key, item]));
72
+ return [
73
+ ...before
74
+ .filter((item) => !afterByKey.has(item.key))
75
+ .map((item) => `${item.key}:removed`),
76
+ ...after
77
+ .filter((item) => !beforeByKey.has(item.key))
78
+ .map((item) => `${item.key}:added`),
79
+ ...before
80
+ .filter((item) => {
81
+ const candidate = afterByKey.get(item.key);
82
+ return candidate !== undefined && !same(item, candidate);
83
+ })
84
+ .map((item) => `${item.key}:changed`),
85
+ ].sort();
86
+ }
87
+ export function selectedRevisionReasons(entries) {
88
+ return entries
89
+ .filter(([, changed]) => Array.isArray(changed) ? changed.length > 0 : changed)
90
+ .map(([reason]) => reason);
91
+ }