flow-muse-commit-pilot-unit.test.mjs
63 lines 2.0 KB
Raw
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf mirror: GitHub Phase A durable MCP OAuth (#270) Human minor ⚠ breaking 10 days ago
1 /**
2 * Unit tests — Muse commit pilot evidence validators (7A-14).
3 */
4
5 import { describe, it } from 'node:test';
6 import assert from 'node:assert/strict';
7
8 import {
9 parseGeneratedMarkerVersion,
10 assertCleanAntiDriftDiff,
11 assertNoSecretLeakageInProjection,
12 } from '../lib/flow/muse-commit-pilot-evidence.mjs';
13
14 describe('muse-commit-pilot-evidence (unit, 7A-14)', () => {
15 it('parseGeneratedMarkerVersion extracts semver from marker line', () => {
16 const sample = `# Title
17
18 <!-- GENERATED FROM CANONICAL FLOW [email protected] (generator v1) — DO NOT EDIT; regenerate via knowtation flow project -->
19 `;
20 assert.equal(parseGeneratedMarkerVersion(sample), '0.2.0');
21 });
22
23 it('assertCleanAntiDriftDiff accepts two-line canonical + marker change', () => {
24 const diff = `--- a
25 +++ b
26 @@ -1,2 +1,2 @@
27 -<!-- GENERATED FROM CANONICAL FLOW [email protected] (generator v1) — DO NOT EDIT -->
28 +<!-- GENERATED FROM CANONICAL FLOW [email protected] (generator v1) — DO NOT EDIT -->
29 -Docs-first handover … update durable docs, then regenerate …
30 +Docs-first handover … update the durable docs (ROADMAP snapshot, next-session plan, coordination doc), then regenerate …
31 `;
32 assert.deepEqual(assertCleanAntiDriftDiff(diff), { ok: true });
33 });
34
35 it('assertCleanAntiDriftDiff rejects extra drift lines', () => {
36 const diff = `--- a
37 +++ b
38 @@ -1,3 +1,3 @@
39 -old
40 +new
41 -extra
42 +drift
43 `;
44 const result = assertCleanAntiDriftDiff(diff);
45 assert.equal(result.ok, false);
46 });
47
48 it('assertNoSecretLeakageInProjection allows boundary instruction text', () => {
49 const content = `# Flow
50
51 No secrets in captured output.
52 No secrets in the block.
53 `;
54 assert.deepEqual(assertNoSecretLeakageInProjection(content), { ok: true });
55 });
56
57 it('assertNoSecretLeakageInProjection flags credential-like tokens', () => {
58 const content = 'api_key=super-secret-value';
59 const result = assertNoSecretLeakageInProjection(content);
60 assert.equal(result.ok, false);
61 assert.ok(result.matches.length > 0);
62 });
63 });
File History 2 commits
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf mirror: GitHub Phase A durable MCP OAuth (#270) Human minor 10 days ago
sha256:d8c648b20a4d53b2673c5c082ee7edfa7b2fc9b11080832da1f38807b6bf940b fix(7C-L1b): route hosted delegation proposals through cani… Human minor 30 days ago