Skip to content

Fix Math Brain Data Import Failure#305

Draft
google-labs-jules[bot] wants to merge 1 commit intomainfrom
fix/math-brain-data-import
Draft

Fix Math Brain Data Import Failure#305
google-labs-jules[bot] wants to merge 1 commit intomainfrom
fix/math-brain-data-import

Conversation

@google-labs-jules
Copy link
Contributor

This commit fixes a bug that caused the Math Brain to fail when processing incomplete house cusp data. The changes ensure that the application can gracefully handle missing data from the upstream API, preventing unexpected failures and improving the overall stability of the system.

Fixes #


PR created automatically by Jules for task 1541907969709352006 started by @DHCross

This commit addresses an issue where the Math Brain would fail during data import due to incomplete house cusp data from the upstream API.

The `extractHouseCusps` function has been modified to gracefully handle missing house cusps. Instead of returning `null`, it now returns an object containing the cusps that were found and an array of the missing ones.

The `fetchNatalChartComplete` function has been updated to handle the new return format from `extractHouseCusps`, ensuring that incomplete data is processed without causing downstream errors.

The `calculateNatalHouse` function has also been updated to be backward-compatible with the new data structure, ensuring that the application remains functional after the refactoring.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@netlify
Copy link

netlify bot commented Nov 14, 2025

Deploy Preview for sprightly-genie-998c07 ready!

Name Link
🔨 Latest commit 126eb9f
🔍 Latest deploy log https://app.netlify.com/projects/sprightly-genie-998c07/deploys/691776ffd1b8e50008be518d
😎 Deploy Preview https://deploy-preview-305--sprightly-genie-998c07.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 53 (🔴 down 5 from production)
Accessibility: 97 (no change from production)
Best Practices: 92 (🔴 down 8 from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@DHCross DHCross requested a review from Copilot November 18, 2025 21:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug in the Math Brain's house cusp data processing by gracefully handling incomplete or missing house cusp data from upstream APIs, preventing failures and improving system stability.

Key Changes:

  • Modified extractHouseCusps() to return an object containing both found cusps and missing cusp names instead of null for incomplete data
  • Updated calculateNatalHouse() to handle house cusps in both array and object formats
  • Enhanced error logging to track missing house cusps while continuing processing

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/math-brain/utils/compression.js Refactored house cusp extraction to return partial data with missing indicators and updated house calculation to handle multiple data formats
src/math-brain/api-client.js Updated natal chart processing to handle new house cusp result format and log missing cusps as warnings
package.json Removed extraneous blank lines from npm scripts section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

? Object.values(houseCusps).map(c => c.abs_pos)
: null);

if (!cuspValues || cuspValues.length < 12 || typeof transitLongitude !== 'number') {
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation changed from !== 12 to < 12, allowing incomplete house data (e.g., 11 cusps) to pass validation. This could cause index out-of-bounds errors at line 123 when accessing cuspValues[(i + 1) % 12] if fewer than 12 cusps are present. Either restore the strict !== 12 check or add bounds validation in the loop.

Suggested change
if (!cuspValues || cuspValues.length < 12 || typeof transitLongitude !== 'number') {
if (!cuspValues || cuspValues.length !== 12 || typeof transitLongitude !== 'number') {

Copilot uses AI. Check for mistakes.
}

return cusps.length === 12 ? cusps : null;
return { cusps, missing };
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function's return type changed from number[]|null (as documented in the JSDoc at line 146) to an object with {cusps, missing} properties. The JSDoc must be updated to reflect the new return type: @returns {{cusps: Object, missing: string[]}|null}.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant