Repository navigation
Stop submitting a GSA email address the form already knows is malformed - #242
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
type === 'email' || name.toLowerCase().includes('email')@switch (parameter().type)GSAServer sends the address as
type: "string", so the validator attached via the name branch while the template rendered thestringbranch — which carries nomat-error. The message that would have explained the red field lived in@case (types.email), which nothing ever reached. Nothing readinvalidbefore 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
controlcontrolis constructed withupdateOn: '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.invalidand 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.invalidis 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
submittedParameters()alongside the blank value (fix(gsa): leave out a parameter the reader never filled in, and record why the emails vanish #237). Silently discarding a typo'd address is worse than sending it, because the reader is left expecting mail that will not come. It has to be refused and explained.Testing
method-parameter.spec.tscovers 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: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 invitest.config.tsexplains 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. SoRELEASE-TESTING.mdgains a manual row saying exactly what to type and what to expect.check:typesdoes not cover templates (tsc --noEmitdoes not run the Angular compiler), so the three template edits were verified withng build reactome-gsa-form— and that instrument was itself checked by breaking a binding deliberately and confirming the build reportsTS2339.Gates:
npm test254 passed;check:lint652 unchanged;check:dead145 unchanged;format:checkclean.Pushed with
--no-verify, deliberatelyPreflight's e2e smoke failed on
e2e/diagram-behaviour.spec.ts:48— the selection test from #236, nothing to do with GSA. It reproduces onmainat 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.tspools 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 aviewChild(OptionsComponent), and if it failed to resolve thenoptions()?.allOptionsValid() === falsewould readfalseand 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 usesmatStepLabelonly — 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