Skip to content

fix(diagram): keep the reader's selection when opening a pathway from inside it - #236

Merged
adamjohnwright merged 2 commits into
mainfrom
fix/keep-selection-navigating-diagram
Sep 18, 2026
Merged

adamjohnwright merged 2 commits into
mainfrom
fix/keep-selection-navigating-diagram

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Reported by a curator on #168: "a searched entity is inselected if you try to
navigate to a new pathway within the diagram."

It is not the flag

Reproduced first, because the issue said both halves needed one. The flag works —
it survives and redraws against the new diagram:

before   /PathwayBrowser/R-HSA-70326?select=R-HSA-70171&flag=PKM    6 flagged
after    /PathwayBrowser/R-HSA-9856872?select=R-HSA-70326&flag=PKM  2 flagged

What does not survive is select: it goes from R-HSA-70171, what the reader
had chosen, to R-HSA-70326, the pathway they were leaving. A search leaves an
entity selected, so that is precisely the curator's report.

Why it did that

diagram.component.ts:843 set it deliberately, to orient the reader in the
diagram they arrived in:

queryParams: { select: this.pathwayId() },
queryParamsHandling: 'merge',

The sibling handler for .SUB.Pathway uses 'preserve' and touches nothing. So
the two ways out of a diagram disagreed, and only one of them discarded your work.

Why preserving wins

Where you came from is still one Back away. What you were looking at was not
recoverable at all. That asymmetry is the whole argument — and it also makes the
two navigation handlers behave the same, which is worth something on its own.

Proven to discriminate

without the fix:  Expected "R-HSA-70171", received "R-HSA-70326"
with the fix:     passes

Asserted on the address rather than on the handler, because select in the URL is
what survives a reload and what a curator can paste to a colleague.

Gates green: check:types, check:lint (652, unchanged), check:dead (145,
unchanged), format:check. diagram-behaviour.spec.ts re-recorded — 5 passed.

Refs #168. The second half of that issue — analysis reports not being emailed —
is untouched
, and I do not yet know whether delivery is this repo's job or the
analysis service's.

🤖 Generated with Claude Code

adamjohnwright and others added 2 commits September 17, 2026 21:29
… inside it

Reported by a curator: "a searched entity is inselected if you try to navigate to
a new pathway within the diagram" (#168).

Reproduced, and it is not the flag -- that survives and redraws:

    before  /PathwayBrowser/R-HSA-70326?select=R-HSA-70171&flag=PKM   6 flagged
    after   /PathwayBrowser/R-HSA-9856872?select=R-HSA-70326&flag=PKM 2 flagged

`select` went from what the reader had chosen to the pathway they were leaving.
The handler did that on purpose, to orient them in the diagram they arrived in --
and the sibling handler for `.SUB.Pathway` did not, so the two ways out of a
diagram disagreed and only one of them told you.

Where you came from is still one Back away. What you were looking at was not
recoverable at all, which is the asymmetry that settles it.

Asserted on the address rather than the handler, because `select` in the URL is
what survives a reload and what a curator can share. Proven to discriminate:

    without the fix: Expected "R-HSA-70171", received "R-HSA-70326"
    with the fix:    passes

The second half of #168 -- analysis reports not being emailed -- is untouched and
has no reproduction yet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…hout one

My own review of this change found the pattern I have been criticising all day in
the test I had just written:

    if (!target) { test.skip(true, 'no pathway box to open'); return; }

The recordings make this deterministic, so that branch should be unreachable. If
it ever fires it means the fixture changed underneath us -- and the test would
report green while checking nothing, which is exactly the failure mode this suite
keeps turning up elsewhere.

Asserted instead, so a missing pathway box is a red test with a sentence
explaining it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit b11c0e3 into main Sep 18, 2026
6 checks passed
@adamjohnwright
adamjohnwright deleted the fix/keep-selection-navigating-diagram branch September 18, 2026 01:44
adamjohnwright added a commit that referenced this pull request Sep 18, 2026
…#245)

`playwright.config.ts` had `reuseExistingServer: !process.env['CI']`, and this
host always has `serve-prod.js` on :4200 serving beta out of `dist/`. So a local
run tested the last deployed build rather than the commit about to be pushed.

It showed up as `diagram-behaviour.spec.ts:48` failing on a clean `main` while
CI was green on the same commit. The served build predated the fix that test
asserts by eight hours:

    dist/reactome/browser/index.html   2026-09-17 13:14:18
    b11c0e3 (#236, the fix asserted)   2026-09-17 21:43:58

Today's failure direction was harmless -- red on good code -- and it cost a
`--no-verify` push on a branch that was fine. The same mechanism passes on a
tree that is broken, which is the direction that matters.

E2E_PORT now asks for a server of our own. Preflight sets 4201, so it builds and
serves the tree under test while beta keeps 4200. A distinct port rather than
`reuseExistingServer: false`, because that aborts on "port already in use" and
would mean stopping beta before every push.

Measured, same two specs, same commit:

    reusing :4200 (beta's build)   1 failed, 21 passed
    own server on :4201           17 passed, 5 skipped, exit 0

The five new skips are the point rather than a loss. They are the
render-service tests, which skip with a reason when `/RenderService/health` does
not answer -- so `RENDER_TARGET=127.0.0.1:1` had been silently ineffective all
along. The reused server proxied to this box's real render service, so the local
smoke exercised the *present*-service path while its own comment said it existed
to reproduce CI's absent one. It now reproduces it, and matches CI, which has no
render service either.

Interactive runs keep the reuse: one `ng serve` with hot reload and many test
runs is the right trade while developing. It is only the gate that must not.

Refs #243

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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