@veraxhq/verax 0.2.1 → 0.3.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.
- package/README.md +14 -18
- package/bin/verax.js +7 -0
- package/package.json +3 -3
- package/src/cli/commands/baseline.js +104 -0
- package/src/cli/commands/default.js +79 -25
- package/src/cli/commands/ga.js +243 -0
- package/src/cli/commands/gates.js +95 -0
- package/src/cli/commands/inspect.js +131 -2
- package/src/cli/commands/release-check.js +213 -0
- package/src/cli/commands/run.js +246 -35
- package/src/cli/commands/security-check.js +211 -0
- package/src/cli/commands/truth.js +114 -0
- package/src/cli/entry.js +304 -67
- package/src/cli/util/angular-component-extractor.js +179 -0
- package/src/cli/util/angular-navigation-detector.js +141 -0
- package/src/cli/util/angular-network-detector.js +161 -0
- package/src/cli/util/angular-state-detector.js +162 -0
- package/src/cli/util/ast-interactive-detector.js +546 -0
- package/src/cli/util/ast-network-detector.js +603 -0
- package/src/cli/util/ast-usestate-detector.js +602 -0
- package/src/cli/util/bootstrap-guard.js +86 -0
- package/src/cli/util/determinism-runner.js +123 -0
- package/src/cli/util/determinism-writer.js +129 -0
- package/src/cli/util/env-url.js +4 -0
- package/src/cli/util/expectation-extractor.js +369 -73
- package/src/cli/util/findings-writer.js +126 -16
- package/src/cli/util/learn-writer.js +3 -1
- package/src/cli/util/observe-writer.js +3 -1
- package/src/cli/util/paths.js +3 -12
- package/src/cli/util/project-discovery.js +3 -0
- package/src/cli/util/project-writer.js +3 -1
- package/src/cli/util/run-resolver.js +64 -0
- package/src/cli/util/source-requirement.js +55 -0
- package/src/cli/util/summary-writer.js +1 -0
- package/src/cli/util/svelte-navigation-detector.js +163 -0
- package/src/cli/util/svelte-network-detector.js +80 -0
- package/src/cli/util/svelte-sfc-extractor.js +147 -0
- package/src/cli/util/svelte-state-detector.js +243 -0
- package/src/cli/util/vue-navigation-detector.js +177 -0
- package/src/cli/util/vue-sfc-extractor.js +162 -0
- package/src/cli/util/vue-state-detector.js +215 -0
- package/src/verax/cli/finding-explainer.js +56 -3
- package/src/verax/core/artifacts/registry.js +154 -0
- package/src/verax/core/artifacts/verifier.js +980 -0
- package/src/verax/core/baseline/baseline.enforcer.js +137 -0
- package/src/verax/core/baseline/baseline.snapshot.js +231 -0
- package/src/verax/core/capabilities/gates.js +499 -0
- package/src/verax/core/capabilities/registry.js +475 -0
- package/src/verax/core/confidence/confidence-compute.js +137 -0
- package/src/verax/core/confidence/confidence-invariants.js +234 -0
- package/src/verax/core/confidence/confidence-report-writer.js +112 -0
- package/src/verax/core/confidence/confidence-weights.js +44 -0
- package/src/verax/core/confidence/confidence.defaults.js +65 -0
- package/src/verax/core/confidence/confidence.loader.js +79 -0
- package/src/verax/core/confidence/confidence.schema.js +94 -0
- package/src/verax/core/confidence-engine-refactor.js +484 -0
- package/src/verax/core/confidence-engine.js +486 -0
- package/src/verax/core/confidence-engine.js.backup +471 -0
- package/src/verax/core/contracts/index.js +29 -0
- package/src/verax/core/contracts/types.js +185 -0
- package/src/verax/core/contracts/validators.js +381 -0
- package/src/verax/core/decision-snapshot.js +30 -3
- package/src/verax/core/decisions/decision.trace.js +276 -0
- package/src/verax/core/determinism/contract-writer.js +89 -0
- package/src/verax/core/determinism/contract.js +139 -0
- package/src/verax/core/determinism/diff.js +364 -0
- package/src/verax/core/determinism/engine.js +221 -0
- package/src/verax/core/determinism/finding-identity.js +148 -0
- package/src/verax/core/determinism/normalize.js +438 -0
- package/src/verax/core/determinism/report-writer.js +92 -0
- package/src/verax/core/determinism/run-fingerprint.js +118 -0
- package/src/verax/core/dynamic-route-intelligence.js +528 -0
- package/src/verax/core/evidence/evidence-capture-service.js +307 -0
- package/src/verax/core/evidence/evidence-intent-ledger.js +165 -0
- package/src/verax/core/evidence-builder.js +487 -0
- package/src/verax/core/execution-mode-context.js +77 -0
- package/src/verax/core/execution-mode-detector.js +190 -0
- package/src/verax/core/failures/exit-codes.js +86 -0
- package/src/verax/core/failures/failure-summary.js +76 -0
- package/src/verax/core/failures/failure.factory.js +225 -0
- package/src/verax/core/failures/failure.ledger.js +132 -0
- package/src/verax/core/failures/failure.types.js +196 -0
- package/src/verax/core/failures/index.js +10 -0
- package/src/verax/core/ga/ga-report-writer.js +43 -0
- package/src/verax/core/ga/ga.artifact.js +49 -0
- package/src/verax/core/ga/ga.contract.js +434 -0
- package/src/verax/core/ga/ga.enforcer.js +86 -0
- package/src/verax/core/guardrails/guardrails-report-writer.js +109 -0
- package/src/verax/core/guardrails/policy.defaults.js +210 -0
- package/src/verax/core/guardrails/policy.loader.js +83 -0
- package/src/verax/core/guardrails/policy.schema.js +110 -0
- package/src/verax/core/guardrails/truth-reconciliation.js +136 -0
- package/src/verax/core/guardrails-engine.js +505 -0
- package/src/verax/core/observe/run-timeline.js +316 -0
- package/src/verax/core/perf/perf.contract.js +186 -0
- package/src/verax/core/perf/perf.display.js +65 -0
- package/src/verax/core/perf/perf.enforcer.js +91 -0
- package/src/verax/core/perf/perf.monitor.js +209 -0
- package/src/verax/core/perf/perf.report.js +198 -0
- package/src/verax/core/pipeline-tracker.js +238 -0
- package/src/verax/core/product-definition.js +127 -0
- package/src/verax/core/release/provenance.builder.js +271 -0
- package/src/verax/core/release/release-report-writer.js +40 -0
- package/src/verax/core/release/release.enforcer.js +159 -0
- package/src/verax/core/release/reproducibility.check.js +221 -0
- package/src/verax/core/release/sbom.builder.js +283 -0
- package/src/verax/core/report/cross-index.js +192 -0
- package/src/verax/core/report/human-summary.js +222 -0
- package/src/verax/core/route-intelligence.js +419 -0
- package/src/verax/core/security/secrets.scan.js +326 -0
- package/src/verax/core/security/security-report.js +50 -0
- package/src/verax/core/security/security.enforcer.js +124 -0
- package/src/verax/core/security/supplychain.defaults.json +38 -0
- package/src/verax/core/security/supplychain.policy.js +326 -0
- package/src/verax/core/security/vuln.scan.js +265 -0
- package/src/verax/core/truth/truth.certificate.js +250 -0
- package/src/verax/core/ui-feedback-intelligence.js +515 -0
- package/src/verax/detect/confidence-engine.js +628 -40
- package/src/verax/detect/confidence-helper.js +33 -0
- package/src/verax/detect/detection-engine.js +18 -1
- package/src/verax/detect/dynamic-route-findings.js +335 -0
- package/src/verax/detect/expectation-chain-detector.js +417 -0
- package/src/verax/detect/expectation-model.js +3 -1
- package/src/verax/detect/findings-writer.js +141 -5
- package/src/verax/detect/index.js +229 -5
- package/src/verax/detect/journey-stall-detector.js +558 -0
- package/src/verax/detect/route-findings.js +218 -0
- package/src/verax/detect/ui-feedback-findings.js +207 -0
- package/src/verax/detect/verdict-engine.js +57 -3
- package/src/verax/detect/view-switch-correlator.js +242 -0
- package/src/verax/index.js +413 -45
- package/src/verax/learn/action-contract-extractor.js +682 -64
- package/src/verax/learn/route-validator.js +4 -1
- package/src/verax/observe/index.js +88 -843
- package/src/verax/observe/interaction-runner.js +25 -8
- package/src/verax/observe/observe-context.js +205 -0
- package/src/verax/observe/observe-helpers.js +191 -0
- package/src/verax/observe/observe-runner.js +226 -0
- package/src/verax/observe/observers/budget-observer.js +185 -0
- package/src/verax/observe/observers/console-observer.js +102 -0
- package/src/verax/observe/observers/coverage-observer.js +107 -0
- package/src/verax/observe/observers/interaction-observer.js +471 -0
- package/src/verax/observe/observers/navigation-observer.js +132 -0
- package/src/verax/observe/observers/network-observer.js +87 -0
- package/src/verax/observe/observers/safety-observer.js +82 -0
- package/src/verax/observe/observers/ui-feedback-observer.js +99 -0
- package/src/verax/observe/ui-feedback-detector.js +742 -0
- package/src/verax/observe/ui-signal-sensor.js +148 -2
- package/src/verax/scan-summary-writer.js +42 -8
- package/src/verax/shared/artifact-manager.js +8 -5
- package/src/verax/shared/css-spinner-rules.js +204 -0
- package/src/verax/shared/view-switch-rules.js +208 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TRUTH BOUNDARY: State-Driven Navigation / View Switch Detection Rules
|
|
3
|
+
*
|
|
4
|
+
* Hard rules encoded as constants and predicates. No prose, only code.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Detectable view switch function name patterns (strict allowlist)
|
|
9
|
+
* Only literal string/number arguments are accepted.
|
|
10
|
+
*/
|
|
11
|
+
export const VIEW_SWITCH_FUNCTION_PATTERNS = {
|
|
12
|
+
// React setState patterns
|
|
13
|
+
react: [
|
|
14
|
+
/^setView$/i,
|
|
15
|
+
/^setPage$/i,
|
|
16
|
+
/^setStep$/i,
|
|
17
|
+
/^setScreen$/i,
|
|
18
|
+
/^setTab$/i,
|
|
19
|
+
/^setModalOpen$/i,
|
|
20
|
+
/^setDrawerOpen$/i,
|
|
21
|
+
/^setPanelOpen$/i,
|
|
22
|
+
/^setActiveTab$/i,
|
|
23
|
+
/^setActiveView$/i,
|
|
24
|
+
/^setCurrentStep$/i,
|
|
25
|
+
/^setCurrentPage$/i,
|
|
26
|
+
/^setCurrentScreen$/i,
|
|
27
|
+
/^setCurrentView$/i,
|
|
28
|
+
/^setShowModal$/i,
|
|
29
|
+
/^setShowDrawer$/i,
|
|
30
|
+
/^setShowPanel$/i,
|
|
31
|
+
/^setIsModalOpen$/i,
|
|
32
|
+
/^setIsDrawerOpen$/i,
|
|
33
|
+
/^setIsPanelOpen$/i
|
|
34
|
+
],
|
|
35
|
+
|
|
36
|
+
// Redux dispatch action types
|
|
37
|
+
redux: [
|
|
38
|
+
/^NAVIGATE$/i,
|
|
39
|
+
/^SET_VIEW$/i,
|
|
40
|
+
/^SET_STEP$/i,
|
|
41
|
+
/^SET_PAGE$/i,
|
|
42
|
+
/^SET_SCREEN$/i,
|
|
43
|
+
/^SET_TAB$/i,
|
|
44
|
+
/^OPEN_MODAL$/i,
|
|
45
|
+
/^CLOSE_MODAL$/i,
|
|
46
|
+
/^OPEN_DRAWER$/i,
|
|
47
|
+
/^CLOSE_DRAWER$/i,
|
|
48
|
+
/^OPEN_PANEL$/i,
|
|
49
|
+
/^CLOSE_PANEL$/i,
|
|
50
|
+
/^SWITCH_VIEW$/i,
|
|
51
|
+
/^SWITCH_TAB$/i,
|
|
52
|
+
/^SWITCH_STEP$/i
|
|
53
|
+
],
|
|
54
|
+
|
|
55
|
+
// Generic function call patterns
|
|
56
|
+
generic: [
|
|
57
|
+
/^showModal$/i,
|
|
58
|
+
/^hideModal$/i,
|
|
59
|
+
/^openDrawer$/i,
|
|
60
|
+
/^closeDrawer$/i,
|
|
61
|
+
/^openPanel$/i,
|
|
62
|
+
/^closePanel$/i,
|
|
63
|
+
/^switchView$/i,
|
|
64
|
+
/^switchTab$/i,
|
|
65
|
+
/^switchStep$/i,
|
|
66
|
+
/^navigateTo$/i,
|
|
67
|
+
/^goToView$/i,
|
|
68
|
+
/^goToStep$/i,
|
|
69
|
+
/^goToPage$/i,
|
|
70
|
+
/^goToScreen$/i
|
|
71
|
+
]
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* View switch kinds (categories)
|
|
76
|
+
*/
|
|
77
|
+
export const VIEW_SWITCH_KINDS = {
|
|
78
|
+
TAB: 'tab',
|
|
79
|
+
VIEW: 'view',
|
|
80
|
+
MODAL: 'modal',
|
|
81
|
+
DRAWER: 'drawer',
|
|
82
|
+
PANEL: 'panel',
|
|
83
|
+
STEP: 'step',
|
|
84
|
+
SCREEN: 'screen',
|
|
85
|
+
PAGE: 'page'
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Reason codes for truth boundary decisions
|
|
90
|
+
*/
|
|
91
|
+
export const VIEW_SWITCH_REASON_CODES = {
|
|
92
|
+
DETECTABLE_LITERAL_ARG: 'DETECTABLE_LITERAL_ARG',
|
|
93
|
+
REJECTED_COMPLEX_EXPRESSION: 'REJECTED_COMPLEX_EXPRESSION',
|
|
94
|
+
REJECTED_DYNAMIC_VALUE: 'REJECTED_DYNAMIC_VALUE',
|
|
95
|
+
REJECTED_MEMBER_EXPRESSION: 'REJECTED_MEMBER_EXPRESSION',
|
|
96
|
+
REJECTED_FUNCTION_CALL: 'REJECTED_FUNCTION_CALL',
|
|
97
|
+
REJECTED_NOT_IN_ALLOWLIST: 'REJECTED_NOT_IN_ALLOWLIST',
|
|
98
|
+
ACCEPTED_STRING_LITERAL: 'ACCEPTED_STRING_LITERAL',
|
|
99
|
+
ACCEPTED_NUMBER_LITERAL: 'ACCEPTED_NUMBER_LITERAL'
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Check if a function name matches view switch patterns
|
|
104
|
+
* @param {string} functionName - Function name to check
|
|
105
|
+
* @returns {Object|null} - { kind, pattern } or null
|
|
106
|
+
*/
|
|
107
|
+
export function isViewSwitchFunction(functionName) {
|
|
108
|
+
if (!functionName || typeof functionName !== 'string') return null;
|
|
109
|
+
|
|
110
|
+
// Check React patterns
|
|
111
|
+
for (const pattern of VIEW_SWITCH_FUNCTION_PATTERNS.react) {
|
|
112
|
+
if (pattern.test(functionName)) {
|
|
113
|
+
const kind = inferViewSwitchKind(functionName);
|
|
114
|
+
return { kind, pattern: 'react', functionName };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Check Redux patterns
|
|
119
|
+
for (const pattern of VIEW_SWITCH_FUNCTION_PATTERNS.redux) {
|
|
120
|
+
if (pattern.test(functionName)) {
|
|
121
|
+
const kind = inferViewSwitchKind(functionName);
|
|
122
|
+
return { kind, pattern: 'redux', functionName };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Check generic patterns
|
|
127
|
+
for (const pattern of VIEW_SWITCH_FUNCTION_PATTERNS.generic) {
|
|
128
|
+
if (pattern.test(functionName)) {
|
|
129
|
+
const kind = inferViewSwitchKind(functionName);
|
|
130
|
+
return { kind, pattern: 'generic', functionName };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Infer view switch kind from function name
|
|
139
|
+
* @param {string} functionName - Function name
|
|
140
|
+
* @returns {string} - View switch kind
|
|
141
|
+
*/
|
|
142
|
+
function inferViewSwitchKind(functionName) {
|
|
143
|
+
const lower = functionName.toLowerCase();
|
|
144
|
+
|
|
145
|
+
if (lower.includes('tab')) return VIEW_SWITCH_KINDS.TAB;
|
|
146
|
+
if (lower.includes('modal')) return VIEW_SWITCH_KINDS.MODAL;
|
|
147
|
+
if (lower.includes('drawer')) return VIEW_SWITCH_KINDS.DRAWER;
|
|
148
|
+
if (lower.includes('panel')) return VIEW_SWITCH_KINDS.PANEL;
|
|
149
|
+
if (lower.includes('step')) return VIEW_SWITCH_KINDS.STEP;
|
|
150
|
+
if (lower.includes('screen')) return VIEW_SWITCH_KINDS.SCREEN;
|
|
151
|
+
if (lower.includes('page')) return VIEW_SWITCH_KINDS.PAGE;
|
|
152
|
+
if (lower.includes('view')) return VIEW_SWITCH_KINDS.VIEW;
|
|
153
|
+
|
|
154
|
+
return VIEW_SWITCH_KINDS.VIEW; // Default
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Check if an AST node is a detectable literal argument
|
|
159
|
+
* TRUTH BOUNDARY: Only StringLiteral and NumericLiteral are accepted
|
|
160
|
+
* @param {Object} node - AST node
|
|
161
|
+
* @returns {Object|null} - { value, reasonCode } or null
|
|
162
|
+
*/
|
|
163
|
+
export function isDetectableLiteralArg(node) {
|
|
164
|
+
if (!node) return null;
|
|
165
|
+
|
|
166
|
+
// String literal: setView('settings')
|
|
167
|
+
if (node.type === 'StringLiteral') {
|
|
168
|
+
return {
|
|
169
|
+
value: node.value,
|
|
170
|
+
reasonCode: VIEW_SWITCH_REASON_CODES.ACCEPTED_STRING_LITERAL
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Number literal: setStep(2)
|
|
175
|
+
if (node.type === 'NumericLiteral') {
|
|
176
|
+
return {
|
|
177
|
+
value: String(node.value),
|
|
178
|
+
reasonCode: VIEW_SWITCH_REASON_CODES.ACCEPTED_NUMBER_LITERAL
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Template literal without interpolation: setView(`settings`)
|
|
183
|
+
if (node.type === 'TemplateLiteral' && node.expressions.length === 0) {
|
|
184
|
+
const value = node.quasis[0]?.value?.cooked;
|
|
185
|
+
if (value) {
|
|
186
|
+
return {
|
|
187
|
+
value,
|
|
188
|
+
reasonCode: VIEW_SWITCH_REASON_CODES.ACCEPTED_STRING_LITERAL
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// REJECTED: Complex expressions
|
|
194
|
+
if (node.type === 'CallExpression') {
|
|
195
|
+
return { reasonCode: VIEW_SWITCH_REASON_CODES.REJECTED_FUNCTION_CALL };
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (node.type === 'MemberExpression') {
|
|
199
|
+
return { reasonCode: VIEW_SWITCH_REASON_CODES.REJECTED_MEMBER_EXPRESSION };
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (node.type === 'Identifier') {
|
|
203
|
+
return { reasonCode: VIEW_SWITCH_REASON_CODES.REJECTED_DYNAMIC_VALUE };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return { reasonCode: VIEW_SWITCH_REASON_CODES.REJECTED_COMPLEX_EXPRESSION };
|
|
207
|
+
}
|
|
208
|
+
|