@behavproof/cli 0.0.0-stage → 0.1.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.
Files changed (67) hide show
  1. package/README.md +14 -2
  2. package/dist/api.d.ts +6 -0
  3. package/dist/api.d.ts.map +1 -0
  4. package/dist/api.js +5 -0
  5. package/dist/api.js.map +1 -0
  6. package/dist/check.d.ts +272 -0
  7. package/dist/check.d.ts.map +1 -0
  8. package/dist/check.js +220 -0
  9. package/dist/check.js.map +1 -0
  10. package/dist/formal-evaluation.d.ts +108 -0
  11. package/dist/formal-evaluation.d.ts.map +1 -0
  12. package/dist/formal-evaluation.js +78 -0
  13. package/dist/formal-evaluation.js.map +1 -0
  14. package/dist/formal-worker.d.ts +2 -0
  15. package/dist/formal-worker.d.ts.map +1 -0
  16. package/dist/formal-worker.js +32 -0
  17. package/dist/formal-worker.js.map +1 -0
  18. package/dist/formal.d.ts +148 -0
  19. package/dist/formal.d.ts.map +1 -0
  20. package/dist/formal.js +99 -0
  21. package/dist/formal.js.map +1 -0
  22. package/dist/impact.d.ts +20 -0
  23. package/dist/impact.d.ts.map +1 -0
  24. package/dist/impact.js +23 -0
  25. package/dist/impact.js.map +1 -0
  26. package/dist/index.d.ts +3 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +151 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/pipeline.d.ts +38 -0
  31. package/dist/pipeline.d.ts.map +1 -0
  32. package/dist/pipeline.js +46 -0
  33. package/dist/pipeline.js.map +1 -0
  34. package/dist/project.d.ts +97 -0
  35. package/dist/project.d.ts.map +1 -0
  36. package/dist/project.js +101 -0
  37. package/dist/project.js.map +1 -0
  38. package/dist/registration.d.ts +595 -0
  39. package/dist/registration.d.ts.map +1 -0
  40. package/dist/registration.js +112 -0
  41. package/dist/registration.js.map +1 -0
  42. package/dist/report.d.ts +23 -0
  43. package/dist/report.d.ts.map +1 -0
  44. package/dist/report.js +34 -0
  45. package/dist/report.js.map +1 -0
  46. package/dist/scopes.d.ts +48 -0
  47. package/dist/scopes.d.ts.map +1 -0
  48. package/dist/scopes.js +60 -0
  49. package/dist/scopes.js.map +1 -0
  50. package/dist/trust.d.ts +533 -0
  51. package/dist/trust.d.ts.map +1 -0
  52. package/dist/trust.js +130 -0
  53. package/dist/trust.js.map +1 -0
  54. package/package.json +51 -4
  55. package/presets/basic-v1.json +21 -0
  56. package/presets/critical-v1.json +39 -0
  57. package/presets/standard-v1.json +21 -0
  58. package/schemas/config.schema.json +492 -0
  59. package/schemas/evidence.schema.json +3612 -0
  60. package/schemas/manifest.schema.json +225 -0
  61. package/schemas/policy.schema.json +21 -0
  62. package/schemas/registration.schema.json +1065 -0
  63. package/schemas/registry.schema.json +307 -0
  64. package/schemas/trust-root.schema.json +1445 -0
  65. package/templates/audit.yml +28 -0
  66. package/templates/protected-github-producer.yml +58 -0
  67. package/templates/protected-github-publisher.yml +111 -0
@@ -0,0 +1,112 @@
1
+ import { z } from 'zod';
2
+ import { realpath, stat } from 'node:fs/promises';
3
+ import { resolve, relative, isAbsolute, sep, join, dirname, basename } from 'node:path';
4
+ import { ApprovalSchema, PolicySchema, ConfigSchema, RegistrySnapshotSchema, RelativePathSchema, HashSchema, canonicalJson, hash, safeRead } from '@behavproof/core';
5
+ import { git, writeScoped } from './project.js';
6
+ import { ClaimScopesSchema } from './trust.js';
7
+ const text = z.string().min(1), sha = z.string().regex(/^[a-f0-9]{40}$/);
8
+ export const RegistrationSchema = z.strictObject({
9
+ schemaVersion: z.literal(1), repository: z.strictObject({ id: z.string().regex(/^\d+$/), fullName: z.string().regex(/^[\w-]+\/[\w.-]+$/) }),
10
+ source: z.strictObject({ commitSha: sha, prNumber: z.number().int().positive(), projectPath: z.union([z.literal('.'), RelativePathSchema]), policyRef: RelativePathSchema, configRef: RelativePathSchema.optional(), fileHashes: z.record(RelativePathSchema, HashSchema) }),
11
+ policyId: text, policy: PolicySchema, config: ConfigSchema, baseline: RegistrySnapshotSchema,
12
+ inputs: z.array(RelativePathSchema).min(1), configPaths: z.array(RelativePathSchema),
13
+ claimScopes: ClaimScopesSchema, approvals: z.array(ApprovalSchema),
14
+ });
15
+ const verifiedHandles = new WeakSet();
16
+ function freeze(value) { if (value && typeof value === 'object') {
17
+ for (const entry of Object.values(value))
18
+ freeze(entry);
19
+ Object.freeze(value);
20
+ } return value; }
21
+ export function createRegistration(value, authority) {
22
+ const registration = RegistrationSchema.parse(structuredClone(value));
23
+ registration.approvals.sort((a, b) => a.id.localeCompare(b.id));
24
+ freeze(registration);
25
+ if (authority.verifySource(registration) !== true)
26
+ throw Error('Source verification unavailable');
27
+ if (registration.baseline.commitSha !== registration.source.commitSha || registration.baseline.repositoryId !== undefined && registration.baseline.repositoryId !== registration.repository.id)
28
+ throw Error('Registered source commit/repository mismatch');
29
+ if (registration.baseline.discoveryDiagnostics?.length !== 0 || !registration.baseline.extractorVersion || !registration.baseline.scope?.length || !registration.baseline.contracts.length || !registration.baseline.intents.length)
30
+ throw Error('Complete discovery inventory required');
31
+ for (const path of [registration.source.policyRef, ...(registration.source.configRef ? [registration.source.configRef] : []), ...registration.baseline.contracts.map(c => c.sourceRef), ...registration.baseline.intents.map(i => i.origin.ref)])
32
+ if (!Object.hasOwn(registration.source.fileHashes, path))
33
+ throw Error('Missing independently verified source hash');
34
+ if (registration.source.configRef && (!registration.configPaths.includes(registration.source.configRef) || registration.source.projectPath !== '.' && !registration.source.configRef.startsWith(registration.source.projectPath + '/')))
35
+ throw Error('Selected source config must belong to the project and hashed config scope');
36
+ for (const model of registration.config.formal?.models ?? []) {
37
+ const prefix = registration.source.projectPath === '.' ? '' : registration.source.projectPath + '/';
38
+ const required = [model.model, ...model.modelSources, ...(model.driver ? [model.driver, ...(model.driverSources ?? [])] : []), ...(model.implementation ? [model.implementation, ...model.implementationSources] : []), ...(model.canary ? [model.canary.implementation] : [])];
39
+ for (const ref of required)
40
+ if (!Object.hasOwn(registration.source.fileHashes, prefix + ref))
41
+ throw Error(`Missing independently verified formal source hash: ${ref}`);
42
+ const digest = (refs) => hash(Object.fromEntries([...new Set(refs)].sort().map(ref => [ref, registration.source.fileHashes[prefix + ref]])));
43
+ const binding = registration.baseline.contracts.find(c => c.id === model.contractId)?.formal;
44
+ if (!binding || binding.modelId !== model.id || binding.modelHash !== digest([model.model, ...model.modelSources]) || model.driver && binding.driverHash !== digest([model.driver, ...(model.driverSources ?? [])]) || hash([...binding.propertyIds].sort()) !== hash([...model.properties].sort()))
45
+ throw Error(`Formal source/Contract binding mismatch: ${model.id}`);
46
+ }
47
+ if (new Set(registration.inputs).size !== registration.inputs.length || new Set(registration.configPaths).size !== registration.configPaths.length)
48
+ throw Error('Duplicate input scope');
49
+ if (!Object.values(registration.policy.rules).some(rule => rule.severity === 'error'))
50
+ throw Error('No mandatory policy obligations');
51
+ const targets = [{ kind: 'policy', id: registration.policyId, contentHash: hash(registration.policy) }, ...registration.baseline.intents.map(i => ({ kind: 'intent', id: i.id, contentHash: i.contentHash })), ...registration.baseline.contracts.map(c => ({ kind: 'contract', id: c.id, contentHash: c.revisionHash }))];
52
+ if (new Set(registration.approvals.map(a => a.id)).size !== registration.approvals.length)
53
+ throw Error('Duplicate approval identity');
54
+ for (const approval of registration.approvals)
55
+ if (approval.status !== 'pass' || approval.subjectCommitSha !== registration.source.commitSha || approval.source.provider !== 'github' || approval.source.ref !== `https://github.com/${registration.repository.fullName}/pull/${registration.source.prNumber}` || !approval.approvedBy.length || !targets.some(t => hash(t) === hash(approval.target)) || authority.verifyApproval(approval) !== true)
56
+ throw Error('Unverified or incorrectly scoped approval');
57
+ for (const target of targets)
58
+ if (!registration.approvals.some(a => hash(a.target) === hash(target)))
59
+ throw Error(`Missing ${target.kind} approval: ${target.id}`);
60
+ for (const scope of registration.claimScopes) {
61
+ const contract = registration.baseline.contracts.find(c => c.id === scope.contractId);
62
+ if (!contract || new Set(scope.caseIds).size !== scope.caseIds.length || hash([...scope.caseIds].sort()) !== hash([...(contract.caseIds ?? [])].sort()))
63
+ throw Error('Claim scope differs from registered case inventory');
64
+ }
65
+ const result = freeze({ registration, digest: hash(registration) });
66
+ verifiedHandles.add(result);
67
+ return result;
68
+ }
69
+ async function externalDirectory(projectRoot, directory) {
70
+ const project = await realpath((await git(projectRoot, ['rev-parse', '--show-toplevel'])).trim()), host = await realpath(resolve(directory)), path = relative(project, host);
71
+ if (path === '' || !isAbsolute(path) && path !== '..' && !path.startsWith(`..${sep}`))
72
+ throw Error('Registration must be outside the entire Git checkout');
73
+ const info = await stat(host);
74
+ if (!info.isDirectory())
75
+ throw Error('Registration host is not a directory');
76
+ if (process.platform !== 'win32' && ((info.mode & 0o077) !== 0 || typeof process.getuid === 'function' && info.uid !== process.getuid()))
77
+ throw Error('Registration host must be private and owned by the current user');
78
+ return host;
79
+ }
80
+ export async function persistRegistration(projectRoot, directory, handle) {
81
+ if (!verifiedHandles.has(handle) || hash(handle.registration) !== handle.digest)
82
+ throw Error('Unverified registration handle');
83
+ const host = await externalDirectory(projectRoot, directory), name = `registration-${handle.digest}.json`, content = canonicalJson(handle.registration) + '\n';
84
+ try {
85
+ await writeScoped(host, name, content, true);
86
+ }
87
+ catch (error) {
88
+ if (error.code !== 'EEXIST')
89
+ throw error;
90
+ const actual = await safeRead(host, name);
91
+ if (!actual.equals(Buffer.from(content)))
92
+ throw Error('Conflicting or tampered registered snapshot');
93
+ }
94
+ return { path: join(host, name), digest: handle.digest };
95
+ }
96
+ /** expectedDigest belongs to the protected host invocation, never to candidate JSON. */
97
+ export async function loadRegistration(projectRoot, path, expectedDigest) {
98
+ HashSchema.parse(expectedDigest);
99
+ const actual = resolve(path), host = await externalDirectory(projectRoot, dirname(actual));
100
+ const registration = RegistrationSchema.parse(JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(await safeRead(host, basename(actual)))));
101
+ if (hash(registration) !== expectedDigest)
102
+ throw Error('Registered baseline digest mismatch');
103
+ return freeze(registration);
104
+ }
105
+ /** Path projection only; obtain authority separately with loadRegistration and a protected digest. */
106
+ export function registrationProjectData(value) {
107
+ const r = RegistrationSchema.parse(structuredClone(value)), prefix = r.source.projectPath === '.' ? '' : r.source.projectPath + '/';
108
+ const local = (path) => { if (prefix && !path.startsWith(prefix))
109
+ throw Error('Registration path lies outside the selected project subtree'); const result = prefix ? path.slice(prefix.length) : path; RelativePathSchema.parse(result); return result; };
110
+ return freeze({ policy: r.policy, config: r.config, ...(r.source.configRef ? { configRef: local(r.source.configRef) } : {}), baseline: { ...r.baseline, contracts: r.baseline.contracts.map(c => ({ ...c, sourceRef: local(c.sourceRef) })), intents: r.baseline.intents.map(i => ({ ...i, origin: { ...i.origin, ref: local(i.origin.ref) } })), ...(r.baseline.scope ? { scope: r.baseline.scope.map(local) } : {}) }, inputs: r.inputs.map(local), configPaths: r.configPaths.map(local), claimScopes: r.claimScopes.map(s => ({ ...s, targetRef: local(s.targetRef) })) });
111
+ }
112
+ //# sourceMappingURL=registration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registration.js","sourceRoot":"","sources":["../src/registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,QAAQ,EAAC,IAAI,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,OAAO,EAAC,QAAQ,EAAC,UAAU,EAAC,GAAG,EAAC,IAAI,EAAC,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAChF,OAAO,EAAC,cAAc,EAAC,YAAY,EAAC,YAAY,EAAC,sBAAsB,EAAC,kBAAkB,EAAC,UAAU,EAAC,aAAa,EAAC,IAAI,EAAC,QAAQ,EAAe,MAAM,kBAAkB,CAAC;AACzK,OAAO,EAAC,GAAG,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAC7C,MAAM,IAAI,GAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CA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G,EAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAC,EAAC,CAAC,CAAC,EAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAA,CAAC,CAAA,EAAC,KAAK,EAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAC,CAAA,CAAC,CAAA,EAAE,CAAC,EAAC,EAAC,MAAM,EAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAC,WAAW,EAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,EAAC,WAAW,EAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA,EAAE,CAAA,CAAC,EAAC,GAAG,CAAC,EAAC,SAAS,EAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,EAAC,CAAC,CAAC,EAAC,CAAC,CAAC;AACvf,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { type CheckReport, type Evaluation, type EvidenceSubject } from '@behavproof/core';
2
+ export declare function remediationFor(e: Evaluation): string;
3
+ export type PolicyDiff = {
4
+ rules: {
5
+ ruleId: string;
6
+ protected: unknown;
7
+ project: unknown;
8
+ effective: unknown;
9
+ }[];
10
+ configuration: {
11
+ field: string;
12
+ protected: unknown;
13
+ project: unknown;
14
+ effective: unknown;
15
+ }[];
16
+ weakened: boolean;
17
+ };
18
+ export declare function formatReport(report: CheckReport & {
19
+ policyDiff?: PolicyDiff | null;
20
+ subject?: EvidenceSubject;
21
+ effectivePolicyHash?: string;
22
+ }, format: string): string;
23
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,WAAW,EAAC,KAAK,UAAU,EAAC,KAAK,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAkBrG,wBAAgB,cAAc,CAAC,CAAC,EAAC,UAAU,UAAgL;AAC3N,MAAM,MAAM,UAAU,GAAC;IAAC,KAAK,EAAC;QAAC,MAAM,EAAC,MAAM,CAAC;QAAA,SAAS,EAAC,OAAO,CAAC;QAAA,OAAO,EAAC,OAAO,CAAC;QAAA,SAAS,EAAC,OAAO,CAAA;KAAC,EAAE,CAAC;IAAA,aAAa,EAAC;QAAC,KAAK,EAAC,MAAM,CAAC;QAAA,SAAS,EAAC,OAAO,CAAC;QAAA,OAAO,EAAC,OAAO,CAAC;QAAA,SAAS,EAAC,OAAO,CAAA;KAAC,EAAE,CAAC;IAAA,QAAQ,EAAC,OAAO,CAAA;CAAC,CAAC;AACzM,wBAAgB,YAAY,CAAC,MAAM,EAAC,WAAW,GAAC;IAAC,UAAU,CAAC,EAAC,UAAU,GAAC,IAAI,CAAC;IAAA,OAAO,CAAC,EAAC,eAAe,CAAC;IAAA,mBAAmB,CAAC,EAAC,MAAM,CAAA;CAAC,EAAC,MAAM,EAAC,MAAM,UAY/I"}
package/dist/report.js ADDED
@@ -0,0 +1,34 @@
1
+ import { canonicalJson } from '@behavproof/core';
2
+ const actions = {
3
+ testResult: 'Inspect failed, skipped or missing tests; rerun the trusted Collector and authenticate its current reports.',
4
+ changedLineCoverage: 'Collect complete LCOV for the changed source scope and meet the protected coverage threshold.',
5
+ mutationScore: 'Collect current scoped mutants, inspect survivors and uncovered/error cases, and meet the protected score and minimum count.',
6
+ pipelineIntegrity: 'Inspect required upstream jobs, current run/attempt artifacts, protected workflow and issuer-bound required checks.',
7
+ intentApproval: 'Obtain an authorized human review of this exact Intent/Contract change and register it through the protected host.',
8
+ contractExecution: 'Execute every retained required case without skip using the matching contract/binding, and authenticate both test reports.',
9
+ negativeCases: 'Declare and execute the required negative cases against their retained contract revision.',
10
+ policyProtection: 'Restore the protected policy and source scope, or obtain a separately reviewed host registration for the proposed change.',
11
+ productionTargetObserved: 'Collect case-scoped calls of the registered real production target; passing comparisons do not establish reach.',
12
+ mutationSensitivityObserved: 'Run the registered case-scoped fault probe and retain actual failing comparisons separately from ordinary successful evidence.',
13
+ evidenceIntegrity: 'Discard stale or modified reports; collect fresh bytes through the independently selected producer and retain the host capture.',
14
+ evaluationEnvironment: 'Use a supported single-package project with clean, completely inventoried source inputs.',
15
+ evaluationSnapshot: 'Keep source, HEAD and configuration stable for the full evaluation, then rerun against freshly authenticated evidence.',
16
+ testedCommitRelationship: 'Fetch the pinned PR head/base and actual tested Git parents; do not relabel an unrelated commit.',
17
+ };
18
+ export function remediationFor(e) { return e.remediation ?? actions[e.ruleId] ?? 'Inspect this rule and its JSON evidence; configure its authenticated evaluator or restore the protected policy, then rerun check.'; }
19
+ export function formatReport(report, format) {
20
+ if (format === 'json')
21
+ return canonicalJson(report) + '\n';
22
+ const scope = (e) => e.scope.length ? JSON.stringify(e.scope) : 'project';
23
+ const conditions = [...(report.subject ? [`Tested: ${report.subject.testedCommitSha}; PR head: ${report.subject.prHeadSha ?? 'unknown'}; base: ${report.subject.baseSha ?? 'unknown'}; dirty: ${report.subject.dirty}`] : []), ...(report.effectivePolicyHash ? [`Effective policy: ${report.effectivePolicyHash}`] : [])];
24
+ const rows = report.policyDiff ? [...report.policyDiff.rules.map(r => ({ name: r.ruleId, ...r })), ...report.policyDiff.configuration.map(r => ({ name: r.field, ...r }))] : [];
25
+ if (format === 'markdown') {
26
+ const escape = (s) => s.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('|', '&#124;').replaceAll('\n', ' ');
27
+ const table = `# BehavProof ${report.status}\n\n${conditions.length ? conditions.map(escape).join('\n\n') + '\n\n' : ''}| Rule | Scope | Evidence | Severity | Status | Reason | Action |\n| --- | --- | --- | --- | --- | --- | --- |\n${report.evaluations.map(e => `| ${escape(e.ruleId)} | ${escape(scope(e))} | ${escape(e.evidenceIds.join(', '))} | ${e.severity} | ${e.status} | ${escape(e.message)} | ${escape(e.remediation ?? '')} |`).join('\n')}\n`;
28
+ return table + (rows.length ? `\n## Policy comparison\n\n| Rule / configuration | Protected | Project | Effective |\n| --- | --- | --- | --- |\n${rows.map(r => `| ${escape(r.name)} | ${escape(canonicalJson(r.protected))} | ${escape(canonicalJson(r.project))} | ${escape(canonicalJson(r.effective))} |`).join('\n')}\n` : '');
29
+ }
30
+ if (format !== 'console')
31
+ throw Error('Unsupported report format');
32
+ return `BehavProof: ${report.status} (${report.mandatoryCount} mandatory rules)\n${conditions.length ? conditions.join('\n') + '\n' : ''}${report.evaluations.map(e => `${e.status.padEnd(14)} ${e.severity.padEnd(5)} ${e.ruleId} [${scope(e)}]: ${e.message}${e.evidenceIds.length ? `\n Evidence: ${JSON.stringify(e.evidenceIds)}` : ''}${e.remediation ? `\n Action: ${e.remediation}` : ''}`).join('\n')}\n` + (rows.length ? `\nPolicy comparison:\n${rows.map(r => `${r.name}: protected=${canonicalJson(r.protected)} project=${canonicalJson(r.project)} effective=${canonicalJson(r.effective)}`).join('\n')}\n` : '');
33
+ }
34
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAuD,MAAM,kBAAkB,CAAC;AAErG,MAAM,OAAO,GAAuB;IACnC,UAAU,EAAC,6GAA6G;IACxH,mBAAmB,EAAC,+FAA+F;IACnH,aAAa,EAAC,8HAA8H;IAC5I,iBAAiB,EAAC,qHAAqH;IACvI,cAAc,EAAC,oHAAoH;IACnI,iBAAiB,EAAC,4HAA4H;IAC9I,aAAa,EAAC,2FAA2F;IACzG,gBAAgB,EAAC,2HAA2H;IAC5I,wBAAwB,EAAC,iHAAiH;IAC1I,2BAA2B,EAAC,gIAAgI;IAC5J,iBAAiB,EAAC,iIAAiI;IACnJ,qBAAqB,EAAC,0FAA0F;IAChH,kBAAkB,EAAC,wHAAwH;IAC3I,wBAAwB,EAAC,kGAAkG;CAC3H,CAAC;AACF,MAAM,UAAU,cAAc,CAAC,CAAY,IAAE,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,CAAC,IAAI,CAAC,IAAI,CAAA,CAAC,CAAA,EAAE,CAAC,CAAC;AAC7kB,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { type Config, type Policy, type RegistrySnapshot, type EvidenceStatus } from '@behavproof/core';
2
+ import { type CoverageReport, type MutationReport, type Scope } from '@behavproof/adapter-reports';
3
+ import { type ExecutionRow } from '@behavproof/contract-registry';
4
+ type State = {
5
+ status: EvidenceStatus;
6
+ message: string;
7
+ evidenceIds: string[];
8
+ remediation?: string;
9
+ };
10
+ export declare function scopedEvaluations(input: {
11
+ config: Config;
12
+ protectedConfig?: Config;
13
+ policy: Policy;
14
+ registry: RegistrySnapshot;
15
+ files: readonly string[];
16
+ states: ReadonlyMap<string, State>;
17
+ rows: ExecutionRow[];
18
+ bindings: Record<string, string>;
19
+ verifyRow: (row: ExecutionRow) => boolean;
20
+ claims: ReadonlyMap<string, Record<string, string>>;
21
+ claimScopes: readonly {
22
+ contractId: string;
23
+ targetRef: string;
24
+ }[];
25
+ intentStatus: ReadonlyMap<string, string>;
26
+ coverage?: CoverageReport;
27
+ mutation?: MutationReport;
28
+ coverageTrusted: boolean;
29
+ mutationTrusted: boolean;
30
+ mapping: boolean;
31
+ changed: Scope;
32
+ sources: Readonly<Record<string, string>>;
33
+ }): {
34
+ ruleId: string;
35
+ severity: "error" | "off" | "warn";
36
+ status: "unknown" | "pass" | "fail" | "not_applicable";
37
+ evidenceIds: string[];
38
+ scope: string[];
39
+ message: string;
40
+ remediation?: string | undefined;
41
+ notApplicable?: {
42
+ reason: string;
43
+ allowedReasons: string[];
44
+ evidenceIds: string[];
45
+ } | undefined;
46
+ }[];
47
+ export {};
48
+ //# sourceMappingURL=scopes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuD,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAmB,KAAK,cAAc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A,OAAO,EAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAC,MAAM,CAAC,CAAC,CAAA;CAAC;;;;;;;;;;;;;IA4BrkB"}
package/dist/scopes.js ADDED
@@ -0,0 +1,60 @@
1
+ import { getProfilePolicy, resolveRisk, mergeProtectedPolicy } from '@behavproof/core';
2
+ import { evaluateCoverage, evaluateMutation } from '@behavproof/adapter-reports';
3
+ import { evaluateAssurance } from '@behavproof/contract-registry';
4
+ import { impactSeverity } from './impact.js';
5
+ const worst = (states) => states.includes('fail') ? 'fail' : states.length && states.every(s => s === 'pass') ? 'pass' : 'unknown';
6
+ const sourcePath = (ref) => ref.replace(/:\d+(?::\d+)?$/, '');
7
+ export function scopedEvaluations(input) {
8
+ const contexts = [];
9
+ for (const c of input.registry.contracts)
10
+ contexts.push({ id: c.id, path: sourcePath(c.sourceRef), contractId: c.id, kind: c.kind, ...(c.risk ? { declaredRisk: c.risk } : {}) });
11
+ for (const path of input.files) {
12
+ const module = path.replace(/\.[cm]?[jt]sx?$/, '');
13
+ if ([...input.config.riskOverrides, ...(input.protectedConfig?.riskOverrides ?? [])].some(o => o.selector.kind === 'module' ? o.selector.value === module : o.selector.kind === 'path' && resolveRisk({ ...input.config, riskOverrides: [o] }, { path, module }) !== input.config.profile))
14
+ contexts.push({ id: path, path });
15
+ }
16
+ const result = [];
17
+ for (const context of contexts) {
18
+ const target = { path: context.path, module: context.path.replace(/\.[cm]?[jt]sx?$/, ''), ...(context.kind ? { contractKind: context.kind } : {}), ...(context.declaredRisk ? { declaredRisk: context.declaredRisk } : {}) };
19
+ const protectedRisk = input.protectedConfig ? resolveRisk(input.protectedConfig, target) : undefined, risk = resolveRisk(input.config, target, protectedRisk), profile = getProfilePolicy(risk);
20
+ // Risk selects mandatory obligations; numerical parameters come from the
21
+ // already merged project/protected policy rather than reapplying preset defaults.
22
+ for (const [id, rule] of Object.entries(profile.rules)) {
23
+ const configured = input.policy.rules[id];
24
+ if (configured?.min !== undefined)
25
+ rule.min = configured.min;
26
+ if (configured?.minMutants !== undefined)
27
+ rule.minMutants = configured.minMutants;
28
+ if (configured?.allowNotApplicable)
29
+ rule.allowNotApplicable = configured.allowNotApplicable;
30
+ }
31
+ const effective = mergeProtectedPolicy(input.policy, profile);
32
+ effective.rules.changeImpact = { severity: impactSeverity(risk, effective.rules.changeImpact) };
33
+ const contracts = context.contractId ? input.registry.contracts.filter(c => c.id === context.contractId) : input.registry.contracts.filter(c => sourcePath(c.sourceRef) === context.path || input.claimScopes.some(s => s.contractId === c.id && s.targetRef.split('#')[0] === context.path));
34
+ const selected = { ...input.registry, contracts }, assurance = evaluateAssurance(selected, input.rows, input.bindings, input.verifyRow), facts = new Map(input.states);
35
+ facts.set('contractExecution', { status: assurance.cases_executed, message: `Scoped ${risk} contract comparison requirements`, evidenceIds: [] });
36
+ const intents = [...new Set(contracts.flatMap(c => c.intentIds))];
37
+ facts.set('intentApproval', { status: worst(intents.map(id => input.intentStatus.get(id) ?? 'unknown')), message: 'Scoped Intent approval requirements', evidenceIds: [] });
38
+ for (const [rule, claim] of [['negativeCases', 'negative_cases'], ['productionTargetObserved', 'production_target_observed'], ['mutationSensitivityObserved', 'mutation_sensitivity_observed']])
39
+ facts.set(rule, { status: worst(contracts.map(c => input.claims.get(c.id)?.[claim] ?? 'unknown')), message: `Scoped ${risk} case evidence required`, evidenceIds: [] });
40
+ const paths = context.contractId ? input.claimScopes.filter(s => s.contractId === context.contractId).map(s => s.targetRef.split('#')[0]) : [context.path], scope = Object.fromEntries(Object.entries(input.changed).filter(([path]) => paths.includes(path)));
41
+ if (input.coverage) {
42
+ const evaluation = evaluateCoverage(input.coverage, scope, effective.rules.changedLineCoverage?.min ?? 80, {}, input.mapping);
43
+ facts.set('changedLineCoverage', { status: input.coverageTrusted ? evaluation.status : 'unknown', message: `Scoped changed lines: ${JSON.stringify(evaluation.payload)}`, evidenceIds: [] });
44
+ }
45
+ else
46
+ facts.set('changedLineCoverage', { status: 'unknown', message: 'Scoped coverage unavailable', evidenceIds: [] });
47
+ if (input.mutation) {
48
+ const p = effective.rules.mutationScore, evaluation = evaluateMutation(input.mutation, scope, p?.min ?? 70, p?.minMutants ?? 10, input.sources, input.mapping);
49
+ facts.set('mutationScore', { status: input.mutationTrusted ? evaluation.status : 'unknown', message: `Scoped mutants: ${JSON.stringify(evaluation.payload)}`, evidenceIds: [] });
50
+ }
51
+ else
52
+ facts.set('mutationScore', { status: 'unknown', message: 'Scoped mutation data unavailable', evidenceIds: [] });
53
+ for (const [ruleId, rule] of Object.entries(effective.rules)) {
54
+ const fact = facts.get(ruleId);
55
+ result.push({ ruleId, severity: rule.severity, status: fact?.status ?? 'unknown', scope: [context.contractId ? 'contract' : 'path', context.id], evidenceIds: fact?.evidenceIds ?? [], message: fact?.message ?? `Evidence unavailable for ${risk} scope`, ...(fact?.remediation ? { remediation: fact.remediation } : {}) });
56
+ }
57
+ }
58
+ return result;
59
+ }
60
+ //# sourceMappingURL=scopes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopes.js","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,oBAAoB,EAAyF,MAAM,kBAAkB,CAAC;AAC9K,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAwD,MAAM,6BAA6B,CAAC;AACvI,OAAO,EAAE,iBAAiB,EAAqB,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAE3C,MAAM,KAAK,GAAC,CAAC,MAAwB,EAAgB,EAAE,CAAA,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA,CAAC,CAAA,MAAM,CAAA,CAAC,CAAA,MAAM,CAAC,MAAM,IAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA,EAAE,CAAA,CAAC,KAAG,MAAM,CAAC,CAAA,CAAC,CAAA,MAAM,CAAA,CAAC,CAAA,SAAS,CAAC;AAClJ,MA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