Skip to content

Fix root readiness index rendering for numeric metadata#74

Open
aldorizona10-glitch wants to merge 1 commit into
Iskander-Agent:mainfrom
aldorizona10-glitch:fix-root-readiness-index-normalization
Open

Fix root readiness index rendering for numeric metadata#74
aldorizona10-glitch wants to merge 1 commit into
Iskander-Agent:mainfrom
aldorizona10-glitch:fix-root-readiness-index-normalization

Conversation

@aldorizona10-glitch

Copy link
Copy Markdown

Summary

  • normalize numeric metadata.quantum_readiness_index in root index.html before rendering the readiness card
  • derive voiced urgency and coverage panels from the current score distribution when the structured index object is absent
  • match the compatibility behavior already used by public/index.html

Why

The v3.5 data stores metadata.quantum_readiness_index as a number (0.5714), while the root dashboard script still reads it as the older structured object. If root index.html is served directly, the readiness panel can fail before rendering.

Checks

  • npm run validate:data
  • npm run check:dashboard
  • npm run check:frontend
  • node -e root index.html inline script syntax check

@aldorizona10-glitch

Copy link
Copy Markdown
Author

Reproduction / PoC

The current v3.5 dataset stores metadata.quantum_readiness_index as a number:

"quantum_readiness_index": 0.5714

The root index.html script reads that field as the older structured object shape:

const comp = qri.composite_readiness;
const voiced = qri.voiced_urgency;
const coverage = qri.coverage;

If root index.html is served with the v3.5 data file, qri is numeric, so those object reads return undefined and the readiness card can fail before rendering.

This PR adds the same compatibility normalization pattern already present in public/index.html: structured index objects are used as-is, while numeric index values are converted into the expected render shape and voiced urgency / coverage are derived from the current score distribution.

Verification

Ran locally in the quantum-visualizer repo:

npm run validate:data
npm run check:dashboard
npm run check:frontend
node -e "const fs=require('fs'),vm=require('vm'); const html=fs.readFileSync('index.html','utf8'); const m=html.match(/<script>([\\s\\S]*)<\\/script>/); if(!m) throw new Error('missing script'); new vm.Script(m[1], {filename:'index.html <script>'}); console.log('root index script passed');"

Results:

  • validate-data passed: 72 developers, ranked=50, notable=21
  • check-dashboard-source passed
  • check-frontend passed
  • root index script passed

@Iskander-Agent Iskander-Agent left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Good defensive fix. normalizeReadiness() guard passes structured QRI objects through unchanged, so existing well-formed data is unaffected. The numeric fallback handles both 0–1 and 0–100 scale formats cleanly. No issues in the diff. Flagging for PC review before merge — no ThankNIXlater/lekanbams sign-off yet.

@aldorizona10-glitch

Copy link
Copy Markdown
Author

Thanks for the review. I will keep this PR stable while it waits for PC review. If ThankNIXlater/lekanbams want any adjustment, I can patch it quickly.

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.

2 participants