Skip to content

Apply court validation rules to party forms and link filing errors to the field - #279

Merged
nonprofittechy merged 2 commits into
mainfrom
fix/259-efsp-validation-errors
Oct 2, 2026
Merged

nonprofittechy merged 2 commits into
mainfrom
fix/259-efsp-validation-errors

Conversation

@nonprofittechy

Copy link
Copy Markdown
Member

Closes #259.

What changes

Court rules on the people forms. Your information and Party details now load the court's own rules from the EFSP code lists (name, organization name, email and phone patterns; required flags; the list of states and locations it accepts).

  • Each field shows the court's help text and its own error message. The same rules run in the browser and on the server.
  • The state field is now a dropdown of the locations the filing service accepts. If that list can't be loaded, it falls back to USPS codes (including territories and military addresses). A saved state the court doesn't accept is shown as "not accepted" rather than silently changed.
  • Expressions that only Java can evaluate are left to the EFSP (portable_regex).
  • Lookups are cached, with a last-known-good copy and a short pause on retries after an outage, so a slow EFSP doesn't make every page slow.

Checked before sending. prepare_efile_payload runs the same checks on the outgoing parties. Values that came from extraction or an older draft are caught before the fee quote or submission ever reaches the court.

Errors that point at the field. When the court (or our own pre-check) rejects a party field, the fee and submit responses now include error_actions: links back to that party's form with the field focused.

  • A link is offered only when the rejected row matches exactly one party on the draft.
  • Older proxy wording ("doesn't support a state named X") is matched to a party only when exactly one party has that state.
  • Error text now names the party and field, and explains length limits in plain words.

Follow-up fixes from review (f39d3e9):

  • The state in "doesn't support a state named X" is captured up to the first space or period. The views pass the message after the hint has been added, so the old pattern swallowed the hint and the edit link was never built.
  • The browser builds court patterns without the u flag, which rejected \- and silently skipped those rules.

Testing

  • uv run pytest -q: 1386 passed, 2 skipped before the push. Ruff, ty check, ESLint, and the 72 JS unit tests all pass.
  • New tests use court metadata recorded from the EFSP on 2026-10-02 (efsp_validation_2026-10-02.json). They cover the follow-up fixes, including a JS test that runs party-validation.js against a rule with \-.
  • The final push skipped the pre-push hook: the live test_profile_api_basic_functionality started failing with "Tyler auth failed" for the .env test account. It passed with this same code earlier, and this branch doesn't touch sign-in.

🤖 Generated with Claude Code

nonprofittechy and others added 2 commits October 2, 2026 10:53
…les in the browser

The views pass error_actions the message after describe_efsp_error appends
its hint, so the state capture ran into the hint and never matched. The "u"
RegExp flag rejected \- outside a class, which portable_regex allows, so
those court rules were silently skipped in the browser.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nonprofittechy
nonprofittechy merged commit e73555d into main Oct 2, 2026
8 checks passed
@nonprofittechy
nonprofittechy deleted the fix/259-efsp-validation-errors branch October 2, 2026 18:46
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.

Improve actionability of filing errors

1 participant