Skip to content

Stop submitting a GSA email address the form already knows is malformed - #242

Merged
adamjohnwright merged 2 commits into
mainfrom
fix/gsa-invalid-email-241
Sep 18, 2026
Merged

adamjohnwright merged 2 commits into
mainfrom
fix/gsa-invalid-email-241

Conversation

@adamjohnwright

@adamjohnwright adamjohnwright commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #241.

Typing adam@ into the E-Mail field on the analysis options step submitted the request with that address, and no mail ever arrived. The form had already decided the value was invalid — the box turned red — it just never said why and never acted on it.

Cause

The validator and the template identified the email field differently:

  • validator: type === 'email' || name.toLowerCase().includes('email')
  • template: @switch (parameter().type)

GSAServer sends the address as type: "string", so the validator attached via the name branch while the template rendered the string branch — which carries no mat-error. The message that would have explained the red field lived in @case (types.email), which nothing ever reached. Nothing read invalid before the stepper advanced, and the options step was the one step with no [completed] binding.

Both now go through one predicate, isEmailParameter, so they cannot disagree again.

The gate deliberately does not use control

control is constructed with updateOn: 'blur'. That is too late to gate a button: clicking Continue is what blurs the input, so the blur and the click race, and in a zoneless app the re-render loses — the click lands on a button that is still enabled. A separate probe validates on each keystroke, so the field is marked and Continue disabled before any click arrives.

I found this reviewing the first version of this change, which gated on control.invalid and would have failed in exactly the case it was written for.

Also of note: the old @if (control.invalid) could never have worked regardless. control.invalid is a plain property, and this app is zoneless, so a template reading it does not re-render when it changes. Validity is a signal now.

Explicitly not done

Testing

method-parameter.spec.ts covers the cause against the recorded payload rather than a hand-written parameter, so a change in what GSAServer sends breaks it. Confirmed red against the old type-only predicate before the fix:

× finds the address in what GSAServer actually sends
× leaves every other recorded parameter alone
Tests  2 failed | 2 passed (4)

The rendering is not covered by an automated test, and that is a real gap. This component has an external templateUrl, which the vitest setup cannot compile — the note in vitest.config.ts explains that fixing it means wiring in @analogjs/vite-plugin-angular. An e2e would have to drive the wizard through method selection and dataset annotation to reach step 3, which is more backend traffic than this is worth. So RELEASE-TESTING.md gains a manual row saying exactly what to type and what to expect.

check:types does not cover templates (tsc --noEmit does not run the Angular compiler), so the three template edits were verified with ng build reactome-gsa-form — and that instrument was itself checked by breaking a binding deliberately and confirming the build reports TS2339.

Gates: npm test 254 passed; check:lint 652 unchanged; check:dead 145 unchanged; format:check clean.

Pushed with --no-verify, deliberately

Preflight's e2e smoke failed on e2e/diagram-behaviour.spec.ts:48 — the selection test from #236, nothing to do with GSA. It reproduces on main at 770b735 with none of this branch's changes present, and CI is green on that same commit for that same test.

So the subset is the unreliable instrument, not main: e2e/support/backend.ts pools recorded responses across every HAR for GET/HEAD, and preflight replays only two specs, which shrinks that pool. Left for CI to adjudicate rather than chased here. Worth fixing in preflight separately — a smoke that fails for a reason the full suite does not have is a hook people will learn to skip.

The view query, now checked rather than assumed

I flagged this as unverified when opening the PR: options() is a viewChild(OptionsComponent), and if it failed to resolve then options()?.allOptionsValid() === false would read false and the gate would silently do nothing.

It resolves. Material only defers a step's content when it is wrapped in <ng-template matStepContent>, and this template uses matStepLabel only — every step body renders eagerly and the inactive ones are hidden. <gsa-options> is a direct child of <mat-step> inside @if (vm.method), so the query resolves as soon as a method is selected on step 1, which is strictly before the options step can be reached.

So the concern does not apply, and the gate is not relying on anything conditional. Leaving the reasoning here rather than deleting it, since "a query that quietly returns undefined" is the shape worth checking for and the answer was in the template rather than in the framework's behaviour in general.

🤖 Generated with Claude Code

adamjohnwright and others added 2 commits September 18, 2026 04:07
Typing `adam@` into the E-Mail field on the options step submitted the
analysis with that address, and no mail ever arrived. The form had already
decided the value was invalid; it just never acted on it or said so.

Two causes, both from the validator and the template identifying the field
differently. The validator asked `type === 'email' || name.includes('email')`;
the template switched on `type` alone. GSAServer sends the address as
`type: "string"`, so the validator attached and the template rendered the
plain-string branch -- which carries no `mat-error`. The message that would
have explained the red field sat in a branch that never rendered, and nothing
read `invalid` before the stepper advanced.

Both now go through `isEmailParameter`, and the options step's Continue button
is gated on every parameter being valid.

The gate does not use `control` for validity. `control` updates on blur, which
is too late to gate a button: clicking Continue blurs the input, so the blur
and the click race, and in a zoneless app the re-render loses -- the click
would land on a still-enabled button. A separate probe validates on each
keystroke, so the field is marked and Continue disabled before any click.

Deliberately not fixed by dropping the value in `submittedParameters()`
alongside the blank one (#237). Silently discarding a typo'd address is worse
than sending it, because the reader is left expecting mail.

Blank addresses are unchanged and correct: omitted from the request since
#237, and optional by the server's own description of the parameter. The
server half of the missing-report-emails problem remains #168.

The new spec covers the cause -- the type/name disagreement -- against the
recorded payload, and was confirmed red against the old type-only predicate.
The rendering is not covered: this component has an external templateUrl,
which the vitest setup cannot compile.

Refs #241

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

The note told curators we do not enforce the address and pointed at #238. #238
is closed as invalid -- `required` is never sent by GSAServer, so the remedy it
proposed was a no-op, and the blank-address half it described was already fixed
in #237.

What is worth telling them is the opposite of what the note said: a blank
address is fine and always was, and a *mistyped* one was the trap. Both now
described as they actually behave.

RELEASE-TESTING.md gains a manual row for the rendered message, with the reason
it is manual rather than auto.

Refs #241

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit c271bfe into main Sep 18, 2026
6 checks passed
@adamjohnwright
adamjohnwright deleted the fix/gsa-invalid-email-241 branch September 18, 2026 04:25
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.

The GSA form submits an address it has already marked invalid, with no message

1 participant