Skip to content

feat(onboarding): re-run job title check on mount - #1514

Merged
gabrielseco merged 15 commits into
mainfrom
feat/onboarding-job-title-eligibility-on-mount
Oct 13, 2026
Merged

gabrielseco merged 15 commits into
mainfrom
feat/onboarding-job-title-eligibility-on-mount

Conversation

@gabrielseco

@gabrielseco gabrielseco commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

When an employer comes back to the contract details step after changing the job title, the job title eligibility check now runs right away. The statement they see then matches the current job title, not the verdict saved for the old one.

Why

  • Today the check only runs on blur and on submit. Submit contract details, go back, change the job title, and return: the step still shows the verdict saved for the old title.
  • The new verdict only shows up on Continue. If it now needs a risk acknowledgement, that click just reveals the checkbox and stops, so the employer has to click twice.
  • Submitting was already safe, because the API rejects a stale check. This is a UX fix.
  • We can't run the check only when the title changed: saved contract details hold just the check id and verdict, and no endpoint reads a check back. In practice the query cache (keyed by job title and role answers) already makes repeat mounts free within a session. The one cost is a single check on the first mount after a page reload.

What changed

Toggle details
  • OnboardingForm.tsx: one line. The existing mount effect also runs the check. The existing guards still apply: the feature must be on, the schema must have the check field, and every role answer must be filled and valid. A fresh employment with no answers makes no request.
  • hooks.tsx: JSDoc only on checkJobTitleEligibility. A custom UI should also call it when the step mounts. Public API: documentation change, no signature change.
  • Tests, on jsf v0 and v1:
    • Saved answers plus a changed title: the check runs on mount with the new title, and the statement updates without a blur.
    • Remounting with nothing changed makes no second request.
    • No saved answers: no request.
    • The new tests fail without the fix.

Screenshots

N/A. Screenshots come with the partners verification below.

Related Resources

Testing

Partners verification is pending. Planned on .env.partners with a seeded USA employment:

  1. Baseline: the check still runs on blur and shows its statement.
  2. Submit with "Software Engineer", go back, change the title to "Surgeon", continue. The check runs on mount with job_title: "Surgeon" and the statement changes, with no blur or click.
  3. Going back and forward with no edits makes no new request.
  4. Reloading on contract details makes exactly one request.
  • Tested against the example/ app in a browser
  • Feature flag: job_title_eligibility

🤖 Generated with Claude Code


Note

Medium Risk
Changes onboarding submit/refetch and eligibility timing; incorrect behavior could show wrong hiring statements or advance with stale employment data, though failed PATCH paths are guarded.

Overview
Re-runs job title eligibility when the onboarding form mounts with an existing employment, so contract details no longer show a verdict tied to an outdated job title after the employer edits basic information and returns.

The prebuilt OnboardingForm mount effect now calls syncJobTitleEligibility (same guards as blur/submit: feature on, complete role fields). Successful basic information PATCH responses trigger refetchEmployment() so the check uses the latest saved job title; failed updates stay on the step without an extra GET. checkJobTitleEligibility JSDoc notes that custom UIs should run the check on mount too.

Tests cover mount-time checks (including after a same-session title change), no duplicate requests on remount, submit disabled during the mount check, and no refetch on failed basic-info PATCH.

Reviewed by Cursor Bugbot for commit 67c17e3. Bugbot is set up for automated code reviews on this repo. Configure here.

gabrielseco and others added 4 commits October 12, 2026 12:41
Agree on a written goal before coding: target flow, scope, exact copy,
out of scope, open questions and verification claims. The skill waits
for approval, then saves the goal to ~/.claude/goals/<project>/<branch>.md
so it survives worktree removal and never lands in a PR.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
/goal usually runs on main before a branch exists, so naming the file
from the current branch saved every goal as main.md. The draft now
proposes a Branch, used for both the goal file and the worktree.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The skill is shared, so pointing at sibling repos under a home folder
only works on one machine. Defer to each user's local instructions for
counterpart repos, and keep the example gotcha free of internal names.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The check only ran on blur and submit, so returning to contract details
after changing the job title showed the verdict saved for the old title
until the user clicked Continue. Run it once when the form mounts; the
existing guards skip it when no role answers are saved, and the query
cache keyed by job title and role answers skips the request when nothing
changed within the session.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

Metric Current Previous Change Status
Total (gzip) 230.49 kB 230.47 kB +19 B (+0.0%) 🔴
Total (raw) 641.98 kB 641.93 kB +54 B (+0.0%) 🔴
CSS (gzip) 21.94 kB 21.94 kB 0 B (0%) 🟢
CSS (raw) 114.43 kB 114.43 kB 0 B (0%) 🟢

Size Limits

  • ✅ Total gzipped: 230.49 kB / 350 kB (65.9%)
  • ✅ Total raw: 641.98 kB / 850 kB (75.5%)
  • ✅ CSS gzipped: 21.94 kB / 25 kB (87.8%)

Largest Files (Top 5)

  1. index.esm-wIkXrqU6.js - 11.4 kB (0 B (0%))
  2. styles.css - 10.97 kB (0 B (0%))
  3. index.css - 10.97 kB (0 B (0%))
  4. internals-D6148AAY.js - 6.13 kB (0 B (0%))
  5. hooks-ThU7CDLI.js - 5.85 kB (0 B (0%))
View All Files (291 total)
File Size (gzip) Change
index.esm-wIkXrqU6.js 11.4 kB 0 B (0%)
styles.css 10.97 kB 0 B (0%)
index.css 10.97 kB 0 B (0%)
internals-D6148AAY.js 6.13 kB 0 B (0%)
hooks-ThU7CDLI.js 5.85 kB 0 B (0%)
sdk.gen-BRPiw4M1.js 5.58 kB 0 B (0%)
index.js 5.51 kB 0 B (0%)
flows/Onboarding/hooks.js 4.67 kB +15 B (+0.3%)
utils-CUgvJHl4.js 4.07 kB 0 B (0%)
FieldSetField-QbfQb5Lp.js 4.04 kB 0 B (0%)

✅ Bundle size check passed

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

Project:remote-flows
Status: ✅  Deploy successful!
Preview URL:https://remote-flows-i6dkpkxms-remotecom.vercel.app
Latest Commit:67c17e3

Deployed with vercel-action

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for adp-cost-calculator ready!

Project:adp-cost-calculator
Status: ✅  Deploy successful!
Preview URL:https://adp-cost-calculator-i0j3dq8ho-remotecom.vercel.app
Latest Commit:67c17e3

Deployed with vercel-action

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

📊 Coverage Report

⚪ Coverage unchanged

Metric Current Previous Change Status
Lines 89.53% 89.53% 0% ⚪
Statements 89.41% 89.40% 0% ⚪
Functions 88.41% 88.41% 0% ⚪
Branches 81.15% 81.14% 0% ⚪

Detailed Breakdown

Lines Coverage
  • Covered: 5389 / 6019
  • Coverage: 89.53%
  • Change: 0% (4 lines)
Statements Coverage
  • Covered: 5454 / 6100
  • Coverage: 89.41%
  • Change: 0% (4 statements)
Functions Coverage
  • Covered: 1426 / 1613
  • Coverage: 88.41%
  • Change: 0% (0 functions)
Branches Coverage
  • Covered: 3341 / 4117
  • Coverage: 81.15%
  • Change: 0% (2 branches)

✅ Coverage check passed

The flow never refetched the employment after updating basic
information, so the job title eligibility check kept sending the old
job title after an in-session title change. Refetch before moving on so
the employment query stays the single source of truth.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
gabrielseco and others added 10 commits October 12, 2026 13:29
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Start from a saved verdict that shows a statement so the test proves it
gets replaced, wait for late duplicates in the remount case, and cover
the risk acknowledgement, the disabled submit button and the feature
flag on mount.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Type the new title into basic information and continue, with the
update handler storing the title it receives, instead of calling the
flow's submit directly with a handler that ignored the payload.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Serve basicInformationSchemaV1Portugal instead of a hand-built schema,
and render the steps only once the flow has loaded so the form starts
from the saved employment.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The update resolves with an error instead of throwing, so the refetch
also ran after a failed save. Guard it, and test that a failed update
stays on the step without refetching, and that a successful one only
moves on once the refetch has finished.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ch settles

Replace the 200ms timeout probe with a check that the job title field is
still rendered while the post-save employment refetch is pending.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The refetch is awaited before the error callback fires, so a refetch after a
failed update is already counted by the time onError is called.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…t-step' into feat/onboarding-job-title-eligibility-on-mount
@gabrielseco
gabrielseco changed the base branch from feat-goal-skill to main October 12, 2026 17:05
@gabrielseco
gabrielseco merged commit 9638aeb into main Oct 13, 2026
14 checks passed
@gabrielseco
gabrielseco deleted the feat/onboarding-job-title-eligibility-on-mount branch October 13, 2026 11:23
@gabrielseco gabrielseco mentioned this pull request Oct 13, 2026
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.

2 participants