Skip to content

fix(schema): preserve schema registry transaction invariants - #804

Merged
morluto merged 1 commit into
mainfrom
agent/fix-schema-registry-transactions
Aug 8, 2026
Merged

fix(schema): preserve schema registry transaction invariants#804
morluto merged 1 commit into
mainfrom
agent/fix-schema-registry-transactions

Conversation

@morluto

@morluto morluto commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Fixes #757 and #758.

Problem

A failed schema registration could leave an empty transaction-pending entry. Once that transaction ended, reconciliation called next() on the empty schema map and bricked the registry. Separately, a transaction could bind a second Pydantic model to an already committed schema URI because the conflict check ignored committed bindings.

Change

Create pending state only after descriptor registration succeeds, and keep committed registrations out of the transaction cache until reconciliation confirms commit. Reconciliation defensively discards an empty pending entry.

For model-backed schemas, calculate the deterministic descriptor URI and check both committed and transaction-pending bindings before descriptor registration. A conflicting model therefore cannot leave partial pending state.

Regression coverage

The schema-registry component suite now covers failed transactional descriptor registration, cross-transaction and intra-transaction model conflicts, same-model reattachment, and rollback followed by re-registration.

Validation

  • make test-component TESTS=tests/component/schemas/test_schema_registry.py — 19 passed
  • make check-static — passed

@morluto
morluto marked this pull request as ready for review August 8, 2026 07:06
@cursor

cursor Bot commented Aug 8, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@morluto
morluto merged commit 213575a into main Aug 8, 2026
39 checks passed
@morluto
morluto deleted the agent/fix-schema-registry-transactions branch August 8, 2026 07:10

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef6202128d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

registrations = self._registrations
else:
pending = self._pending.get(transaction_identity)
registrations = pending.registrations if pending is not None else {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid using committed schemas as transaction witnesses

When a transaction re-registers a schema already present in _registrations, this branch ignores the committed cache and adds that existing URI to the pending set. If the same transaction then registers a new schema and rolls back, _reconcile_pending() sees the pre-existing URI as its witness and incorrectly promotes the entire pending set, including the rolled-back schema; subsequent registration returns the cached URI without recreating its missing descriptor. Preserve committed cache hits inside transactions, or track whether each witness was created by the transaction.

Useful? React with 👍 / 👎.

@morluto morluto changed the title Preserve schema registry transaction invariants fix(schema): preserve schema registry transaction invariants Aug 24, 2026
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.

[Bug]: schema_registry _reconcile_pending crashes with StopIteration after a failed in-transaction registration

1 participant