@mikeargento/bitgraph-player 0.6.0 → 0.7.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikeargento/bitgraph-player",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Deterministic evaluation of causal rules over BitGraph proof bundles: a pure function from (rule, verified evidence) to a reproducible verdict.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,14 +29,14 @@
29
29
  "prepack": "tsc",
30
30
  "typecheck": "tsc --noEmit",
31
31
  "test": "tsc && node --test \"dist/__tests__/*.test.js\"",
32
- "build:web": "node scripts/build-verify-html.mjs --out ../folder/src/verify.html",
32
+ "build:web": "node scripts/build-verify-html.mjs --out ../../website/public/verify.html",
33
33
  "typecheck:web": "tsc -p web/tsconfig.json"
34
34
  },
35
35
  "engines": {
36
36
  "node": ">=20"
37
37
  },
38
38
  "dependencies": {
39
- "@mikeargento/bitgraph-audit": "^0.2.2",
39
+ "@mikeargento/bitgraph-audit": "^0.3.0",
40
40
  "@mikeargento/bitgraph-verify": "^1.3.0"
41
41
  },
42
42
  "devDependencies": {
@@ -116,10 +116,11 @@ describe("check: real export fixture (disk)", () => {
116
116
 
117
117
  it("brackets the recording between the two verified block headers", () => {
118
118
  const b = report.recordings[0]!.bounds;
119
- assert.equal(b.status, "bracketed");
119
+ assert.equal(b.status, "lower-bounded-with-following-anchor");
120
120
  assert.equal(b.notBefore?.blockNumber, "25735831");
121
121
  assert.equal(b.notAfter?.blockNumber, "25735832");
122
- assert.match(b.detail, /after Ethereum block 25735831 and before block 25735832/);
122
+ assert.match(b.detail, /after Ethereum block 25735831 \(header verified in this bundle\); precedes an anchor that consumed block 25735832/);
123
+ assert.match(b.detail, /rather than an upper bound/);
123
124
  });
124
125
 
125
126
  it("orders anchors by causal position, not file name", () => {
@@ -94,6 +94,8 @@ export function makeBound(partial: Partial<SegmentBound>): SegmentBound {
94
94
  weaker: partial.weaker ?? false,
95
95
  basis: partial.basis ?? "block-hash-unpredictability",
96
96
  claim: partial.claim ?? "fixture bound",
97
+ // Required since bitgraph-audit 0.3.0: a not-after bound is an assumption, never evidence.
98
+ boundClass: partial.boundClass ?? ((partial.kind ?? "not-before") === "not-before" ? "evidence" : "assumption"),
97
99
  ...(partial.blockNumber !== undefined ? { blockNumber: partial.blockNumber } : {}),
98
100
  };
99
101
  }
@@ -126,7 +128,7 @@ export function makeAudit(spec: FixtureAuditSpec): AuditResult {
126
128
  const segments = (spec.segments ?? []).map((s) => ({
127
129
  partition: { publicKeyB64: "key-A", chainId: "bitgraph:main" },
128
130
  memberProofHashes: s.members.map(proofHashOf),
129
- status: "bracketed",
131
+ status: "lower-bounded-with-following-anchor",
130
132
  lowerBounds: (s.lowerBounds ?? []).map((b) => makeBound({ ...b, kind: "not-before" })),
131
133
  upperBounds: (s.upperBounds ?? []).map((b) => makeBound({ ...b, kind: "not-after" })),
132
134
  }));
package/src/check.ts CHANGED
@@ -125,7 +125,7 @@ export interface CheckBound {
125
125
  }
126
126
 
127
127
  export interface CheckBounds {
128
- status: "bracketed" | "lower-bounded" | "upper-bounded" | "unanchored";
128
+ status: "lower-bounded-with-following-anchor" | "lower-bounded" | "upper-bounded" | "unanchored";
129
129
  notBefore?: CheckBound;
130
130
  notAfter?: CheckBound;
131
131
  detail: string;
@@ -618,7 +618,7 @@ function boundsFor(segment: TemporalSegment | undefined): CheckBounds {
618
618
  const notAfter = upper === undefined ? undefined : toBound(upper);
619
619
  const status: CheckBounds["status"] =
620
620
  notBefore !== undefined && notAfter !== undefined
621
- ? "bracketed"
621
+ ? "lower-bounded-with-following-anchor"
622
622
  : notBefore !== undefined
623
623
  ? "lower-bounded"
624
624
  : notAfter !== undefined
@@ -636,16 +636,22 @@ function boundsFor(segment: TemporalSegment | undefined): CheckBounds {
636
636
  };
637
637
  }
638
638
 
639
- /** "after Ethereum block A and before block B (both headers verified)…", shared by bounds.detail and the summary. */
639
+ /**
640
+ * "after Ethereum block A; precedes an anchor that consumed block B", shared by bounds.detail and the summary.
641
+ * The following anchor is deliberately NOT rendered as "before block B": a proof precedes the anchor's
642
+ * commit, and block B's timestamp bounds that commit from below, not the proof from above. Reading it as
643
+ * a ceiling assumes the anchor consumed a recently published block. An inbound anchor cannot carry a
644
+ * proof of an upper bound, so the phrase says what the evidence supports and names the assumption.
645
+ */
640
646
  function boundsPhrase(
641
647
  status: CheckBounds["status"],
642
648
  notBefore: CheckBound | undefined,
643
649
  notAfter: CheckBound | undefined
644
650
  ): string {
645
651
  switch (status) {
646
- case "bracketed":
652
+ case "lower-bounded-with-following-anchor":
647
653
  return (
648
- `after Ethereum block ${blockRef(notBefore as CheckBound)} and before block ${blockRef(notAfter as CheckBound)} (both headers verified in this bundle)` +
654
+ `after Ethereum block ${blockRef(notBefore as CheckBound)} (header verified in this bundle); precedes an anchor that consumed block ${blockRef(notAfter as CheckBound)} (header verified), an anchor-latency assumption rather than an upper bound on this recording` +
649
655
  weakerSuffix((notBefore as CheckBound).weaker || (notAfter as CheckBound).weaker)
650
656
  );
651
657
  case "lower-bounded":
@@ -689,8 +695,8 @@ function toBound(b: SegmentBound): CheckBound {
689
695
  /** The headline form of the bounds: one clause, no qualifiers (those live in bounds.detail). */
690
696
  function shortBoundsPhrase(b: CheckBounds): string {
691
697
  switch (b.status) {
692
- case "bracketed":
693
- return `between Ethereum blocks ${blockRef(b.notBefore as CheckBound)} and ${blockRef(b.notAfter as CheckBound)}`;
698
+ case "lower-bounded-with-following-anchor":
699
+ return `after Ethereum block ${blockRef(b.notBefore as CheckBound)}, then an anchor at block ${blockRef(b.notAfter as CheckBound)}`;
694
700
  case "lower-bounded":
695
701
  return `after Ethereum block ${blockRef(b.notBefore as CheckBound)}`;
696
702
  case "upper-bounded":
package/src/verdict.ts CHANGED
@@ -31,7 +31,7 @@ import type { DeclaredEntry, Resolution, Rule, Verdict } from "./types.js";
31
31
  * A unit test asserts this equals package.json's version, so the
32
32
  * constant cannot drift silently across releases.
33
33
  */
34
- export const PLAYER_VERSION = "0.6.0";
34
+ export const PLAYER_VERSION = "0.7.0";
35
35
 
36
36
  /** The player package's own version. */
37
37
  export function playerVersion(): string {