Skip to content

Fix GARD NaN/zero-breakpoint display and library packaging - #905

Merged
stevenweaver merged 5 commits into
masterfrom
known-issues-gard-library
Nov 2, 2026
Merged

stevenweaver merged 5 commits into
masterfrom
known-issues-gard-library

Conversation

@stevenweaver

Copy link
Copy Markdown
Member

Follow-up to #904 (veg/hyphy#2039): fixes the remaining known issues found while debugging it.

GARD viewer

  • NaN Δ c-AIC tiles. The GARD notebook computes both tiles from bestModelAICc, which older HyPhy output (including our own demo data/json_files/gard/Flu.fna.GARD.json) doesn't have. New src/helpers/gardNotebook.js normalizes a copy of the result: bestModelAICc = baselineScore − Σ improvements.deltaAICc when missing (same formula as the legacy gard.jsx; matches HyPhy's own value exactly on 2.5.101/2.5.103 fixtures). Demo now shows 166.717 / 181.594.
  • Zero-breakpoint results showed "1 inferred breakpoints" (placeholder improvement entry) and Figure 4 threw on a single tree. The normalizer drops placeholder improvements, re-indexes un-indexed trees, and coerces string bps; makeTreeDivs is redefined behind an input-signature guard (same pattern as absrelNotebook.js, fix(absrel): render results that lack branch-site likelihoods (#888) #903). checkGardNotebook warns if the notebook cells it relies on change.
  • processData no longer mutates props.json (used by Export).
  • __tests__/gardNotebook.test.js: 13 tests with 2.5.103 fixtures.

Library packaging

  • Output collision: the app build (clean: true) and build:library both wrote dist/hyphyvision.js, so a publish could ship the app bundle. The library now builds to lib/ and main is lib/hyphyvision.js. The app stays in dist/, so server.js, DEPLOY.md and CI are unchanged. Added prepublishOnly: yarn build:library. Deep imports of hyphy-vision/dist/hyphyvision.js will no longer resolve; worth a minor version bump.
  • files listed css/min/map files the library build never emitted, and omitted the SVG asset the bundle references. Now matches npm pack output.
  • Host globals: the library config lacked the ProvidePlugin the app has, so hosts had to define $/jQuery/d3 globals. Now bound to the externals. README documents the remaining requirement (alias phylotree.css) with a minimal host webpack config.
  • Silenced the two no-console warnings in absrelNotebook.js.

Verification

  • Jest 51/51. build and build:library in both orders leave dist/ and lib/ intact.
  • Headless Chromium, production build, navbar Load from /: old-HyPhy GARD files show numeric tiles; 2.5.103 files unchanged (26.76 / 91.54); zero-breakpoint AA file shows 0 breakpoints and renders Figure 4; FEL/BUSTED/aBSREL samples still route and render; 0 console errors.
  • Embedded: minimal webpack host importing the packed tarball with no globals renders FEL and BUSTED with 0 errors.

Not changed

  • GARDResults summary text in gard.jsx ("up to N breakpoints", search-space %) is off for zero-breakpoint files; fixing it changes numbers for normal files, so left for a separate look.
  • HyPhy side (veg/hyphy): GARD.bf writes a different trees/bps shape when there are no breakpoints; default nucleotide GARD hits a ComputeBranchCache error on several test alignments in 2.5.101 and 2.5.103.

…g requirements

The library and app builds both wrote dist/hyphyvision.js, and the app build
cleans dist/, so a publish after build could ship the app bundle. The library
now builds to lib/ (main updated), package files lists only what it emits,
prepublishOnly runs build:library, and the README documents the host
requirements. Silence two intentional no-console warnings in absrelNotebook.
The library bundle used bare $ / d3 references (provided by ProvidePlugin in
the app build only), so an embedding host without those globals failed with
'$ is not a function'. Provide them through the external packages and
simplify the README host requirements accordingly.
lib/hyphyvision.js references a hashed SVG emitted alongside it; without it
in "files" the published package would have a broken asset URL.
@stevenweaver
stevenweaver merged commit 99a70ce into master Nov 2, 2026
3 checks passed
@stevenweaver
stevenweaver deleted the known-issues-gard-library branch November 2, 2026 21:51
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