Skip to content

fix(access): align publication owner idempotency key with migration - #2992

Open
ctxloop wants to merge 1 commit into
oceanbase:masterfrom
ctxloop:fix/publication-owner-idempotency-key
Open

ctxloop wants to merge 1 commit into
oceanbase:masterfrom
ctxloop:fix/publication-owner-idempotency-key

Conversation

@ctxloop

@ctxloop ctxloop commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Refs #2456 (7).

Rationale for this change

POST /v1/artifact-publications writes target Artifact owners with artifact-publication-owner:<id>, while ownership migration writes {family}-owner. On applications that write owners after commit, if the first owner write fails and migration records the same owner, retrying the publication fails with 409 artifact-owner.

What changes are included in this PR?

  • Derive publication owner keys with bounded_idempotency_key(f"{family}-owner", scope_id, artifact_id) on both transactional and post-commit paths in src/powercontext/server/app.py.
  • On a post-commit owner conflict, read the stored owner and accept the retry when it matches the caller, preserving compatibility with pre-upgrade artifact-publication-owner:<id> records. A different owner still fails with 409.
  • Add regression tests for post-commit migration retries, legacy key replay, and transactional / recovery key persistence.

Are there any user-facing changes?

Yes. Post-commit publication retries now return 201 instead of 409 artifact-owner when the stored owner matches the caller. New publications persist the {family}-owner key.

How was this change tested?

  • New regression tests for migration retries (fails before the fix) and legacy key replay, plus key assertions on transactional and recovery paths.
  • Targeted pytest runs on ownership migration, publication, owner recovery, and access HTTP tests passed (SQLite and fault-injected stores).
  • prek (ruff, ty) passed on all changed files.

AI usage statement

I used Gemini 4 Neon and Codex to write and review this change. I selected the approach and examined the tests.

`publish_artifact` wrote `artifact-publication-owner:<id>`, so post-commit retries failed with 409 after same-owner migration. Use the bounded `{family}-owner` key and accept a matching stored owner on post-commit conflict.

Refs oceanbase#2456 (7)

This branch has not been deployed

No deployments
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.

1 participant