-
Notifications
You must be signed in to change notification settings - Fork 0
Code Review: Full-Stack Epistemic Alignment #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: codex/review-and-refactor-chatclient-component-1-1
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,3 +61,4 @@ specs/*/api/*.json | |
| examples/*.json | ||
| examples/*.md | ||
| !examples/.keep | ||
| server_output.log | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -93,11 +93,32 @@ const req = http.request(options, (res) => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log('📊 Seismograph Summary:'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log('---'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(`Magnitude: ${summary.magnitude?.toFixed(2) ?? '—'} (${summary.magnitude_label ?? '?'})`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(`Directional Bias: ${summary.directional_bias?.value?.toFixed(2) ?? '—'} (${summary.directional_bias?.label ?? '?'})`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const magnitude = summary.magnitude; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const directionalBias = summary.directional_bias?.value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(`Magnitude: ${magnitude?.toFixed(2) ?? '—'} (${summary.magnitude_label ?? '?'})`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(`Directional Bias: ${directionalBias?.toFixed(2) ?? '—'} (${summary.directional_bias?.label ?? '?'})`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(`Volatility: ${summary.volatility?.toFixed(2) ?? '—'} (${summary.volatility_label ?? '?'})`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Assertions for Golden Standard | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const expectedMagnitude = 4.1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const expectedBias = -3.5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const tolerance = 0.1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (Math.abs(magnitude - expectedMagnitude) > tolerance) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.error(`❌ Magnitude is out of tolerance: expected ${expectedMagnitude}, got ${magnitude}`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| process.exit(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (Math.abs(directionalBias - expectedBias) > tolerance) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.error(`❌ Directional Bias is out of tolerance: expected ${expectedBias}, got ${directionalBias}`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| process.exit(1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log('✅ Golden Standard values are within tolerance!'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+104
to
+119
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Assertions for Golden Standard | |
| const expectedMagnitude = 4.1; | |
| const expectedBias = -3.5; | |
| const tolerance = 0.1; | |
| if (Math.abs(magnitude - expectedMagnitude) > tolerance) { | |
| console.error(`❌ Magnitude is out of tolerance: expected ${expectedMagnitude}, got ${magnitude}`); | |
| process.exit(1); | |
| } | |
| if (Math.abs(directionalBias - expectedBias) > tolerance) { | |
| console.error(`❌ Directional Bias is out of tolerance: expected ${expectedBias}, got ${directionalBias}`); | |
| process.exit(1); | |
| } | |
| console.log('✅ Golden Standard values are within tolerance!'); | |
| // Assertions for Golden Standard (from lib/balance/constants.js) | |
| const minMagnitude = 4.5; | |
| const biasBand = [-5.0, -4.0]; | |
| if (magnitude < minMagnitude) { | |
| console.error(`❌ Magnitude is below Golden Standard: expected at least ${minMagnitude}, got ${magnitude}`); | |
| process.exit(1); | |
| } | |
| if (directionalBias < biasBand[0] || directionalBias > biasBand[1]) { | |
| console.error(`❌ Directional Bias is outside Golden Standard band: expected between ${biasBand[0]} and ${biasBand[1]}, got ${directionalBias}`); | |
| process.exit(1); | |
| } | |
| console.log('✅ Golden Standard values are within thresholds!'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing null/undefined checks before performing mathematical operations. If either
magnitudeordirectionalBiasis undefined (e.g., due to API failure or missing data),Math.abs()will receiveNaNand the comparison will silently fail rather than producing a clear error message.Consider adding explicit validation:
This provides clearer diagnostics when the API response structure doesn't match expectations.