Skip to content

feat(visualization): add Phase 6.11 testing and documentation pass - #39

Merged
dsk-dev-ai merged 1 commit into
mainfrom
feat/visualization-testing-docs
Aug 17, 2026
Merged

feat(visualization): add Phase 6.11 testing and documentation pass#39
dsk-dev-ai merged 1 commit into
mainfrom
feat/visualization-testing-docs

Conversation

@dsk-dev-ai

@dsk-dev-ai dsk-dev-ai commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Summary

Completes Phase 6.11 — Visualization Testing & Documentation.

This PR performs the stabilization pass for the GenomeAI visualization platform by expanding regression coverage, validating visualization data contracts, auditing accessibility, and aligning the visualization documentation with the implemented system.

What changed

Testing

  • Expanded visualization component test coverage.
  • Added regression coverage for visualization loading, empty, and error states.
  • Added coverage for user interactions and important boundary conditions.
  • Added API/data-loader contract tests.
  • Added Genome Browser regression coverage.
  • Added Integrated Research Workspace regression coverage.
  • Added visualization performance regression tests.
  • Added accessibility-focused tests.
  • Preserved existing tests and assertions.

Genome Browser

Validated:

  • Chromosome handling
  • Genomic region parsing
  • Coordinate validation
  • Viewport behavior
  • Track loading
  • Empty track states
  • Track errors
  • Abort/cancellation behavior
  • Deterministic geometry behavior
  • Large-region behavior
  • Phase 6.10 downsampling behavior

Research Workspace

Validated:

  • Shared research context
  • Preset genomic regions
  • Custom region navigation
  • Context synchronization
  • Independent panel state
  • Loading states
  • Empty states
  • Error states
  • Retry behavior
  • Accessibility behavior
  • Workspace data-source boundaries

Performance

Added regression coverage for the Phase 6.10 performance mechanisms, including:

  • Deterministic downsampling
  • Bounded rendering
  • Peak preservation
  • Outlier preservation
  • Heatmap aggregation
  • Expression data reduction
  • Volcano plot reduction
  • Distribution data reduction

Performance tests use deterministic assertions rather than unstable timing thresholds.

Accessibility

Reviewed and improved:

  • Semantic controls
  • Accessible labels
  • Keyboard interaction
  • Focus behavior
  • ARIA attributes
  • Live announcements
  • Error/alert semantics
  • Form labels
  • Button accessibility

Documentation

Updated visualization documentation to accurately reflect the implemented architecture and current capabilities.

Documentation covers:

  • Visualization architecture
  • Data flow
  • Visualization modules
  • API/data-source boundaries
  • Genome Browser usage
  • Research Workspace usage
  • Performance strategy
  • Testing strategy
  • Accessibility expectations
  • Current limitations
  • Extension guidelines

Updated the Phase 6 visualization roadmap to reflect the current implementation status.

Scope

This PR is a stabilization and documentation milestone.

It does not introduce a new visualization architecture or begin Phase 6.12.

No:

  • C++
  • WebAssembly
  • WebGPU
  • Three.js
  • Cytoscape.js
  • D3.js
  • Unnecessary runtime dependencies
  • Phase 5 search/backend changes

were introduced.

Existing visualization components, data contracts, performance mechanisms, and architecture remain the foundation.

Validation

The following validation was completed:

  • make setup
  • make lint
  • make typecheck
  • make test
  • pnpm turbo build
  • Web development server verification
  • Visualization route verification
  • Final diff review

Verified visualization routes include:

  • /
  • /visualization
  • /visualization/workspace

Phase

Phase 6.11 — Visualization Testing & Documentation

Next

After this PR is merged, the next milestone is:

Phase 6.12 — Molecular Structure Viewer

Phase 6.12 will be handled separately and will introduce the planned molecular 3D visualization capability.

Summary by Sourcery

Stabilize the Phase 6 visualization platform with expanded regression coverage, API and viewport edge-case handling, and aligned testing and documentation.

Bug Fixes:

  • Fix genome viewport panning to clamp start positions at base 1 when windows exceed contig length.

Enhancements:

  • Broaden scientific, genome, and workspace chart tests to cover downsampling, statistics, coordinate parsing, viewport behavior, data lifecycles, and accessibility for chart primitives and panels.
  • Strengthen Genome and advanced scientific API adapters with pagination, abort, normalization, and error-handling regression tests.
  • Add visualization catalog and chart sizing tests to validate data contracts, latency/abort semantics, and responsive behavior.
  • Refine Research Workspace layout and behavior so panel loading states, whole-dataset independence, and context synchronization are covered by tests.

Documentation:

  • Update visualization architecture, roadmap, module descriptions, and per-module docs to reflect delivered Phase 6.2–6.11 capabilities, performance work, and test counts, and add a dedicated testing guide.

Tests:

  • Add and extend unit and integration tests across visualization, genome, scientific, and workspace modules, increasing deterministic coverage for edge cases, lifecycles, and accessibility semantics.

- Grow the web test suite from 725 to 813 tests: foundation (module
  catalog, useChartSize), genome (region/viewport/tracks/useGenomeBrowser/
  api boundaries), scientific (downsample, statistics, advancedApi,
  selection/stale-error lifecycle), chart primitives, and workspace
  (loading, error, panel-independence) coverage
- Fix panViewport producing a start below base 1 when a window wider than
  the contig pans right
- Reconcile docs with the shipped platform (README, roadmap, architecture,
  module docs, module catalog) and add docs/visualization/testing.md
- Suppress hydration warnings for browser-extension-injected body attributes
- Give Gene/Transcript and Protein workspace panels full grid width
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@sourcery-ai

sourcery-ai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Reviewer's Guide

Phase 6.11 performs a stabilization and documentation pass over the GenomeAI visualization platform by expanding deterministic test coverage across downsampling, genome browser, scientific charts, workspace, and API adapters, fixing a pan-viewport clamping bug, adding tests for previously untested visualization modules and chart primitives, and reconciling the visualization docs/roadmap and demo catalog with the shipped Phase 6.2–6.11 platform.

Sequence diagram for debounced Genome Browser track loading with abort

sequenceDiagram
  participant GenomeBrowserComponent
  participant useGenomeBrowser
  participant useGenomeTrack
  participant TrackLoader as loader
  participant AbortController

  GenomeBrowserComponent->>useGenomeBrowser: useGenomeBrowser({ initialViewport, debounceMs })
  useGenomeBrowser-->>GenomeBrowserComponent: { viewport, debouncedViewport, zoomIn }

  GenomeBrowserComponent->>useGenomeTrack: useGenomeTrack(definition, debouncedViewport)
  useGenomeTrack->>TrackLoader: loader(interval, signal)
  activate TrackLoader

  GenomeBrowserComponent->>useGenomeBrowser: zoomIn()
  GenomeBrowserComponent->>useGenomeBrowser: zoomIn()
  GenomeBrowserComponent->>useGenomeBrowser: zoomIn()
  useGenomeBrowser->>useGenomeTrack: debouncedViewport (after debounceMs)

  useGenomeTrack->>AbortController: abort()
  deactivate TrackLoader

  useGenomeTrack->>TrackLoader: loader(newInterval, newSignal)
  activate TrackLoader
  TrackLoader-->>useGenomeTrack: []
  deactivate TrackLoader
  useGenomeTrack-->>GenomeBrowserComponent: status = "empty"
Loading

File-Level Changes

Change Details Files
Expand deterministic edge-case coverage for scientific downsampling, aggregation, and statistics utilities.
  • Add decimateItems tests for exact-cap, empty, negative, and small limits with first/last preservation guarantees.
  • Add coverageColumns tests for non-positive limits, exact-limit passthrough, single-bucket peak preservation, chromosome merging semantics, sorted output, and negative-pixel clamping.
  • Add aggregateHeatmap tests for non-positive limits, single-axis aggregation, NaN/Infinity handling, ragged blocks/rows, and metadata propagation.
  • Extend quantile/summarize/boxPlotWhiskers tests for R-7 interpolation, single-element samples, non-finite value filtering, outliers, and degenerate whiskers.
apps/web/src/lib/scientific/downsample.test.ts
apps/web/src/lib/scientific/statistics.test.ts
Harden genome browser viewport, region parsing, track layout, and API contracts with additional tests and a panViewport clamp fix.
  • Add useGenomeBrowser tests for pan-right/reset behavior and bounded vs unbounded navigation semantics.
  • Extend useGenomeTrack tests for empty-track status, debounce collapse into single refetch, and aborting in-flight requests on region change.
  • Add Genome API tests for variant/gene normalization edge cases and new requestCoordinateSearch pagination, cap, page-size, and abort behavior.
  • Expand parseGenomeRegion tests for single-base intervals, safe-integer bounds, zero/overflow rejection, whitespace, chromosome normalization, and malformed formats.
  • Extend tracks tests to cover inclusive stacking at touching ends, deterministic tie-breaking, row y-offsets, empty feature handling, and DEFAULT_TRACK_CONFIG defaults.
  • Fix panViewport to clamp start to base 1 when the window is wider than the contig, and add tests for negative/NaN zoom factors and bounds preservation in both zoomViewport and panViewport.
apps/web/src/lib/genome/useGenomeBrowser.test.tsx
apps/web/src/lib/genome/api.test.ts
apps/web/src/lib/genome/region.test.ts
apps/web/src/lib/genome/tracks.test.ts
apps/web/src/lib/genome/viewport.test.ts
apps/web/src/lib/genome/viewport.ts
Add and extend tests for advanced scientific API adapters, volcano plot hook lifecycle, chart sizing hook, and chart primitives.
  • Add advancedApi tests for fetchHeatmapDataset/Volcano/Coverage/Distribution adapters, asserting URL construction, normalization, typed GenomeApiError behavior, abort propagation, and invalid-payload handling.
  • Extend useVolcanoPlot tests to clear selection on dataset reload and when passed null.
  • Introduce useChartSize tests covering default/custom fallback widths, ResizeObserver vs clientWidth measurement paths, zero-width guard, resize updates, and observer cleanup.
  • Add ChartPrimitives tests for ChartAxes (gridlines, labels, formatting), ChartLegend (list semantics, empty behavior), and ChartTooltip (content rendering and on-screen clamping via TOOLTIP_WIDTH).
apps/web/src/lib/scientific/advancedApi.test.ts
apps/web/src/lib/scientific/useVolcanoPlot.test.tsx
apps/web/src/lib/scientific/useChartSize.test.tsx
apps/web/src/components/scientific/ChartPrimitives.test.tsx
Strengthen visualization foundation and workspace data lifecycle tests, including error/empty/refetch semantics and panel independence, and adjust layout.
  • Extend useVisualizationData tests for stale-error suppression after a newer success, normalization of string/object rejections, and clearing data during refetch.
  • Add visualizationModules tests capturing catalog IDs/titles/milestones, fresh-copy semantics, configured delay/failure, and AbortSignal behavior (already-aborted and mid-flight).
  • Extend ResearchWorkspace tests for panel loading state semantics and ensuring whole-dataset panels (network/protein) do not refetch on context region changes.
  • Adjust ResearchWorkspace layout grid so GeneTranscriptPanel and ProteinPanel span two columns on large screens for better composition.
apps/web/src/lib/visualization/useVisualizationData.test.tsx
apps/web/src/lib/visualization/visualizationModules.test.ts
apps/web/src/components/workspace/ResearchWorkspace.test.tsx
apps/web/src/components/workspace/ResearchWorkspace.tsx
Reconcile visualization documentation, roadmap, and demo catalog with the implemented Phase 6.2–6.11 platform, and add a testing guide.
  • Update visualization roadmap to mark 6.11 as current, describe the stabilization/testing pass, reflect increased test counts per module, and move 6.9 under previous milestones.
  • Update visualization README to mark 6.11 as implemented, summarize Phase 6.11 deliverables, add a Testing doc link, and mention suite size and deterministic tests.
  • Revise architecture, genome/protein/network/scientific/variant/workspace docs to reference Phase 6.10 performance work, measured future options instead of "deferred to 6.9", expanded tests, and workspace test counts.
  • Add dedicated Testing guide documenting coverage map, conventions (behavior-focused, deterministic, abort handling), and how to run the suite.
  • Expand visualizationModules catalog with entries for advanced scientific charts, integrated workspace, performance, and testing/documentation milestones, and adjust comments to describe delivered modules; update VisualizationDemo and /visualization route metadata text to match.
  • Enable suppressHydrationWarning on the root html/body elements to avoid hydration warnings during SSR/CSR mismatch scenarios.
docs/visualization/roadmap.md
docs/visualization/README.md
docs/visualization/architecture.md
docs/visualization/workspace.md
docs/visualization/advanced-scientific-charts.md
docs/visualization/protein-viewer.md
docs/visualization/genome-browser.md
docs/visualization/network-viewer.md
docs/visualization/scientific-charts.md
docs/visualization/variant.md
docs/visualization/testing.md
apps/web/src/lib/visualization/visualizationModules.ts
apps/web/src/app/visualization/page.tsx
apps/web/src/app/visualization/VisualizationDemo.tsx
apps/web/src/app/layout.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 94f898b5-fc4a-4d66-93cf-a3c04e94e53a


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • There are multiple ad-hoc jsonResponse/rawFetch helpers and global fetch overrides in different test files; consider centralizing these into a shared test utility to reduce duplication and make teardown behavior consistent.
  • For tests that patch globals like ResizeObserver or fetch, double-check that every file restores the original in afterEach (as done in advancedApi.test.ts and useChartSize.test.tsx) to avoid subtle cross-test coupling.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- There are multiple ad-hoc `jsonResponse`/`rawFetch` helpers and global `fetch` overrides in different test files; consider centralizing these into a shared test utility to reduce duplication and make teardown behavior consistent.
- For tests that patch globals like `ResizeObserver` or `fetch`, double-check that every file restores the original in `afterEach` (as done in `advancedApi.test.ts` and `useChartSize.test.tsx`) to avoid subtle cross-test coupling.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dsk-dev-ai
dsk-dev-ai merged commit c16bf44 into main Aug 17, 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