Skip to content

Fix review findings from the shared screening session - #591

Merged
prestoncabe merged 7 commits into
mainfrom
screening-session-review-fixes
Nov 5, 2026
Merged

prestoncabe merged 7 commits into
mainfrom
screening-session-review-fixes

Conversation

@prestoncabe

Copy link
Copy Markdown
Collaborator

Follow-up to #586 (part of #585), from a /code-review of that PR.

Summary

Loading during the wait. An edit outdates the evaluation in flight. Until now loading stayed true through the 500ms wait, although the session's interface says it is true "only while the latest answers are being evaluated, not while waiting to send them".

 on form-js "changed"
   latestEvaluation++
   setStale(true)
+  setLoading(false)      // nothing is evaluating the new answers yet
   debouncedSubmit(answers)

In Preview, the Results panel keeps showing the last results without a loading state until the new evaluation actually starts.

Test helpers (src/testing/formJs.ts):

-export const settle = () => new Promise((resolve) => setTimeout(resolve, 100));
-export function type(label, value) { … }
+export function answer(label, value) { … }   // input + focusout
  • settle() was a fixed 100ms sleep meant to outlast form-js's redraw about 60ms after an import. On a slow runner the redraw could land later and make tests flaky. The focusout that answer() already sends hands the answer to form-js at once, so the redraw keeps it and no wait is needed.
  • type read like TypeScript's inline type-import keyword in import { …, type, until }.

Leftovers from #586:

  • NextStepsProvider is deleted; nothing used it once the session started projecting next steps.
  • Preview's Results types its answers as ScreeningAnswers. The two duplicate PreviewFormData declarations and preview/types.ts are removed.
  • screenerName is destructured with the session's other options.
  • The type-check baseline drops the entry for the deleted preview FormRenderer (151 → 150).

Evidence

  • Before: no test checked loading after an edit while an evaluation was in flight.
    After: screeningSession.test.tsx, "outdates an evaluation in flight as soon as an answer changes":
    answer("Answer", "first")  -> evaluate called, loading() === true
    answer("Answer", "second") -> loading() === false
    older evaluation resolves  -> results() undefined, loading() === false
    
  • To justify removing settle(), I ran a throwaway test 5 times. It typed into a form-js textfield right after importSchema, sent focusout, and checked 200ms later. Both the form state and the input kept "typed" every time. The session, Screener and Preview tests then passed 3 runs in a row with no wait.
  • devbox run test -- builder-frontend, run on each commit:
    Tests  389 passed (389)
    All matched files use Prettier code style!
    Type check passed: 150 type errors, none beyond the baseline.
    

Merge Danger

Door: two-way

Small, and reverts cleanly.

Blast Radius: Preview results

The only runtime change is that Preview's Results panel doesn't show loading between an edit and the evaluation it triggers. Published screeners don't read loading.

🤖 Generated with Claude Code

prestoncabe and others added 7 commits November 5, 2026 15:24
An edit outdates the evaluation in flight, so the session no longer
reports loading until it sends the new answers, as its interface says.

The form-js test helper's focusout already hands each answer to the
form before the post-import redraw can reset it, so drop the fixed
100ms settle(). Rename type() to answer(), which reads unambiguously
in an import list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Drop NextStepsProvider, unused since the session projects next steps.
- Type Preview's answers as ScreeningAnswers and remove the duplicate
  PreviewFormData declarations.
- Destructure screenerName with the session's other options.
- Lower the type-check baseline for the deleted preview FormRenderer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The failure was about answers that are no longer the latest, so Preview
and the published screener stop reporting it while the new answers wait
to be evaluated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Results took the session's loading flag, which an edit now clears until
the answers are sent. For half a second the pane showed old benefit rows
with no indicator, or went blank while the first results were pending.
Drive the indicator from stale instead, and hide it once an evaluation
fails, since the failure alert covers that state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The importing flag stayed set until the awaited import resumed, so an
edit landing in that window would update the answers without marking
them stale or scheduling an evaluation. form-js imports synchronously,
so clear the flag as soon as importSchema returns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Results imported it from the screening session module, which also pulls
in form-js and its CSS, just for a type. Define it in @/types beside
ScreenerResult.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
toBeDefined() passes when input() finds the label but no control, so
several waits could end before the field rendered. Wait for a truthy
field instead, and have answer() name the label it could not find
rather than failing with a TypeError on null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@prestoncabe
prestoncabe merged commit 46bafd3 into main Nov 5, 2026
6 checks passed
@prestoncabe
prestoncabe deleted the screening-session-review-fixes branch November 5, 2026 21:32
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