Skip to content

Fix org review submission: graceful missing-org handling + surface validation errors#13367

Merged
maximevast merged 2 commits into
mainfrom
stilla/fix-org-review-submission-errors
Jul 27, 2026
Merged

Fix org review submission: graceful missing-org handling + surface validation errors#13367
maximevast merged 2 commits into
mainfrom
stilla/fix-org-review-submission-errors

Conversation

@stilla

@stilla stilla Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Fixes two bugs behind the same symptom (checklist all-green, submission fails, form silently redisplays with no explanation):

  1. run_review_agent (organization_review/tasks.py) raised OrganizationDoesNotExist when the organization was deleted between enqueue and execution, retrying 4x before dead-lettering. It now logs a structured warning and returns, matching the existing graceful-skip pattern already used elsewhere in this module (e.g. review_appeal).
  2. The dashboard's "Submit for review" flow (AccountPageDetailsRequired.tsx) discarded the API's error.detail on a 422 (e.g. contact email failing a deliverability/MX-record check) and only showed a generic "Submission failed" toast. It now surfaces the real validation message via the existing extractApiErrorMessage helper, matching the pattern used in AccountCreateModal.tsx.

Also left a NOTE comment on the shared EmailStrDNS validator (kit/email.py) flagging that its deliverability check can reject legitimate website-only domains lacking MX records, since relaxing it is cross-cutting (affects checkout/customers too) and needs its own discussion.

Tests: added TestRunReviewAgentMissingOrganization (backend) and extractApiErrorMessage 422/string/fallback coverage (frontend, 16/16 passing). Backend ruff check/format pass; couldn't run the DB-backed backend test suite in the sandbox (no Docker/Postgres, pinned Python 3.14.6 unavailable) - please run uv run task test tests/organization_review/test_tasks.py in CI/locally to confirm the new test passes.

Sent by @maximevast from Matter organization setup assistance.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Review in cubic

Two bugs made "Submit for review" silently redisplay the checklist:

1. run_review_agent raised OrganizationDoesNotExist when the org was
   deleted between enqueue and (debounced) execution, dead-lettering the
   task after retries. It now logs and returns, matching the graceful
   skip pattern used elsewhere in the module.

2. The dashboard submit-review flow discarded the API error detail and
   showed only a generic toast. It now surfaces the actual message via
   extractApiErrorMessage, so a 422 (e.g. an undeliverable contact-email
   domain) is shown to the merchant.

Also noted, but intentionally left unchanged, that the shared EmailStrDNS
deliverability check can reject legitimate website-only domains; relaxing
it is a cross-cutting decision for separate discussion.

Co-Authored-By: Stilla <stilla@stilla.ai>
@stilla
stilla Bot requested a review from psincraian as a code owner July 24, 2026 10:36
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
orbit Ready Ready Preview, Comment Jul 26, 2026 6:37am
polar Ready Ready Preview, Comment Jul 26, 2026 6:37am
polar-sandbox Ready Ready Preview, Comment Jul 26, 2026 6:37am
polar-test Ready Ready Preview, Comment Jul 26, 2026 6:37am

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

OpenAPI Changes

No changes detected in the OpenAPI schema.

Comment thread server/polar/kit/email.py Outdated
- Remove disputed NOTE comment on the EmailStrDNS deliverability validator
- Show submit-review errors inline via an Orbit Alert instead of a toast

Co-Authored-By: Stilla <stilla@stilla.ai>
@maximevast
maximevast added this pull request to the merge queue Jul 27, 2026
Merged via the queue into main with commit dfe0274 Jul 27, 2026
28 of 29 checks passed
@maximevast
maximevast deleted the stilla/fix-org-review-submission-errors branch July 27, 2026 07:43
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.

3 participants