Skip to content

Commit 5969937

Browse files
committed
test: cover v18 hologram release gates
1 parent ca7c3c4 commit 5969937

5 files changed

Lines changed: 350 additions & 5 deletions

File tree

docs/design/0273-v18-continuum-evidence-posture-lattice/v18-continuum-evidence-posture-lattice.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ By the end of this design cycle, the `ContinuumEvidencePosture` class will be re
6060
## Current Truth
6161

6262
At the start of this cycle, `ContinuumEvidencePosture.ts` defined the posture as a flat string enum:
63-
[src/domain/continuum/ContinuumEvidencePosture.ts#8](file:///Users/james/git/git-stunts/git-warp/src/domain/continuum/ContinuumEvidencePosture.ts#L8).
63+
[src/domain/continuum/ContinuumEvidencePosture.ts#L8](../../../src/domain/continuum/ContinuumEvidencePosture.ts#L8).
6464
This collapses the dimensions, meaning we cannot distinguish between "translated but witnessed" and "native but redacted" history.
6565
This flat posture is used inside `ContinuumEvidenceClaim` to validate UCAN-style proof presence:
66-
[src/domain/continuum/ContinuumEvidenceClaim.ts#50](file:///Users/james/git/git-stunts/git-warp/src/domain/continuum/ContinuumEvidenceClaim.ts#L50).
66+
[src/domain/continuum/ContinuumEvidenceClaim.ts#L50](../../../src/domain/continuum/ContinuumEvidenceClaim.ts#L50).
6767

6868
Paper VIII also defines `Scratch`, `AuthorOnly`, and `Shared` as revelation postures on observer coordinates and holograms. Those are not evidence-posture values and must not be folded into `ContinuumEvidencePosture`.
6969

docs/design/0274-v18-zk-verkle-wormholes/v18-zk-verkle-wormholes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ By the end of this design cycle, the domain will define replay-bearing hologram
5757
## Current Truth
5858

5959
Currently, `WormholeService.ts` only supports sequential replay of `ProvenancePayload`:
60-
[src/domain/services/WormholeService.ts#48](file:///Users/james/git/git-stunts/git-warp/src/domain/services/WormholeService.ts#L48).
60+
[src/domain/services/WormholeService.ts#L48](../../../src/domain/services/WormholeService.ts#L48).
6161
There is no representation of Verkle roots, space-time bivariate polynomials, or SNARK proofs in the codebase.
6262

6363
The current Continuum witness ladder already separates replay core, witness core, and receipt shell for tick receipts. It does not yet generalize that replay/materialization contract to braid holograms or suffix-transform holograms.

test/unit/domain/continuum/ContinuumEvidencePosture.test.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,35 @@ describe('ContinuumEvidencePosture', () => {
9393

9494
expect(claim.isNativeContinuumEvidence()).toBe(true);
9595
expect(claim.nativeWitnessProof).toBeUndefined();
96+
expect(claim.posture.access.equals(ContinuumEvidenceAccess.redacted())).toBe(true);
9697
expect(claim.posture.canAuthorizeReplayShortcut()).toBe(false);
9798
});
9899

100+
it('accepts string coordinates and exposes all lattice coordinate helpers', () => {
101+
const posture = new ContinuumEvidencePosture({
102+
origin: 'fixture',
103+
proofStrength: 'digest-only',
104+
access: 'credential-required',
105+
completeness: 'residual',
106+
});
107+
const syntheticOrigin = ContinuumEvidenceOrigin.synthetic();
108+
const claimedProof = ContinuumEvidenceProofStrength.claimed();
109+
const deniedAccess = ContinuumEvidenceAccess.denied();
110+
const partialCompleteness = ContinuumEvidenceCompleteness.partial();
111+
const obstructedCompleteness = ContinuumEvidenceCompleteness.obstructed();
112+
113+
expect(posture.toString()).toBe('fixture:digest-only:credential-required:residual');
114+
expect(posture.origin.equals(ContinuumEvidenceOrigin.fixture())).toBe(true);
115+
expect(posture.proofStrength.equals(ContinuumEvidenceProofStrength.digestOnly())).toBe(true);
116+
expect(posture.access.requiresCredential()).toBe(true);
117+
expect(posture.completeness.equals(ContinuumEvidenceCompleteness.residual())).toBe(true);
118+
expect(syntheticOrigin.toString()).toBe('synthetic');
119+
expect(claimedProof.toString()).toBe('claimed');
120+
expect(deniedAccess.toString()).toBe('denied');
121+
expect(partialCompleteness.toString()).toBe('partial');
122+
expect(obstructedCompleteness.toString()).toBe('obstructed');
123+
});
124+
99125
it('rejects native witness proof when posture is not native evidence', () => {
100126
const descriptor = makeGeneratedReceiptDescriptor();
101127

@@ -130,13 +156,39 @@ describe('ContinuumEvidencePosture', () => {
130156
it('rejects missing or invalid posture coordinates', () => {
131157
const descriptor = makeGeneratedReceiptDescriptor();
132158

159+
expect(() => new ContinuumEvidencePosture(
160+
// @ts-expect-error runtime guard for JavaScript callers
161+
undefined,
162+
)).toThrow(WarpError);
163+
133164
expect(() => new ContinuumEvidencePosture({
134165
origin: 'invalid',
135166
proofStrength: 'witnessed',
136167
access: 'available',
137168
completeness: 'complete',
138169
})).toThrow(WarpError);
139170

171+
expect(() => new ContinuumEvidencePosture({
172+
origin: 'translated',
173+
proofStrength: 'invalid',
174+
access: 'available',
175+
completeness: 'complete',
176+
})).toThrow(WarpError);
177+
178+
expect(() => new ContinuumEvidencePosture({
179+
origin: 'translated',
180+
proofStrength: 'witnessed',
181+
access: 'invalid',
182+
completeness: 'complete',
183+
})).toThrow(WarpError);
184+
185+
expect(() => new ContinuumEvidencePosture({
186+
origin: 'translated',
187+
proofStrength: 'witnessed',
188+
access: 'available',
189+
completeness: 'invalid',
190+
})).toThrow(WarpError);
191+
140192
expect(() => new ContinuumEvidenceClaim({
141193
descriptor,
142194
// @ts-expect-error runtime guard for JavaScript callers

test/unit/domain/continuum/GitWarpHologramReplay.test.ts

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,97 @@ describe('git-warp hologram replay semantics', () => {
146146
payload: ProvenancePayload.identity(),
147147
})).toThrow(WarpError);
148148
});
149+
150+
it('rejects invalid braid hologram structure at runtime boundaries', () => {
151+
const patch = makePatch({ writer: 'writer-a', lamport: 1, nodeId: 'node:a' });
152+
const alphaMember = new GitWarpBraidHologramMember({
153+
strandId: 'strand:a',
154+
payload: makePayload(patch, 'f'.repeat(40)),
155+
});
156+
const duplicateAlphaMember = new GitWarpBraidHologramMember({
157+
strandId: 'strand:a',
158+
payload: makePayload(patch, '1'.repeat(40)),
159+
});
160+
161+
expect(() => new GitWarpBraidHologram(
162+
// @ts-expect-error runtime guard for JavaScript callers
163+
undefined,
164+
)).toThrow(WarpError);
165+
166+
expect(() => new GitWarpBraidHologram({
167+
settlementId: '',
168+
lawId: 'braid-law:non-empty',
169+
projectionDigest: 'sha256:non-empty',
170+
proofRef: 'proof:non-empty',
171+
members: [alphaMember, new GitWarpBraidHologramMember({
172+
strandId: 'strand:b',
173+
payload: makePayload(patch, '2'.repeat(40)),
174+
})],
175+
})).toThrow(WarpError);
176+
177+
expect(() => new GitWarpBraidHologram({
178+
settlementId: 'settlement:duplicate',
179+
lawId: 'braid-law:duplicate',
180+
projectionDigest: 'sha256:duplicate',
181+
proofRef: 'proof:duplicate',
182+
members: [alphaMember, duplicateAlphaMember],
183+
})).toThrow(WarpError);
184+
185+
expect(() => new GitWarpBraidHologram({
186+
settlementId: 'settlement:invalid-member',
187+
lawId: 'braid-law:invalid-member',
188+
projectionDigest: 'sha256:invalid-member',
189+
proofRef: 'proof:invalid-member',
190+
members: [alphaMember, { strandId: 'strand:b', payload: makePayload(patch, '3'.repeat(40)) }],
191+
})).toThrow(WarpError);
192+
});
193+
194+
it('rejects invalid braid members and suffix-transform fields', () => {
195+
const patch = makePatch({ writer: 'writer-a', lamport: 1, nodeId: 'node:a' });
196+
197+
expect(() => new GitWarpBraidHologramMember(
198+
// @ts-expect-error runtime guard for JavaScript callers
199+
undefined,
200+
)).toThrow(WarpError);
201+
202+
expect(() => new GitWarpBraidHologramMember({
203+
strandId: '',
204+
payload: makePayload(patch, '4'.repeat(40)),
205+
})).toThrow(WarpError);
206+
207+
expect(() => new GitWarpBraidHologramMember({
208+
strandId: 'strand:empty-payload',
209+
payload: ProvenancePayload.identity(),
210+
})).toThrow(WarpError);
211+
212+
expect(() => new GitWarpBraidHologramMember({
213+
strandId: 'strand:invalid-payload',
214+
// @ts-expect-error runtime guard for JavaScript callers
215+
payload: patch,
216+
})).toThrow(WarpError);
217+
218+
expect(() => new GitWarpSuffixTransformHologram(
219+
// @ts-expect-error runtime guard for JavaScript callers
220+
undefined,
221+
)).toThrow(WarpError);
222+
223+
expect(() => new GitWarpSuffixTransformHologram({
224+
sourceFrontierRef: '',
225+
basisFrontierRef: 'frontier:local',
226+
targetFrontierRef: 'frontier:merged',
227+
transportLawId: 'transport-law:non-empty',
228+
proofRef: 'proof:non-empty',
229+
payload: makePayload(patch, '5'.repeat(40)),
230+
})).toThrow(WarpError);
231+
232+
expect(() => new GitWarpSuffixTransformHologram({
233+
sourceFrontierRef: 'frontier:remote',
234+
basisFrontierRef: 'frontier:local',
235+
targetFrontierRef: 'frontier:merged',
236+
transportLawId: 'transport-law:invalid-payload',
237+
proofRef: 'proof:invalid-payload',
238+
// @ts-expect-error runtime guard for JavaScript callers
239+
payload: patch,
240+
})).toThrow(WarpError);
241+
});
149242
});

0 commit comments

Comments
 (0)