Skip to content

[codex] Fix Fitbit redirect, import percentages, and print footer#496

Merged
elkimek merged 1 commit into
mainfrom
codex/fix-import-percent-and-print-footer
Jun 2, 2026
Merged

[codex] Fix Fitbit redirect, import percentages, and print footer#496
elkimek merged 1 commit into
mainfrom
codex/fix-import-percent-and-print-footer

Conversation

@elkimek
Copy link
Copy Markdown
Owner

@elkimek elkimek commented Jun 2, 2026

Summary

  • fix Fitbit hosted OAuth by sending the exact dev-console redirect URI https://app.getbased.health for the live host, without adding /app or a trailing slash
  • map differential percentage imports such as Lymphocytes % and Monocytes_PERCENTAGE to *Pct markers even when AI supplied the absolute-count key
  • keep unsupported differential percentages unmatched instead of overwriting absolute-count markers or stale same-name custom markers
  • keep generated report footers in normal print flow so they do not overlap PDF content
  • address Greptile review feedback around differential percent custom-marker precedence, duplicate suggestion computation, and Czech eosinophil/basophil fallback intent
  • bump version.js for cache invalidation

Validation

  • node tests/test-wearables.js
  • node tests/test-unit-import.js
  • live root callback check: https://app.getbased.health returns the app shell
  • direct differential import smoke check for lymphocyte/monocyte percentages
  • source-level report footer CSS regression check
  • git diff --check
  • ./run-tests.sh

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
get-based Ready Ready Preview, Comment Jun 2, 2026 5:21am

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Jun 2, 2026

Greptile Summary

This PR bundles four targeted fixes: a Fitbit OAuth redirect URI ordering bug, differential-percentage marker import mapping, a print/PDF footer CSS regression, and a version bump.

  • Fitbit redirect: The hosted /app redirect URI is prepended to the registered list so pickRedirectUri returns the exact-pathname match instead of falling back to the origin-root URI, fixing the wrong redirect sent during the OAuth flow on the live hosted route.
  • Differential percentage imports: New helpers (_suggestDifferentialPercentImportKey, _hasImportPercentHint, _hasImportAbsoluteHint, _differentialStemFromCompactBase) detect percentage-vs-absolute hints from rawName, unit, and the compacted label, then override AI-supplied absolute-count keys to the correct *Pct schema keys; markers whose *Pct key is not yet in the schema are left unmatched with suggestedKey set instead.
  • Print footer: Removes position: fixed from the @media print .report-footer rule (which caused PDF content overlap) and adds break-inside: avoid to keep the footer in normal document flow.

Confidence Score: 5/5

All four fixes are narrowly scoped and well-covered by new tests; no regressions are introduced in existing marker reconciliation paths.

The redirect fix is a one-line ordering change with a direct test assertion. The differential-percentage logic is cleanly isolated behind new helpers, the previous double-call concern has been resolved by passing the computed key as a parameter, and the _resolveExistingCustomImportKey guard flagged in an earlier review is now in place. The CSS change is a straightforward removal of position:fixed with a matching regression test. No logic errors, unsafe patterns, or unguarded paths were found.

No files require special attention.

Important Files Changed

Filename Overview
js/pdf-import-marker-mapping.js Adds differential-percent detection helpers and reworks reconcileImportMarkerMappings to redirect percentage-hinted markers to *Pct keys; logic is correct and the double-call issue from the prior review has been resolved by passing differentialPercentSuggestedKey as a parameter.
js/wearable-adapters.js Adds the hosted /app URI as the first Fitbit redirect URI so the exact-match branch in pickRedirectUri fires before the origin-root fallback.
js/export.js Removes position:fixed from the print-media report-footer and replaces it with break-inside:avoid, fixing PDF content overlap.
tests/test-unit-import.js Adds three new import markers and matching assertions covering percentage-remapping and unsupported-pct-stays-unmatched paths; seeds custom.eosinophilsLegacy to verify the guard on _resolveExistingCustomImportKey.
tests/test-wearables.js Adds two assertions covering the new Fitbit redirect URI ordering and pickRedirectUri behaviour for the /app pathname.
tests/test-export-import.js Adds two regression assertions: one checks position:fixed is absent from the print footer, the other verifies break-inside:avoid is present.
version.js Version bump from 1.8.339 to 1.8.343 for cache invalidation.

Reviews (2): Last reviewed commit: "Fix Fitbit redirect, import percentages,..." | Re-trigger Greptile

Comment thread js/pdf-import-marker-mapping.js Outdated
Comment thread js/pdf-import-marker-mapping.js Outdated
Comment thread js/pdf-import-marker-mapping.js Outdated
Comment on lines +353 to +356
if (compactBase === 'neutrofily' || compactBase === 'lymfocyty' || compactBase === 'monocyty' || compactBase === 'eosinofily' || compactBase === 'basofily') {
const pctKey = `differential.${differentialStem}Pct`;
return refLookup[pctKey] ? pctKey : null;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Czech-only fallback block silently extends eosinophil/basophil pct mapping

The old code returned null for 'eosinofily'/'basofily' without an absolute hint. The new block instead attempts refLookup['differential.eosinophilsPct']/'differential.basophilsPct'. Today those keys aren't in the schema so the result is still null, but a future schema addition would silently start mapping bare Czech names to pct markers without any percentage hint in the user's data. A clarifying comment or explicit guard for these two stems would make the intent clear.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@elkimek elkimek force-pushed the codex/fix-import-percent-and-print-footer branch from 8faefe4 to ccdc278 Compare June 2, 2026 05:13
@elkimek elkimek changed the title [codex] Fix import percentages and print footer [codex] Fix Fitbit redirect, import percentages, and print footer Jun 2, 2026
@elkimek elkimek force-pushed the codex/fix-import-percent-and-print-footer branch from ccdc278 to fdcaea0 Compare June 2, 2026 05:21
@elkimek elkimek merged commit 21d4e20 into main Jun 2, 2026
5 checks passed
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