Remove the deferred FK validation API and unused backend bulk helpers
評估
這個 Issue 還沒有評估資料。
描述
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
Remove the deferred FK validation API and the backend bulk-write helpers that no Morango code calls after the streaming deserialization migration.
Background & Motivation
#392 replaced legacy deserialization with the streaming pipeline in morango/sync/stream/deserialize.py. The removed legacy code was the only caller of the following. Each one now has no caller in Morango outside its own definition and tests:
| Item | Location | Remaining users in Morango |
|---|---|---|
SyncableModel.deferred_clean_fields |
morango/models/core.py |
test_deferred_clean_fields in tests/testapp/tests/models/test_core.py |
ForeignKeyReference |
morango/models/core.py |
deferred_clean_fields only |
TemporaryTable |
morango/sync/backends/utils.py |
none |
_bulk_full_record_upsert |
morango/sync/backends/base.py, postgres.py, sqlite.py |
none |
_bulk_update |
morango/sync/backends/base.py, postgres.py, sqlite.py |
none |
The design spec for #392 kept them on purpose, to keep the SyncableModel API stable in that PR. A search of learningequality/kolibri (develop) finds no use of any of them. The one _bulk_update match, in kolibri/core/attendance/test/test_api.py, is unrelated to these backend helpers.
User Story / Use Case
As a Morango maintainer,
I want the code that the deserialization path no longer uses to be gone,
So that readers do not mistake it for a live code path, and we do not maintain it for each database backend.
Description & Expected Outcomes
- The five items above no longer exist, and neither do the tests that only exercise them.
- Imports that only these items used are removed.
- The
0.9.0section ofCHANGELOG.mdlists each removed public name, like the other removals in that release.
If you find a caller that we missed, keep that item and record the reason in the PR.
Value Add & Impact
- Less dead code in the sync backends. The backends hold SQL for each database, which makes unused code there costly to read and to change.
deferred_clean_fieldsno longer suggests a supported way to validate FKs that nothing in Morango uses.
Deliverables & Contracts
- Remove
SyncableModel.deferred_clean_fieldsandForeignKeyReference. - Remove
TemporaryTable. - Remove
_bulk_full_record_upsertand_bulk_updatefrom the base, PostgreSQL and SQLite backends. - Add the removals to the
0.9.0changelog.
Acceptance Criteria
- A search of
morango/andtests/finds none of the five names. -
CHANGELOG.mdlists the removals under0.9.0. -
make testpasses on SQLite and PostgreSQL. -
prek run --all-filespasses.
Technical Pointers & Architecture
- Target Components / Context:
morango/models/core.py,morango/sync/backends/. - Related Patterns: #392 removed the legacy deserialization path in the same way, with changelog entries under
0.9.0. - Data Model & Schema Considerations: None. No model fields or migrations change.
- Resilience & Failure Modes: None at runtime, since nothing calls this code.
Notes & Tradeoffs
- Dependencies: Blocked by #392. Do this before
0.9.0ships, so that all the removals land in one release. - Related: #394.
morango/sync/backends/postgres.pyandsqlite.pyare excluded from ruff, so the hooks will not flag imports that become unused there. Check those files by hand. - Testing Requirements: Run the full suite on both databases, because the backend helpers differ for each database.
- Tradeoffs & Alternatives Considered: Keeping the items for external callers was considered. No Kolibri use exists, and
0.9.0already removes other private deserialization APIs.
Metadata
Complexity: Low
Target Branch: release-v0.9.x
Labels: TAG: tech update / debt
AI Usage
Drafted with Claude Code from review feedback on #392. Claude searched Morango for the remaining callers of each item, and searched Kolibri on GitHub for external use. I chose to track this as a separate issue instead of expanding #392.
- 主要語言
- Python
- 星號
- 15
- 分支
- 23
- 平均合併
- 4 天 2 小時
- 30 天內合併 PR
- 5
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
learningequality/morango 的其他 Issue
-
DEV: dev-ops DEV: distributions DOCS: developer
難度 1/5 1-3 小時 新手友好度 78/100
learningequality/morango#387 ·
-
DEV: backend DEV: dev-ops TAG: unit tests
難度 2/5 1-3 小時 新手友好度 70/100
learningequality/morango#385 ·
-
DEV: backend P0 - critical TAG: tech update / debt TAG: unit tests
難度 2/5 1-3 小時 新手友好度 72/100
learningequality/morango#364 ·
-
dependencies DEV: dev-ops TAG: dependencies
難度 3/5 1-2 天 新手友好度 25/100
learningequality/morango#399 ·
-
Scope filters should list read-write partitions last可能已有人在做 @bjester 於 3 天前認領。 未關閉DEV: backend P0 - critical TAG: tech update / debt
learningequality/morango#398 · 已指派 1 人 ·
查看 learningequality/morango 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 72/100
slavakurilyak/awesome-ai-agents#845 ·
維護者通常 1 天內回覆
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directory可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉difficulty:2 enhancement good first issue
難度 1/5 1-3 小時 新手友好度 92/100
MakazhanAlpamys/Soup#2178 ·
維護者通常 1 天內回覆
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-values未關閉
難度 2/5 1-3 小時 新手友好度 75/100
scverse/rapids-singlecell#854 ·
維護者通常 1 天內回覆
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGL可能已有人在做 @ninglinLiu 今天認領。 未關閉area:frontend backend:slang bug direction:input
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 1 天內回覆
-
random_elements(unique=True) on an OrderedDict: ZeroDivisionError once only zero weights remain, AssertionError with use_weighting=False可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 13 天內回覆