Skip to content

23: Keep the registrations behind a duplicate slug - #37

Merged
d4mation merged 1 commit into
mainfrom
23-registry-buffer
Aug 20, 2026
Merged

d4mation merged 1 commit into
mainfrom
23-registry-buffer

Conversation

@nikolaystrikhar

Copy link
Copy Markdown
Contributor

What: Registry\Reader::flush() offers every buffered registration to the registrar and rethrows the first duplicate-slug Config_Exception after the loop, instead of letting the first one end it.

Usage:

Absorber::register( $give_recurring );
Absorber::register( $duplicate_slug ); // still reported
Absorber::register( $give_fee_recovery ); // and this one still loads

Why this way:

The buffer is emptied before the loop, which is what made the throw lossy. That emptying is deliberate — it stops a second read re-registering what the registrar already holds — but it meant a collision left everything behind it in no registrar and in no buffer. A host got a report naming the two that collided and silently lost the rest, for the rest of the process, on both passes.

The collision still has to surface, so it is rethrown rather than swallowed. Both passes already catch Config_Exception around the read; this only changes what else survives the trip.

The first collision, not the last, so a buffer holding two of them keeps naming the one the host wrote first until it is fixed.

flush() empties the buffer before the loop, so a Config_Exception out of the
registrar ended the loop with everything behind the collision in no registrar
and in no buffer. A host registering A, a duplicate of A, then C got a report
naming A and the duplicate, and silently lost C for the rest of the process --
on both passes, with the site half-working and nothing anywhere mentioning C.

Caught per entry now, with the first collision rethrown after the whole batch
has been offered. The duplicate still surfaces from the read, where both
passes already catch it; what changes is that it no longer takes the entries
behind it along.

@d4mation d4mation left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice! Ideally this should be fixed in a Host plugin before exactly when the Exception was thrown actually mattered, but this is still a good change.

Base automatically changed from 22-conflict-redirect-loop to main August 20, 2026 19:56
@d4mation
d4mation merged commit 1ca3538 into main Aug 20, 2026
5 checks passed
@d4mation
d4mation deleted the 23-registry-buffer branch August 20, 2026 19:57
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