@atcn/subledger 1.4.1 → 1.5.1

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.
@@ -0,0 +1,107 @@
1
+ {
2
+ "description": "ATCN adversarial reconciliation vectors (schema 1.5). Each vector is a sequence of steps against a buyer's subledger and the outcome ATCN must record. ATCN is an after-the-fact record: BLOCK means the attack does not change the books (refused or absorbed at intake); REVIEW means it is recorded and an open exception flags it for a person. Shaped to sit next to a2a-settlement/settlement-conformance results; run with examples/local-runner/scripts/reconciliation.ts.",
3
+ "artefact_id": "atcn-reconciliation-v1",
4
+ "schema_version": "1.0",
5
+ "step_ops": {
6
+ "task": "createTask(body); later steps name the task by its external_ref",
7
+ "delegation": "createDelegation(task, body); later steps name it by its external_ref",
8
+ "claim": "appendDelegationEvent(delegation, body)",
9
+ "financial_event": "recordFinancialEvent(body)",
10
+ "close": "closeTask(task); the closure must verify offline"
11
+ },
12
+ "vectors": [
13
+ {
14
+ "vector_id": "atcn-recon-double-charge-replay-001",
15
+ "attack_class": "double_charge",
16
+ "description": "The provider's billing feed re-sends a charge it already sent, byte for byte. It must be counted once.",
17
+ "steps": [
18
+ { "op": "task", "body": { "external_ref": "A", "currency": "USD" } },
19
+ { "op": "delegation", "task": "A", "body": { "external_ref": "d-a", "provider_name_stated": "Gamma", "provider_job_ref": "job-a", "currency": "USD", "accepted_amount_minor": 1000 } },
20
+ { "op": "claim", "delegation": "d-a", "body": { "type": "completion", "asserted_by": "provider" } },
21
+ { "op": "financial_event", "body": { "type": "charge", "source": "gamma-billing", "source_event_id": "ch-1", "amount_minor": 1000, "currency": "USD", "event_date": "2026-10-01T12:00:00Z", "match": { "provider_job_ref": "job-a" } } },
22
+ { "op": "financial_event", "body": { "type": "charge", "source": "gamma-billing", "source_event_id": "ch-1", "amount_minor": 1000, "currency": "USD", "event_date": "2026-10-01T12:00:00Z", "match": { "provider_job_ref": "job-a" } } },
23
+ { "op": "close", "task": "A" }
24
+ ],
25
+ "expected": { "verdict": "BLOCK", "refused_steps": [], "deduplicated_steps": [4], "exception_kinds": [], "net_cost_minor": { "A": 1000 }, "closed_net_cost_minor": { "A": 1000 } }
26
+ },
27
+ {
28
+ "vector_id": "atcn-recon-double-charge-distinct-001",
29
+ "attack_class": "double_charge",
30
+ "description": "The same work is billed twice under two charge ids. Both are real bill lines, so both are recorded, and the total over the accepted amount is flagged.",
31
+ "steps": [
32
+ { "op": "task", "body": { "external_ref": "A", "currency": "USD" } },
33
+ { "op": "delegation", "task": "A", "body": { "external_ref": "d-a", "provider_name_stated": "Gamma", "provider_job_ref": "job-a", "currency": "USD", "accepted_amount_minor": 1000 } },
34
+ { "op": "claim", "delegation": "d-a", "body": { "type": "completion", "asserted_by": "provider" } },
35
+ { "op": "financial_event", "body": { "type": "charge", "source": "gamma-billing", "source_event_id": "ch-1", "provider_reference": "inv-77", "amount_minor": 1000, "currency": "USD", "event_date": "2026-10-01T12:00:00Z", "match": { "provider_job_ref": "job-a" } } },
36
+ { "op": "financial_event", "body": { "type": "charge", "source": "gamma-billing", "source_event_id": "ch-2", "provider_reference": "inv-77", "amount_minor": 1000, "currency": "USD", "event_date": "2026-10-01T12:01:00Z", "match": { "provider_job_ref": "job-a" } } },
37
+ { "op": "close", "task": "A" }
38
+ ],
39
+ "expected": { "verdict": "REVIEW", "refused_steps": [], "deduplicated_steps": [], "exception_kinds": ["amount_mismatch"], "net_cost_minor": { "A": 2000 }, "closed_net_cost_minor": { "A": 2000 } }
40
+ },
41
+ {
42
+ "vector_id": "atcn-recon-cross-task-replay-001",
43
+ "attack_class": "cross_task_replay",
44
+ "description": "A charge already attributed to task A is replayed under the same source id but pointed at task B. The replay is refused, the conflict is recorded, and task B is not charged.",
45
+ "steps": [
46
+ { "op": "task", "body": { "external_ref": "A", "currency": "USD" } },
47
+ { "op": "task", "body": { "external_ref": "B", "currency": "USD" } },
48
+ { "op": "delegation", "task": "A", "body": { "external_ref": "d-a", "provider_name_stated": "Gamma", "provider_job_ref": "job-a", "currency": "USD" } },
49
+ { "op": "delegation", "task": "B", "body": { "external_ref": "d-b", "provider_name_stated": "Gamma", "provider_job_ref": "job-b", "currency": "USD" } },
50
+ { "op": "claim", "delegation": "d-a", "body": { "type": "completion", "asserted_by": "provider" } },
51
+ { "op": "financial_event", "body": { "type": "charge", "source": "gamma-billing", "source_event_id": "ch-1", "amount_minor": 1000, "currency": "USD", "event_date": "2026-10-01T12:00:00Z", "match": { "provider_job_ref": "job-a" } } },
52
+ { "op": "financial_event", "body": { "type": "charge", "source": "gamma-billing", "source_event_id": "ch-1", "amount_minor": 1000, "currency": "USD", "event_date": "2026-10-01T12:00:00Z", "match": { "provider_job_ref": "job-b" } } },
53
+ { "op": "close", "task": "A" },
54
+ { "op": "close", "task": "B" }
55
+ ],
56
+ "expected": {
57
+ "verdict": "BLOCK",
58
+ "refused_steps": [{ "step": 6, "detail_substring": "source_event_id ch-1 already exists" }],
59
+ "deduplicated_steps": [],
60
+ "exception_kinds": ["duplicate_event"],
61
+ "net_cost_minor": { "A": 1000, "B": 0 },
62
+ "closed_net_cost_minor": { "A": 1000, "B": 0 }
63
+ }
64
+ },
65
+ {
66
+ "vector_id": "atcn-recon-refund-after-close-001",
67
+ "attack_class": "refund_after_close",
68
+ "description": "A refund arrives after the task was closed. It is recorded against the task and flagged; the signed closure already issued keeps its total.",
69
+ "steps": [
70
+ { "op": "task", "body": { "external_ref": "A", "currency": "USD" } },
71
+ { "op": "delegation", "task": "A", "body": { "external_ref": "d-a", "provider_name_stated": "Gamma", "provider_job_ref": "job-a", "currency": "USD" } },
72
+ { "op": "claim", "delegation": "d-a", "body": { "type": "completion", "asserted_by": "provider" } },
73
+ { "op": "financial_event", "body": { "type": "charge", "source": "gamma-billing", "source_event_id": "ch-1", "amount_minor": 1000, "currency": "USD", "event_date": "2026-10-01T12:00:00Z", "match": { "provider_job_ref": "job-a" } } },
74
+ { "op": "close", "task": "A" },
75
+ { "op": "financial_event", "body": { "type": "refund", "source": "gamma-billing", "source_event_id": "rf-1", "amount_minor": 1000, "currency": "USD", "event_date": "2026-10-02T12:00:00Z", "match": { "provider_job_ref": "job-a" } } }
76
+ ],
77
+ "expected": { "verdict": "REVIEW", "refused_steps": [], "deduplicated_steps": [], "exception_kinds": ["refund_after_close"], "net_cost_minor": { "A": 0 }, "closed_net_cost_minor": { "A": 1000 } }
78
+ },
79
+ {
80
+ "vector_id": "atcn-recon-charge-after-cancel-001",
81
+ "attack_class": "charge_after_cancel",
82
+ "description": "The buyer cancelled the delegation, and the provider bills it anyway. The charge is recorded and flagged until a refund, credit or reversal nets it to zero.",
83
+ "steps": [
84
+ { "op": "task", "body": { "external_ref": "A", "currency": "USD" } },
85
+ { "op": "delegation", "task": "A", "body": { "external_ref": "d-a", "provider_name_stated": "Gamma", "provider_job_ref": "job-a", "currency": "USD" } },
86
+ { "op": "claim", "delegation": "d-a", "body": { "type": "cancellation", "asserted_by": "buyer", "note": "no longer needed" } },
87
+ { "op": "financial_event", "body": { "type": "charge", "source": "gamma-billing", "source_event_id": "ch-1", "amount_minor": 1000, "currency": "USD", "event_date": "2026-10-01T12:00:00Z", "match": { "provider_job_ref": "job-a" } } },
88
+ { "op": "close", "task": "A" }
89
+ ],
90
+ "expected": { "verdict": "REVIEW", "refused_steps": [], "deduplicated_steps": [], "exception_kinds": ["charge_after_cancellation", "missing_receipt"], "net_cost_minor": { "A": 1000 }, "closed_net_cost_minor": { "A": 1000 } }
91
+ },
92
+ {
93
+ "vector_id": "atcn-recon-backdated-estimate-001",
94
+ "attack_class": "backdated_estimate",
95
+ "description": "After the charge is recorded, an estimate matching it exactly arrives, dated before the charge. It is kept but not used as the estimate, and flagged.",
96
+ "steps": [
97
+ { "op": "task", "body": { "external_ref": "A", "currency": "USD" } },
98
+ { "op": "delegation", "task": "A", "body": { "external_ref": "d-a", "provider_name_stated": "Gamma", "provider_job_ref": "job-a", "currency": "USD" } },
99
+ { "op": "claim", "delegation": "d-a", "body": { "type": "completion", "asserted_by": "provider" } },
100
+ { "op": "financial_event", "body": { "type": "charge", "source": "gamma-billing", "source_event_id": "ch-1", "amount_minor": 1500, "currency": "USD", "event_date": "2026-10-01T12:00:00Z", "match": { "provider_job_ref": "job-a" } } },
101
+ { "op": "financial_event", "body": { "type": "estimate", "source": "orchestrator", "source_event_id": "est-1", "amount_minor": 1500, "currency": "USD", "event_date": "2026-10-01T09:00:00Z", "match": { "provider_job_ref": "job-a" }, "expectation": { "issued_by": "operator", "source_ref": null, "basis": "back-dated to look accurate", "expires_at": null, "supersedes": null } } },
102
+ { "op": "close", "task": "A" }
103
+ ],
104
+ "expected": { "verdict": "REVIEW", "refused_steps": [], "deduplicated_steps": [], "exception_kinds": ["estimate_after_charge"], "net_cost_minor": { "A": 1500 }, "closed_net_cost_minor": { "A": 1500 } }
105
+ }
106
+ ]
107
+ }