Skip to content

Validate the resource-data WSI stack - #10

Closed
raylim wants to merge 83 commits into
codex/wsi-resource-datafrom
codex/wsi-rd-validation
Closed

raylim wants to merge 83 commits into
codex/wsi-resource-datafrom
codex/wsi-rd-validation

Conversation

@raylim

@raylim raylim commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Resource-data successor of #5, which stays on the native track. This is cross-repository validation for the resource-data WSI stack: backend cBioPortal#12378, Core cBioPortal/cbioportal-core#193, frontend cBioPortal/cbioportal-frontend#5732 and its children.

Pinned tuple (wsi-validation-manifest.json)

Input Pin
backend 065b4df5a8 (image-ID slide access)
Core 3e5bf6e (converter writes WSI_PATIENT_UNDATED_SLIDE_COUNT)
tile server 082c3f77
frontend package (cBioPortal#5732) e55244dae
study #17 8cd4460f6
patient cBioPortal#21 99990c8e6
molecular cBioPortal#18 4ad4b92c5
annotations cBioPortal#19 531063c4c
agent cBioPortal#20 50c61863f
integration cBioPortal#22 4c3f35428

What changed from #5

  • Fixtures. The legacy v3 meta_wsi/data_wsi are converter input only. The resource files and clinical counts are generated by the pinned Core converter; scripts/wsi_resource_fixtures.py regenerates them, diffs them against the committed copies, and validates them with 0 errors. The fixtures load no PATHOLOGY SLIDES events.
  • Seed and assertions. They use resource_definition/resource_data rows (WHOLE_SLIDE_IMAGE with wsi_serving) and the WSI count attributes, including the undated count. The native wsi_* tables must stay empty.
  • Spec. Access is /api/wsi/v2/resources/{study}/{patient}/access?imageId=, using image IDs from the hierarchy.
    • 401, 403 and 404 cases: another patient's image, the other study, an unknown image, and a non-WSI row.
    • A known patient without slides gets an empty 200.
    • Resource-table privacy: wsi_serving and s3:// never appear.
  • Parity test. Covers resource_data and schema section 3.5.0.
  • Pin check. scripts/check_wsi_validation_pins.py refuses placeholders and checks branch ancestry: every child contains the package, agent contains annotations, and integration contains all of them. The frontend matrix covers package, study, patient, molecular, annotations/agent and integration.

Known gaps

Verified locally

  • Converter and validator: 0 errors. --check matches the committed fixtures.
  • Parity test: passes.
  • The workflow YAML, manifest JSON and shell scripts pass their syntax checks.
  • Pin check: passes at HEAD, including all 12 ancestry checks.
  • tsc over the e2e specs passes.
  • A disposable ClickHouse loaded with the seed, plus the backend built from 065b4df5, run the spec: 8 passing, 2 pending (they need login and a frontend).

Only the workflow run proves authenticated mode, tile binding, the real import and re-import, and the frontend jobs.

🤖 Generated with Claude Code

raylim and others added 27 commits September 30, 2026 14:21
Replaces the native wsi_* table parity checks with resource_data checks: the
same columns and (CANCER_STUDY_ID, RESOURCE_ID, PATIENT_ID, SAMPLE_ID,
RESOURCE_DATA_ID) nullable sorting key in init/schema.sql and the 3.5.0
migration section, resource_definition present, the legacy split resource
tables backfilled and dropped, and schema.sql/pom db.version at the final
migration version (3.5.0). A single cheap check keeps the native wsi_* tables
created but unread by the WSI mappers. Runs standalone or under pytest.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…essors

Manifest and workflow now pin backend 6449a64 (codex/wsi-resource-data,
db 3.5.0), Core 1fef1034 (converter + resource validator), tile 082c3f77,
frontend package a5f3d4fe (codex/wsi-viewer-package, which now carries the
patient pathology views) and study c55bc8d8. molecular, annotations, agent
and integration are TODO-successor placeholders with a _note.

scripts/check_wsi_validation_pins.py replaces the inline fixture-contract
check: every manifest pin must be a full SHA, workflow env/matrix refs must
match the manifest, the matrices must list exactly package, study,
molecular, annotations-agent and integration (no separate patient child), and
the fixture layout must be generated resource files with the legacy pair
only under legacy_wsi_source/. Any placeholder is a hard failure, and each
frontend/full-stack job also refuses placeholders before checking out.

Jobs:
- fixture-contract: pin check, then regenerate the fixtures from the pinned
  Core, diff against the committed copy and validateData.py them.
- core-import-validation: resource_data schema parity against the pinned
  backend, conversion + validateData.py (0 errors), legacy meta_wsi rejected,
  unit_tests_convert_wsi.py, the WSI/resource validator tests, and the
  TestImportResourceData integration test (replacing -k wsi only /
  ImportWsiDataTest).
- frontend-children / full-stack matrices collapsed to the five variants;
  the annotations-agent row checks out the agent pin and requires the
  annotations pin as an ancestor; every child must contain the package pin.
- combined-frontend verifies the integration pin contains every child pin.
The acceptance gate is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…stack run

run_wsi_full_stack_validation.sh imports the converted fixture studies and
checks, per study: two WSI resource definitions, the WSI_SAMPLE
(sample-matched) and WSI_PATIENT (unmatched, SAMPLE_ID NULL) row counts of
TYPE WHOLE_SLIDE_IMAGE, the rows carrying a wsi_serving source, that every
row has a wsi_serving object, and that the native wsi_* tables stay empty.
Study removal must leave no resource_data/resource_definition rows, and the
reimport must restore the same counts. The expected values were checked
against the CI seed in a disposable ClickHouse 24.8.

Variants follow the collapsed matrix (package, study, molecular,
annotations-agent, integration); the annotations/agent browser contract is a
TODO-successor placeholder and those variants exit non-zero until it is
defined. BACKEND_FOUNDATION_REF becomes BACKEND_REF.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The fixture README now explains the legacy-input -> Core converter ->
resource files -> import flow, the WSI_SAMPLE/WSI_PATIENT rows and their
private wsi_serving object, the regenerate/check/validate commands, the
slide-less patient, the resourceId/resourceDataId-based access endpoint and
the resource-table privacy assertion. The compose override and the local
stack helper note that only converted resource-data studies are imported.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
WsiPart is serialized without null fields, so a part whose converted METADATA
has no subspecialty carries no subspecialty key; the fixture added in the
previous spec commit expected "subspecialty": null. Found by running the spec
against the resource-data backend (6449a64 classes) on a disposable
ClickHouse 24.8 loaded with init/schema.sql and wsi_hierarchy_ci_seed.sql:
all 8 non-tile cases then pass in local-bypass mode.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…gy timeline

Core 3e5bf6e also writes the patient attribute WSI_PATIENT_UNDATED_SLIDE_COUNT
(viewable slides without a procedure day): 1 for P-0055908 (3020649), 0 for
the control patient, whose undated slide is not viewable. The seed gains the
attribute and its values.

Studies no longer load a PATHOLOGY SLIDES clinical-event file. The v3
fixtures carry timing on every row, so the timeline file is not needed as
converter input either: it is removed from legacy_wsi_source/ (and so from
the generated study), the unreferenced top-level copy is removed, and the
seed's PATHOLOGY SLIDES clinical_event rows are dropped.

The seed also adds a WHOLE_SLIDE_IMAGE row with a complete wsi_serving
object under a non-WSI resource (WSI_CI_OTHER_SLIDES, image
wsi-ci-other-slide), so image-ID access can be shown to ignore rows outside
WSI_SAMPLE/WSI_PATIENT.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Backend 065b4df replaced the /{resourceId}/{resourceDataId}/access path
with GET /api/wsi/v2/resources/{studyId}/{patientId}/access?imageId=...
The spec now requests capabilities with the hierarchy's imageId. 401
(anonymous, real slide) and 403 (denied study's servable slide) are kept;
the 404 cases are an image of another patient in the same study, an image of
another study's patient, an unknown image, and the seed's WHOLE_SLIDE_IMAGE
row outside the WSI resources. The resource-table privacy check also covers
that non-WSI resource when present. The expected hierarchy still carries
resourceId, and resourceDataId is still asserted and stripped.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…173c48e; add the patient child

Manifest and workflow pin backend 065b4df (image-ID slide access), Core
3e5bf6e (undated patient count), frontend package 59df2b206 (viewer package
and Pathology Slides tab only) and study 173c48e5b (rebased onto it).

The patient timeline and Clinical Data presentation left the package branch,
so a new patient child (codex/wsi-rd-patient) is a TODO-successor
placeholder alongside molecular, annotations, agent and integration. It has
rows in the frontend-children and full-stack matrices, integration must
contain it, and the pin check fails on it like any other placeholder. The
package row's jest list is trimmed to the specs that remain on that branch.

The full-stack run also checks WSI_PATIENT_UNDATED_SLIDE_COUNT (1 for the
public patient, 0 for the control) and that no PATHOLOGY SLIDES events are
loaded; the patient variant fails closed until its browser contract exists.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…d timeline

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Replaces every TODO-successor placeholder. Frontend pins (raylim/cbioportal-frontend):
package e55244dae (codex/wsi-viewer-package, cBioPortal#5732), study 8cd4460f6,
patient 99990c8e6, molecular 4ad4b92c5, annotations 531063c4c, agent
50c61863f (contains annotations) and integration 4c3f35428 (package + study
+ patient + molecular + agent). Ancestry was checked locally, and
check_wsi_validation_pins.py now repeats it when WSI_FRONTEND_GIT_DIR points
at a frontend clone. The pin check passes at HEAD; a placeholder still fails.

Child contracts (every listed file checked at its pin):
- package: viewer package suite + WsiPatientViewRoute, wsiAppConfig,
  assertWsiOsdBundle; foundation mock.
- study: ClinicalDataTab, FilesAndLinks, ClinicalAttributeDisplay,
  ResourcePolicy; pathology-study-clinical-data.
- patient: package suite + pathologySlidesTimeline, pathologySlidesTimelineLoader,
  PatientWsiSlidesTab, UndatedPathologySlidesNotice, WsiPatientViewRoute;
  foundation mock. The child has no Playwright spec (known gap, noted in the
  manifest).
- molecular: package suite + wsiOncoKbClientInstance, wsiAppConfig;
  wsi-molecular-mocked.
- annotations-agent: package suite + MSKTabs, wsiAppConfig, assertWsiOsdBundle;
  wsi-annotation-agent and the changed wsi-foundation-route.
- integration and combined-frontend: the union.

The full-stack variants use the same lists. The package now shows the
Pathology Slides tab only when WSI_PATIENT_SLIDE_COUNT > 0 or it is active,
so the full-stack run asserts the imported count (4 for P-0055908, 3 for the
control) and that the slide-less patient has no count row. The stale
WSI_TIMING_* browser env is dropped, since no spec at the pins reads it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…kend

- Frontend pins follow the children rebased onto cBioPortal#5732 at 2e4897f63, which
  now also keeps slide resources out of the study Files & Links fetch. The
  patient child mocks the clinical events its viewer route loads.
- TestImportResourceData failed its schema check: Core's pom pins a
  backend without resource_data. Pass -Dcbioportal.schema.path pointing
  at the pinned backend's init schema, as the local runs do.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… data

cBioPortal#5732 now gates the Pathology Slides tab on the patient's WSI hierarchy
(no Core-written attribute), leaves slide resources out of Files & Links
and resource tabs, and hands the clinical timeline hover fix to the
patient child. Children and the integration branch are rebased onto it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The full-stack variants serve a dev build. When the chunk-retry test
fails the OpenSeadragon chunk on purpose, webpack-dev-server's error
overlay intercepts the Retry click and the test times out. The
frontend-children jobs still run it against the production build.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ortal sample data

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The comment sat inside the backslash-continued command, so the
environment assignments before it ran as their own command and
PLAYWRIGHT_JSON_OUTPUT_NAME never reached Playwright; the JSON report
went to stdout and the report check failed. Move the note above the
subshell.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Add the study-slides frontend child (raylim/cbioportal-frontend#23,
7a214dc) as a frontend-children and full-stack variant. Its unit row
runs the study-slides store and tab specs; its browser contract,
wsi-study-slides-mocked.spec.ts, mocks the study and WSI APIs, because
the pinned backend has no study-slides endpoint. Repin integration to
307ff9a (integration + study slides), whose rows now also run those
specs.

The backend child (#11, 2e99ead) is recorded under
backendChildren in the manifest, not checked out; the pin checker
requires its ref to be a full SHA and checks that integration contains
the study-slides child.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…lides

- package f480cf2: hideable slide list and image details panels, shared
  viewer theme; merged into every child
- patient c0651e3: the undated notice counts from the timeline's slide
  hierarchy instead of WSI_PATIENT_UNDATED_SLIDE_COUNT
- study-slides f25f42d (backend child 7b2ee02): restyled tab, paging
  feedback, hideable patient list, viewable slides only
- study 05430c2, molecular 210693a, annotations 1dafe19, agent 685b16c,
  integration b69bde3

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- study-slides frontend 1cfc8ad and backend child 06680ee: clinical facets, specimen match, search
- integration d9376d2

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- package 9564886: light entry drops exports no host uses
- patient: typed PATHOLOGY SLIDES event details and the
  cbioportal-wsi-viewer/events entry (timeline no longer loads the viewer)
- every child and integration merged with the new package

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Frontend heads: cBioPortal#5732 adds the Clinical section and collapsible details
sections; every child and integration merge it, and molecular,
annotations and agent give their sidebar boxes section ids.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
cBioPortal#5732 now mocks the clinical-data requests in the foundation browser
contract and checks the Clinical section; every child and integration
merge it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
cBioPortal#5732 trims the image and pathology rows and leaves QC, administrative
and consent attributes out of the Clinical section; molecular also leaves
out the attributes its MSK-IMPACT section shows. Every child and
integration merge it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…the package README

- package b7a25b4: clinical data in collapsible viewer sidebar sections,
  trimmed details sidebar, legacy H&E resources hidden by ID only, and
  a package README
- every child and integration merged with it; patient also documents
  the events entry

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- backend f1de815: File-Formats documents the non-filterable
  CUSTOM_METADATA contract for the WSI definitions
- Core dfd3549: the converter writes that contract
- package 509caad: the tab gate and viewer share one hierarchy request
  (no `no-store`), one OpenSeadragon viewer is reused across slide changes
  when it has no tile requests left, sidebar rows come from the page's
  data for a single-study cohort, thumbnails survive token refresh, the
  metadata prefetch is limited to three slides, token refresh pauses
  while hidden, and the bundle check fails on OpenSeadragon in an
  initial bundle
- every child and integration merged with it; molecular also stops
  sample enrichment on dispose, and the molecular, agent and annotation
  specs follow the viewer reuse and the bundle check
- backend child study-slides merged with the backend pin

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The pinned converter now writes a CUSTOM_METADATA contract on the WSI
definitions (per-slide identifier keys non-filterable); regenerated with
scripts/wsi_resource_fixtures.py --write.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@raylim

raylim commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

Closing: obsolete pre-v6 validation (imageId access, native wsi_* table checks, timing assertions). A fresh v6 validation PR can replace it if needed.

@raylim raylim closed this Oct 9, 2026
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