@principal-ai/subsystems-react 0.56.0 → 0.56.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.
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/pierre/PierreTrailCodeView.d.ts +3 -3
- package/dist/pierre/PierreTrailCodeView.d.ts.map +1 -1
- package/dist/pierre/PierreTrailCodeView.js +16 -16
- package/dist/pierre/PierreTrailCodeView.js.map +1 -1
- package/dist/pierre/trailSnippet.d.ts +10 -0
- package/dist/pierre/trailSnippet.d.ts.map +1 -0
- package/dist/pierre/trailSnippet.js +22 -0
- package/dist/pierre/trailSnippet.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +0 -37
- package/src/pierre/PierreTrailCodeView.tsx +14 -23
- package/src/pierre/trailSnippet.test.ts +74 -0
- package/src/pierre/trailSnippet.ts +35 -0
- package/dist/subsystem/DecorationPanel.d.ts +0 -37
- package/dist/subsystem/DecorationPanel.d.ts.map +0 -1
- package/dist/subsystem/DecorationPanel.js +0 -147
- package/dist/subsystem/DecorationPanel.js.map +0 -1
- package/dist/subsystem/decoration.d.ts +0 -112
- package/dist/subsystem/decoration.d.ts.map +0 -1
- package/dist/subsystem/decoration.js +0 -54
- package/dist/subsystem/decoration.js.map +0 -1
- package/src/stories/Canvases/Subsystem/StepEmphasis.stories.tsx +0 -528
- package/src/stories/Components/DecorationPanel.stories.tsx +0 -160
- package/src/subsystem/DecorationPanel.test.tsx +0 -128
- package/src/subsystem/DecorationPanel.tsx +0 -334
- package/src/subsystem/decoration.test.ts +0 -72
- package/src/subsystem/decoration.ts +0 -151
- package/src/subsystem/stepEmphasis.test.ts +0 -110
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import type { SubsystemTrail } from './model';
|
|
3
|
-
import {
|
|
4
|
-
buildStepEmphasisMap,
|
|
5
|
-
emphasisForTrail,
|
|
6
|
-
emphasisKey,
|
|
7
|
-
findStepEmphasis,
|
|
8
|
-
orphanedEmphasis,
|
|
9
|
-
stepClaimKey,
|
|
10
|
-
type StepEmphasisRecord,
|
|
11
|
-
} from './stepEmphasis';
|
|
12
|
-
|
|
13
|
-
function step(overrides: Partial<SubsystemTrail['steps'][number]> = {}): SubsystemTrail['steps'][number] {
|
|
14
|
-
return {
|
|
15
|
-
from: 'ui',
|
|
16
|
-
to: 'api',
|
|
17
|
-
mechanism: 'calls',
|
|
18
|
-
file: 'src/ui/login.tsx',
|
|
19
|
-
span: { startLine: 42, endLine: 42, contentHash: 'abc' },
|
|
20
|
-
purl: 'pkg:github/acme/app#src/ui/login.tsx',
|
|
21
|
-
symbol: 'Login.submit',
|
|
22
|
-
...overrides,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function trail(id: string, steps: SubsystemTrail['steps']): SubsystemTrail {
|
|
27
|
-
return { id, title: id, steps };
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function record(trailId: string, stepKey: string): StepEmphasisRecord {
|
|
31
|
-
return {
|
|
32
|
-
trailId,
|
|
33
|
-
stepKey,
|
|
34
|
-
guidance: 'Why this step matters.',
|
|
35
|
-
provenance: { source: 'author', at: '2026-10-19T00:00:00.000Z' },
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
describe('stepClaimKey', () => {
|
|
40
|
-
test('is stable for the same claim', () => {
|
|
41
|
-
expect(stepClaimKey(step())).toBe(stepClaimKey(step()));
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('ignores annotation, which is not the claim', () => {
|
|
45
|
-
expect(stepClaimKey(step({ annotation: 'why' }))).toBe(
|
|
46
|
-
stepClaimKey(step()),
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test('changes when the claim changes', () => {
|
|
51
|
-
const base = stepClaimKey(step());
|
|
52
|
-
expect(base).not.toBe(stepClaimKey(step({ from: 'other' })));
|
|
53
|
-
expect(base).not.toBe(stepClaimKey(step({ to: 'other' })));
|
|
54
|
-
expect(base).not.toBe(stepClaimKey(step({ mechanism: 'feeds' })));
|
|
55
|
-
expect(base).not.toBe(stepClaimKey(step({ file: 'src/other.ts' })));
|
|
56
|
-
expect(base).not.toBe(stepClaimKey(step({ symbol: 'Other.submit' })));
|
|
57
|
-
expect(base).not.toBe(
|
|
58
|
-
stepClaimKey(step({ span: { startLine: 43, endLine: 43, contentHash: 'abc' } })),
|
|
59
|
-
);
|
|
60
|
-
expect(base).not.toBe(
|
|
61
|
-
stepClaimKey(step({ span: { startLine: 42, endLine: 42, contentHash: 'changed' } })),
|
|
62
|
-
);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
describe('step emphasis lookup', () => {
|
|
67
|
-
test('resolves after steps are reordered', () => {
|
|
68
|
-
const first = step({ symbol: 'first' });
|
|
69
|
-
const second = step({ symbol: 'second' });
|
|
70
|
-
const map = buildStepEmphasisMap([record('flow', stepClaimKey(first))]);
|
|
71
|
-
const reordered = trail('flow', [second, first]);
|
|
72
|
-
expect(findStepEmphasis(map, 'flow', reordered.steps[1]!)).toBeDefined();
|
|
73
|
-
expect(findStepEmphasis(map, 'flow', reordered.steps[0]!)).toBeUndefined();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
test('emphasisForTrail reports marks in current step order', () => {
|
|
77
|
-
const a = step({ symbol: 'a' });
|
|
78
|
-
const b = step({ symbol: 'b' });
|
|
79
|
-
const c = step({ symbol: 'c' });
|
|
80
|
-
const map = buildStepEmphasisMap([
|
|
81
|
-
record('flow', stepClaimKey(c)),
|
|
82
|
-
record('flow', stepClaimKey(a)),
|
|
83
|
-
]);
|
|
84
|
-
expect(emphasisForTrail(map, trail('flow', [b, a, c])).map((r) => r.stepIndex)).toEqual([
|
|
85
|
-
1, 2,
|
|
86
|
-
]);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test('an edited claim orphans its mark rather than re-binding it', () => {
|
|
90
|
-
const original = step();
|
|
91
|
-
const edited = step({ file: 'src/ui/login-v2.tsx' });
|
|
92
|
-
const records = [record('flow', stepClaimKey(original))];
|
|
93
|
-
const orphans = orphanedEmphasis(records, [trail('flow', [edited])]);
|
|
94
|
-
expect(orphans).toHaveLength(1);
|
|
95
|
-
expect(orphans[0]!.stepKey).toBe(stepClaimKey(original));
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
test('live marks are not reported as orphans', () => {
|
|
99
|
-
const live = step();
|
|
100
|
-
const records = [record('flow', stepClaimKey(live))];
|
|
101
|
-
expect(orphanedEmphasis(records, [trail('flow', [live])])).toEqual([]);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
test('keys are scoped by trail id', () => {
|
|
105
|
-
const shared = step();
|
|
106
|
-
const map = buildStepEmphasisMap([record('flow-a', stepClaimKey(shared))]);
|
|
107
|
-
expect(emphasisKey('flow-b', shared)).not.toBe(emphasisKey('flow-a', shared));
|
|
108
|
-
expect(findStepEmphasis(map, 'flow-b', shared)).toBeUndefined();
|
|
109
|
-
});
|
|
110
|
-
});
|