Skip to content

[4.2-dev] fix(frontend): handle missing subscriber accounts in SHOW PUBLICATIONS - #32902

Merged
mergify[bot] merged 1 commit into
matrixorigin:4.2-devfrom
LeftHandCold:fix/show-publications-orphan-32899-4.2
Nov 18, 2026
Merged

mergify[bot] merged 1 commit into
matrixorigin:4.2-devfrom
LeftHandCold:fix/show-publications-orphan-32899-4.2

Conversation

@LeftHandCold

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #32899

4.2-dev counterpart of #32901, using this branch's existing test fixture APIs.

What this PR does / why we need it:

SHOW PUBLICATIONS dereferences the account-ID lookup for every subscribed
account without checking that it exists. A persisted subscription referencing a
deleted account makes the whole statement panic, including unrelated healthy
publications owned by the same publisher. MOI's Sample Data startup can therefore
fail with Error 20101.

Keep each selected publication and its metadata, but omit subscriber IDs absent
from the account lookup from subscribed_accounts. Keep the existing sorted
names for live accounts and emit one diagnostic warning per affected publication.
Do not fall back to the stored account name: a recreated same-name account has
a different identity and must not inherit the old subscription.

This is a read-side resilience fix only. It does not mutate mo_subs, change
publication authorization, mask catalog query errors, or fix orphan creation
tracked by issue #32900. No schema migration or operational data cleanup is
included.

Tests cover healthy sorted subscribers, no subscribers, missing-only and mixed
subscribers, same-name/new-ID identity, preserved publication rows/metadata,
catalog errors and cancellation. A public MySQL integration test reuses the
existing three-CN fixture (MySQL client on CN0), injects only the observed orphan precondition via its internal
executor, and verifies plain SHOW/LIKE, unchanged catalog rows and healthy
subscription reads. It explicitly checks cleanup and repeats on the same instance.
This supplies the public SQL proof without adding a probabilistic DROP ACCOUNT
race or a production bypass for catalog write protection.

Tested with (macOS arm64; Go 1.26.4; repository-built native libraries):

.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=180s -run '^TestShowPublicationsAccountResolution$' ./pkg/frontend
.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/frontend
.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=360s -run '^TestShowPublicationsMissingAccountsSQL$' ./pkg/embed
git diff --check

All passed locally on 4.2-dev base
54956dc8e9e1315e38956b0ba3662e3f8a51b6c4. The frontend package passed in
15.046s; the SQL test passed both repetitions in 14.16s. The identical unsafe
lookup was also reproduced on unchanged main: healthy controls passed and the
missing-account unit case panicked. No QA/production data or deployment was
changed. GitHub CI is separate and may still be pending.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Queue requested — the merge queue status continues in this comment ↓.

@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Nov 18, 2026

@LeftHandCold LeftHandCold left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

代码复核(4.2-dev,c1ed30975):未发现阻断项。#32899 的现场栈正好落在按订阅账号 ID 取 Name 的位置;现在仅略过缺失 ID,不跳过发布、不按旧名字认领新账号。目录查询失败仍返回错误,正常路径不增加 SQL 或锁。对照了两个分支,生产补丁一致。新增 MySQL 用例保留孤立目录行,对比 SHOW/LIKE 的整行结果,并从有效订阅实际读到数据。此次复用 PR 中作者记录的定向测试结果,未本地重跑。残留数据的产生和清理由 #32900 单独跟踪,不阻塞此读侧修复。此为作者身份的复核记录,不是独立审批。

@XuPeng-SH

XuPeng-SH commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: c1ed30975ed4629797336e57e017544816923feb

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH 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.

mo-bot review · mo-bot-local · review

Commit: c1ed30975ed4629797336e57e017544816923feb

Assessment: approve

SHOW PUBLICATIONS now omits missing subscriber IDs from subscribed_accounts and logs one warning per affected publication. It preserves publication rows, metadata, sorted names for live subscribers, and catalog errors. The fix uses the existing account-ID lookup, so a recreated account with the same name cannot inherit the old subscription.

Model: gpt-6.2-sol / xhigh

Session: 01a1eecd-3287-70c0-bb93-ab923faf5f3f · slot 0 · generation 2

Validation:

  • The focused frontend test passed all eight cases, and the full frontend suite passed 1,699 top-level tests.

  • Both MySQL regression passes succeeded on the same three-CN fixture through CN0. They verified SHOW and SHOW LIKE, preservation of orphan rows, healthy subscription reads, and cleanup between runs.

  • Verified the clean frozen checkout, matching native build inputs, and isolation preflight. Logs and matching exit-zero receipts are recorded in validation-reconciliation.json.

Limitations:

  • The review exercised the public MySQL path in the embedded fixture. The IDC QA startup flow and the DROP ACCOUNT lifecycle issue tracked in #32900 remain outside this read-side validation.

@mergify mergify Bot added the queued label Nov 18, 2026
@mergify
mergify Bot merged commit cddc747 into matrixorigin:4.2-dev Nov 18, 2026
@mergify

mergify Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

✅ Merged into 4.2-dev as cddc747 at 18:27 UTC

Less than a minute in the queue, with no time running CI.

So far

  • ✅ Entered the queue Wed 18 Nov, 18:26 · rule release-4.2 · triggered by rule Automatic queue on approval for release-4.2
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged 18:27 · cddc747 · squash
3 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection
  • any of · required by GitHub branch protection:
    • check-success = CI Required
    • check-neutral = CI Required
    • check-skipped = CI Required

Times in UTC · dashboard · how the merge queue works

This branch was previously deployed

1 inactive deployment
ci — c1ed3097 Deployed Nov 18, 2026 by LeftHandCold
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants