feat(structure-viewer): add ted domain coloring - #405
Conversation
| type: isBinary ? 'application/octet-stream' : 'text/plain', | ||
| }); | ||
| const blobUrl = URL.createObjectURL(blob); | ||
| const tedDomains = await tedDomainsPromise; |
There was a problem hiding this comment.
[P1] Bound the optional TED request
The TED promise is awaited unconditionally after the model file is ready. If the AlphaFold TED endpoint accepts the request but never settles, StructureService.loadStructure never returns, so the viewer remains on “Loading protein structure...” even though the prediction and CIF fetches completed. I reproduced this with a never-resolving response only for /api/domains/: after 250 ms the load was still pending while both primary fetches had completed.
Because TED is specified as optional and must not regress structure viewing, please give this sidecar request an AbortSignal/timeout and map timeout to an empty domain list, or otherwise stop gating the primary structure result on unbounded completion. A stalled-request regression test would protect this behavior.
There was a problem hiding this comment.
Fixed in 96f25e4. The optional TED request now races a five-second fallback to an empty domain list and receives an AbortSignal that is aborted on timeout, so StructureService.loadStructure returns the completed primary structure even if the sidecar fetch never settles. Added a stalled-request regression that advances virtual time, verifies the structure result resolves with tedDomains: [], and verifies the TED signal is aborted. Fresh focused tests, the full workspace suite, strict OpenSpec validation, browser QA, pnpm precommit, and the bundle contract all pass locally.
Automated reviewDoes it solve #341? Yes — the web structure viewer now fetches AlphaFold DB's Found 3 issues:
protspace/packages/core/src/components/structure-viewer/structure-viewer.ts Lines 295 to 311 in 96f25e4
protspace/docs/explore/structures.md Lines 18 to 31 in 96f25e4 🤖 Generated with Claude Code |
|
Independent triage at current head
No code or PR-state changes were made as part of this triage; follow-up implementation is needed for all three. |
|
Implemented all three actionable items in
Fresh verification: focused component tests 5/5; |
- Drop the local `colorViewer` cast that re-declared `setColorTheme` as optional even though `MolstarViewer` already requires it, and call `viewer.setColorTheme(...)` directly without optional chaining. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016qoU16kDQxz6U3H2UWbbm2
Adversarial reviewReviewed in an isolated worktree by three independent lenses (code quality, adversarial correctness, issue-resolution audit), with every finding then put through a refuter whose default position was that it is a false positive. 8 raised, 3 survived refutation. Applied and pushed (
|
|
Addressed the substantive items from the adversarial review in
Verification on the committed tree: focused structure-viewer tests 9/9, full |
Summary
Root cause
The structure-loading path fetched only the AlphaFold mmCIF and the Mol* adapter exposed no representation-theme API. TED annotations live at a separate AlphaFold DB endpoint, so the viewer had neither residue ranges nor a control capable of applying domain colors.
Reproduction
After this change, pLDDT remains the default, TED domains is enabled for the live three-domain response, selecting it colors all domain segments categorically, unassigned residues are gray, and switching back restores pLDDT without reloading the structure.
Tests
Closes #341