Skip to content

Keep former German register courts distinct from their successors. - #535

Open
amckittrick wants to merge 2 commits into
arthurdejong:masterfrom
amckittrick:de-handelsregisternummer-former-courts
Open

amckittrick wants to merge 2 commits into
arthurdejong:masterfrom
amckittrick:de-handelsregisternummer-former-courts

Conversation

@amckittrick

Copy link
Copy Markdown

Fixes #534

A Handelsregisternummer is only unique per court. When a court is absorbed, the registration keeps both names: the current court, früher (formerly), and the old court. Paderborn früher Höxter HRB 9 is a different registration from Paderborn HRB 9.

The Paderborn früher Höxter alias rewrote that number to Paderborn and dropped the old court. This removes that alias. A number written as the current court, früher, and a known old court keeps both names. Former court names from the OpenRegister company dump (12 June 2017 through 31 January 2019) that are not already in GERMAN_COURTS are accepted as courts.

The dump spelled Wolmirstedt as Wormirstedt (Wolmirstedt). The stored name is Wolmirstedt, and the dump spelling still validates.

Numbers are not reassigned when a court is absorbed, so a moved registration must keep both court names. Accept the former court names from the OpenRegister dump as courts in their own right. The dump spelled Wolmirstedt as Wormirstedt; return the real spelling and still accept the misspelling.

@mjanthony819 mjanthony819 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix. I confirmed the old behavior against master: validate('Paderborn früher Höxter HRB 9') returned Paderborn HRB 9, collapsing two distinct registrations, and validate('Höxter HRB 9') raised InvalidComponent. This branch keeps both identities, and the full suite passes (413 passed, 9 skipped) with the project doctest flags.

One question, not a blocker: the old-court side of the früher split accepts any known court, including ones that still keep their register. For example validate('Stuttgart früher München HRB 1') and validate('Höxter früher Höxter HRB 1') both validate. If only former courts can legally appear after früher, restricting parts[1] to FORMER_COURTS would reject pairs that almost certainly never existed. If the permissive behavior is deliberate (the dump may not list every name), a one-line comment saying so would help future readers.

The new doctests cover the important folds (ASCII fruher/Hoxter, decomposed input, malformed halves, the Wormirstedt misspelling). Nothing blocking from me.

AI assistance covered the analysis and this review text.

…ps its register.

A district change can leave both courts open, so the old court is looked up in the full court list.

Co-authored-by: Cursor <cursoragent@cursor.com>
@amckittrick

Copy link
Copy Markdown
Author

Nice fix. I confirmed the old behavior against master: validate('Paderborn früher Höxter HRB 9') returned Paderborn HRB 9, collapsing two distinct registrations, and validate('Höxter HRB 9') raised InvalidComponent. This branch keeps both identities, and the full suite passes (413 passed, 9 skipped) with the project doctest flags.

One question, not a blocker: the old-court side of the früher split accepts any known court, including ones that still keep their register. For example validate('Stuttgart früher München HRB 1') and validate('Höxter früher Höxter HRB 1') both validate. If only former courts can legally appear after früher, restricting parts[1] to FORMER_COURTS would reject pairs that almost certainly never existed. If the permissive behavior is deliberate (the dump may not list every name), a one-line comment saying so would help future readers.

The new doctests cover the important folds (ASCII fruher/Hoxter, decomposed input, malformed halves, the Wormirstedt misspelling). Nothing blocking from me.

AI assistance covered the analysis and this review text.

That's fair. It's deliberate.

A district change can move a registration while both courts stay open, so the old court stays on the full court list. FORMER_COURTS is only the closed courts missing from GERMAN_COURTS.

Stuttgart früher (formerly) München isn't in the OpenRegister dump. These are, and the old courts still keep a register:

Chemnitz früher Leipzig HRB 101463
Stralsund früher Rostock HRA 1766
The comment is next to the lookup. Those two are in the doctest.

@mjanthony819

mjanthony819 commented Dec 4, 2026 •

Copy link
Copy Markdown

Thanks for the examples — Chemnitz frueher Leipzig HRB 101463 and Stralsund frueher Rostock HRA 1766 make the intent clear: pairing with the frueher court is deliberate, since those registrations are still filed under the old court's number series. With that, the permissive pairing stands and my earlier concern is resolved.

I added both registrations as doctests in 8bb427e so the behaviour is pinned in the test suite.

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.

de.handelsregisternummer: Former Registrar Gaps

2 participants