@principles/pd-cli 1.152.10 → 1.152.12
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/CHANGELOG.md +23 -0
- package/dist/commands/candidate.d.ts +3 -3
- package/dist/commands/candidate.d.ts.map +1 -1
- package/dist/commands/candidate.js +9 -21
- package/dist/commands/candidate.js.map +1 -1
- package/dist/commands/runtime-internalization-run-rulehost.d.ts.map +1 -1
- package/dist/commands/runtime-internalization-run-rulehost.js +17 -4
- package/dist/commands/runtime-internalization-run-rulehost.js.map +1 -1
- package/dist/services/rulehost-pipeline-runner.d.ts.map +1 -1
- package/dist/services/rulehost-pipeline-runner.js +4 -17
- package/dist/services/rulehost-pipeline-runner.js.map +1 -1
- package/package.json +5 -5
- package/scripts/llm-dogfood.ts +36 -18
- package/src/commands/candidate.ts +9 -19
- package/src/commands/runtime-internalization-run-rulehost.ts +18 -3
- package/src/services/rulehost-pipeline-runner.ts +18 -20
- package/tests/commands/candidate-internalize-lineage.test.ts +64 -1
- package/tests/commands/run-rulehost-handler.test.ts +152 -0
- package/tests/services/rulehost-pipeline-runner.test.ts +67 -0
- package/vitest.config.ts +1 -0
|
@@ -543,6 +543,73 @@ describe('runRuleHostPipeline (PRI-429) — atomic capability + exact pain match
|
|
|
543
543
|
expect(result.degradationReason).toContain('no_dreamer_task_seeded');
|
|
544
544
|
}, 60_000);
|
|
545
545
|
|
|
546
|
+
// ── PRI-866: comparison boundary normalizes BOTH sides via the canonical reader ──
|
|
547
|
+
it('matches a historical row whose stored sourcePainId carries surrounding whitespace', async () => {
|
|
548
|
+
tmpDir = makeTmpDir();
|
|
549
|
+
const sm = new RuntimeStateManager({ workspaceDir: tmpDir });
|
|
550
|
+
await sm.initialize();
|
|
551
|
+
// Pre-existing rows may carry untrimmed sourcePainId (writer-side drift).
|
|
552
|
+
await seedDreamerWithId(sm, 'dreamer-padded-stored', ' pain-whitespace-1 ');
|
|
553
|
+
await sm.close();
|
|
554
|
+
|
|
555
|
+
const adapter = makeAdapter();
|
|
556
|
+
const result = await runRuleHostPipeline({
|
|
557
|
+
workspaceDir: tmpDir, painId: 'pain-whitespace-1', runtimeAdapter: adapter,
|
|
558
|
+
channel: 'code_tool_hook', pollIntervalMs: 5, timeoutMs: 1000,
|
|
559
|
+
onStoreReady: (store) => { adapter.artifactStore = store; },
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
expect(result.stages[0]).toMatchObject({
|
|
563
|
+
name: 'pain_lookup',
|
|
564
|
+
status: 'succeeded',
|
|
565
|
+
taskId: 'dreamer-padded-stored',
|
|
566
|
+
});
|
|
567
|
+
}, 60_000);
|
|
568
|
+
|
|
569
|
+
it('matches when the queried painId itself carries surrounding whitespace', async () => {
|
|
570
|
+
tmpDir = makeTmpDir();
|
|
571
|
+
const sm = new RuntimeStateManager({ workspaceDir: tmpDir });
|
|
572
|
+
await sm.initialize();
|
|
573
|
+
await seedDreamerWithId(sm, 'dreamer-padded-query', 'pain-whitespace-2');
|
|
574
|
+
await sm.close();
|
|
575
|
+
|
|
576
|
+
const adapter = makeAdapter();
|
|
577
|
+
const result = await runRuleHostPipeline({
|
|
578
|
+
workspaceDir: tmpDir, painId: ' pain-whitespace-2 ', runtimeAdapter: adapter,
|
|
579
|
+
channel: 'code_tool_hook', pollIntervalMs: 5, timeoutMs: 1000,
|
|
580
|
+
onStoreReady: (store) => { adapter.artifactStore = store; },
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
expect(result.stages[0]).toMatchObject({
|
|
584
|
+
name: 'pain_lookup',
|
|
585
|
+
status: 'succeeded',
|
|
586
|
+
taskId: 'dreamer-padded-query',
|
|
587
|
+
});
|
|
588
|
+
}, 60_000);
|
|
589
|
+
|
|
590
|
+
it('blank query never matches and unresolvable rows are skipped, not crashed', async () => {
|
|
591
|
+
tmpDir = makeTmpDir();
|
|
592
|
+
const sm = new RuntimeStateManager({ workspaceDir: tmpDir });
|
|
593
|
+
await sm.initialize();
|
|
594
|
+
// Rows the canonical reader resolves to null (absent / wrong-type key) —
|
|
595
|
+
// malformed JSON itself cannot be inserted (the store validates it).
|
|
596
|
+
await seedDreamerRaw(sm, 'dreamer-no-key-866', JSON.stringify({ pi_metadata: { channel: 'code_tool_hook' } }));
|
|
597
|
+
await seedDreamerRaw(sm, 'dreamer-wrong-type-866', JSON.stringify({ pi_metadata: { channel: 'code_tool_hook' }, sourcePainId: 12345 }));
|
|
598
|
+
await seedDreamerWithId(sm, 'dreamer-normal-866', 'pain-not-blank');
|
|
599
|
+
await sm.close();
|
|
600
|
+
|
|
601
|
+
const result = await runRuleHostPipeline({
|
|
602
|
+
workspaceDir: tmpDir, painId: ' ', runtimeAdapter: makeAdapter(),
|
|
603
|
+
pollIntervalMs: 5, timeoutMs: 1000,
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
// A blank query normalizes to '' — it must not match any stored pain id,
|
|
607
|
+
// and unresolvable rows are skipped via the canonical reader (rc-9: the
|
|
608
|
+
// caller still reports the loud no-match reason).
|
|
609
|
+
expect(result.decision).toBe('generation_rejected');
|
|
610
|
+
expect(result.degradationReason).toContain('no_dreamer_task_seeded');
|
|
611
|
+
}, 60_000);
|
|
612
|
+
|
|
546
613
|
it('rejects ambiguous lineage when multiple runnable Dreamer tasks have the same sourcePainId', async () => {
|
|
547
614
|
tmpDir = makeTmpDir();
|
|
548
615
|
const sm = new RuntimeStateManager({ workspaceDir: tmpDir });
|
package/vitest.config.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config';
|
|
|
3
3
|
export default defineConfig({
|
|
4
4
|
test: {
|
|
5
5
|
environment: 'node',
|
|
6
|
+
globalSetup: ['../../scripts/test/temp-lifecycle.mjs'],
|
|
6
7
|
include: ['tests/bdd/**/*.{test,steps}.ts', 'tests/**/*.test.ts', 'src/**/*.test.ts'],
|
|
7
8
|
exclude: ['**/node_modules/**', '**/dist/**'],
|
|
8
9
|
},
|