fix(formation): name-search returns null (not false) on adapter error
E2E harness exposed that the NV name-search adapter times out on a stale input
selector and search_name() swallowed the error and returned available=False --
i.e. it would tell customers an AVAILABLE name is taken. Now returns
available=None ('could not determine') on adapter error / unknown state, which the
API already maps to null. The NV/TX portal selectors still need a scraping fix
(separate task; e2e harness is the acceptance test) before enabling a self-serve
formation checkout. Documented full e2e results + the bugs caught (missing ERPNext
Items, entity_type case, missing /name-search route) in the readiness doc.
This commit is contained in:
parent
4c0decd175
commit
76c4d55603
3 changed files with 53 additions and 5 deletions
|
|
@ -68,7 +68,7 @@ class FilingStatus(str, Enum):
|
|||
|
||||
@dataclass
|
||||
class NameSearchResult:
|
||||
available: bool
|
||||
available: bool | None # True/False, or None when the lookup could not be completed (adapter error)
|
||||
exact_match: bool = False
|
||||
similar_names: list[str] = field(default_factory=list)
|
||||
state_code: str = ""
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ async def search_name(name: str, state_code: str) -> NameSearchResult:
|
|||
code = state_code.upper()
|
||||
if code not in STATES:
|
||||
return NameSearchResult(
|
||||
available=False,
|
||||
available=None,
|
||||
searched_name=name,
|
||||
state_code=code,
|
||||
raw_response=f"Unknown state code: {code}",
|
||||
|
|
@ -58,8 +58,11 @@ async def search_name(name: str, state_code: str) -> NameSearchResult:
|
|||
return result
|
||||
except Exception as exc:
|
||||
LOG.error("Name search failed in %s: %s", code, exc, exc_info=True)
|
||||
# available=None => "could not determine" (adapter error/portal change).
|
||||
# NEVER return False here: a False would be read as "name taken" and could
|
||||
# block a legitimate order or mislead the customer.
|
||||
return NameSearchResult(
|
||||
available=False,
|
||||
available=None,
|
||||
searched_name=name,
|
||||
state_code=code,
|
||||
raw_response=f"Error: {exc}",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue