Skip to content

fix(resolver): flip stale lowercase test literal + JSDoc to UPPER#130

Merged
sroussey merged 1 commit into
claude/wonderful-hypatia-Mqpl3from
claude/wonderful-hypatia-ECvVg
Jun 8, 2026
Merged

fix(resolver): flip stale lowercase test literal + JSDoc to UPPER#130
sroussey merged 1 commit into
claude/wonderful-hypatia-Mqpl3from
claude/wonderful-hypatia-ECvVg

Conversation

@sroussey

@sroussey sroussey commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Two follow-up fixes to #129, which pinned FamilyResolver normalization to UPPER:

  • Critical: Form_S_1.storage.underwriters.test.ts:67 still called findByResolverAndName("1.0.0", "goldman sachs"). Under the UPPER normalization it returns undefined, and the next line dereferences family!.canonical_underwriter_family_id and crashes. Flipped the literal to "GOLDMAN SACHS" to match the three other test files already updated in fix(resolver): FamilyResolver — alias inside mutex + UPPER case-normalization #129.
  • High: SponsorFamilyResolver.normalizeSponsorFamilyName's JSDoc still described "then lower-casing for case-insensitive matching". The function delegates to normalizeFamilyName, which now UPPER-cases. Updated the doc to describe UPPER-casing and the canonical_sponsor_family.normalized_name column it matches against. UnderwriterFamilyResolver was checked and has no equivalent stale doc.

Test plan

  • bun test src/sec/forms/registration-statements/Form_S_1.storage.underwriters.test.ts src/resolver/SponsorFamilyResolver.test.ts src/resolver/UnderwriterFamilyResolver.test.ts src/resolver/FamilyResolver.test.ts — 11 pass / 0 fail
  • bun run build-types — clean
  • grep -i 'lower-cas\|lowercas\|lower case' src/resolver/ — no remaining stale refs

https://claude.ai/code/session_0198SNs3pRmADdpeWrGZv9UB


Generated by Claude Code

PR #129 pinned FamilyResolver normalization to UPPER but two callers were
missed:

- Form_S_1.storage.underwriters.test.ts: findByResolverAndName lookup still
  used "goldman sachs", returning undefined and crashing the next line's
  family! dereference. Updated to "GOLDMAN SACHS" to match the three other
  test files already flipped in PR #129.
- SponsorFamilyResolver.normalizeSponsorFamilyName JSDoc still described
  lower-casing; the function delegates to normalizeFamilyName which now
  UPPER-cases. Updated the doc to reflect actual behavior and the
  canonical_sponsor_family.normalized_name column it matches against.
  UnderwriterFamilyResolver was checked and has no equivalent stale doc.
@sroussey sroussey merged commit 0b19740 into claude/wonderful-hypatia-Mqpl3 Jun 8, 2026
1 check passed
@sroussey sroussey deleted the claude/wonderful-hypatia-ECvVg branch June 8, 2026 20:54
sroussey added a commit that referenced this pull request Jun 8, 2026
…lization (#129)

* fix(resolver): serialize alias lookup inside per-key mutex for FamilyResolver

The shared FamilyResolver acquired the per-key mutex, ran find-or-create,
released, then ran resolveAlias() OUTSIDE the lock. Two parallel resolve()
calls on the same family name could split if an alias was installed between
the create and the alias-lookup — one returned the alias target, the other
the pre-alias id. This is the same race PR #127 fixed for PersonResolver
and CompanyResolver in commit 8fe6fd0; applying the same fix here so
SponsorFamilyResolver and UnderwriterFamilyResolver benefit.

Adds regression tests in both family-resolver test files that wrap
aliasRepo.resolve with an in-flight counter and assert maxInFlight === 1
under two parallel resolves on the same key (pre-fix code drives it to 2).

* fix(resolver): pin FamilyResolver normalize-case to UPPER; lock in via FamilyResolver.test.ts

The shared normalizeFamilyName introduced in commit 960d707 silently flipped
the family-name fold from UPPER (the pre-refactor SponsorFamilyResolver
convention) to lower. CanonicalSponsorFamilyRepo.findByResolverAndName runs
an exact-match storage query with no case fold, so any existing UPPER
canonical_sponsor_family.normalized_name rows became unreachable, and
operator-installed aliases keyed on those canonical ids would silently
orphan.

Reverts the fold to UPPER and pins it via a new dedicated FamilyResolver.test.ts
that covers UPPER output, case-insensitivity, internal-whitespace collapse,
and empty/whitespace-only input. Also updates three test fixtures
(CanonicalSponsorFamilyRepo, CanonicalUnderwriterFamilyRepo,
underwriterFamily command tests) that hardcoded lowercase normalized_name
literals so they match the live convention.

* fix(resolver): flip stale lowercase test literal + JSDoc to UPPER (#130)

PR #129 pinned FamilyResolver normalization to UPPER but two callers were
missed:

- Form_S_1.storage.underwriters.test.ts: findByResolverAndName lookup still
  used "goldman sachs", returning undefined and crashing the next line's
  family! dereference. Updated to "GOLDMAN SACHS" to match the three other
  test files already flipped in PR #129.
- SponsorFamilyResolver.normalizeSponsorFamilyName JSDoc still described
  lower-casing; the function delegates to normalizeFamilyName which now
  UPPER-cases. Updated the doc to reflect actual behavior and the
  canonical_sponsor_family.normalized_name column it matches against.
  UnderwriterFamilyResolver was checked and has no equivalent stale doc.

Co-authored-by: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
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