Skip to content

docs: EntityRepository decomposition epic (#32946) — salvage plan for closing #33248 - #33516

Merged
harshach merged 4 commits into
mainfrom
harshach/entity-repository-epic-docs
Sep 17, 2026
Merged

harshach merged 4 commits into
mainfrom
harshach/entity-repository-epic-docs

Conversation

@harshach

@harshach harshach commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Related to #32946 (this PR does not close it — it sets up the epic that will).

PR #33248 replaced the 13,731-line EntityRepository with 209 composed components across 911 files
(+86k/−33k), with a 161-file Collate companion (open-metadata/openmetadata-collate#6639). The
platform review concluded that the restructure mostly reorganises: the god class becomes 9
interfaces supplying 207 default methods, total lines go 13.7k → 23k, one-line reads become 7–9 line
calls, 69 updater subclasses gain boilerplate, and the structural pains that motivated #32946 (diff
fused with writes, duplicated import/bulk write paths, "add a capability = edit 8 places") all
survive the move. #33248's own docs/entity-repository-unified-design.md records the same verdict.

This PR adds the plan that replaces it: close #33248, re-land its unambiguous wins as small
standalone PRs off main, and run the decomposition as an epic under #32946 — one pain per
sub-issue, one RFC per pain, every refactor PR checked against a behaviour recording.

docs/plans/2026-09-17-entity-repository-epic.md contains:

  • Why a big-bang landing was rejected — nothing pins today's behaviour to diff against; 18 of the
    last 30 days' commits on main touched EntityRepository.java itself (of 700 commits in the
    window), so 2.0/1.13 cherry-picks would stop applying; two repos would have to move in lockstep.
  • A baseline measured on main @ 03be0fc2555, not estimated — 13,731 lines / 140 distinct
    protected method names against 5 abstract ones / 13 *ForImport methods / 3 ThreadLocal
    fields / 17 supports* flags / 303 Entity.getCollectionDAO() call sites / 56 files spelling
    EntityRepository<…>.EntityUpdater / 146 test files calling mockStatic(Entity.class). These
    become the Step-0 ratchet's starting constants.
  • A ~20-PR salvage inventory, each row naming its target on main and whether it is a hunk
    cherry-pick or a re-implementation: 5 real bug fixes (B1–B5), 7 performance items (P1 is the
    headline — table/column custom metrics and column extensions go 505 → 5 SQL statements), the
    transaction-test harness that already caught a live Collate rollback bug, and the
    UI/Playwright/ingestion/MCP/Collate lanes. It also lists what is not salvaged, so nobody
    re-mines the branch later.
  • The 13-pain list, each becoming one sub-issue under Decompose the EntityRepository god class #32946 with what hurts / root cause / how
    we know it is fixed.
  • Step 0 (RFC-0) — the size/coupling ratchet and the golden master that gate every refactor PR,
    including the honest scenario matrix (a first PATCH never consolidates; renameAllowed is false
    for Table/User/TestCase; search indexing is synchronous post-commit today).
  • Wave order and the per-PR verification recipe.

Every path, line reference and issue number in the document was verified against origin/main at
03be0fc2555 before writing.

Type of change:

  • Documentation

High-level design:

N/A — documentation only. The design being recorded is the content of the document.

Tests:

Use cases covered

Unit tests

Not applicable — no code changes.

Backend integration tests

Not applicable — no backend API changes.

Ingestion integration tests

Not applicable.

Playwright (UI) tests

Not applicable — no UI changes.

Manual testing performed

  1. python3 scripts/harness/check_harness.py — 5 warnings, all pre-existing on main; this PR adds
    none (the new docs/index.md row resolves, and docs/plans/** is not in the dead-reference
    scope).
  2. Verified every existing path cited in the document resolves on main, and re-measured each
    baseline number quoted above against origin/main @ 03be0fc2555.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR is linked to a GitHub issue (Decompose the EntityRepository god class #32946 — intentionally not via Fixes, since the epic
    stays open).
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: not applicable.
  • For UI changes: not applicable.
  • I have added tests: not applicable (documentation only).

🤖 Generated with Claude Code

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with one non-blocking documentation-design concern remaining in the existing review thread.

Findings

  1. P2 Line Ratchet Allows Shrinkage ▶
Summary

This documentation-only PR establishes the incremental execution plan for decomposing EntityRepository.

  • Records the measured baseline, salvage inventory, architectural pain points, and verification strategy.
  • Defines the RFC and wave ordering for incremental implementation.
  • Adds the plan to the repository documentation index.
  • The previously reported line-ratchet slack remains unchanged: allowing actual >= budget - 50 still permits small reductions without updating the baseline.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[Wave A: docs and independent salvage] --> B[Wave B: guarded fixes and tests]
    B --> C[Wave C: dependent performance and atomicity work]
    C --> D0[Step 0: ratchet and golden master]
    D0 --> D1[Step 1: EntityDiff and UpdatePolicy]
    D1 --> D2[Step 2: dependency injection]
    D2 --> D3[Step 3: aspects]
    D3 --> D4[Step 4: WriteContext pipeline]
    D4 --> D5[Step 5: UnitOfWork and outbox]
    D5 --> D6[Step 6: coupling-surface decision]
Loading

Reviews (2) · Last reviewed commit: "docs: drop the incidentally-regenerated ..."

PR #33248 replaced the 13,731-line EntityRepository with 209 composed
components across 911 files, plus a 161-file Collate companion. The platform
review concluded the restructure mostly reorganises: 9 interfaces supplying
207 default methods, 13.7k -> 23k lines, and the structural pains that
motivated #32946 (diff fused with writes, duplicated import/bulk write paths,
"add a capability = edit 8 places") all survive the move.

This document records the decision to close that PR and run the decomposition
as an epic instead:

- the baseline measured on main today (13_731 lines / 140 protected names /
  13 *ForImport / 3 ThreadLocals / 17 supports* flags / 303 global DAO
  lookups), which becomes the Step-0 ratchet's starting constants;
- a ~20-PR salvage inventory for the parts of #33248 that are unambiguous
  wins - 5 bug fixes, 7 perf items (505 -> 5 SQL on table metrics), the
  transaction test harness that already caught a Collate rollback bug, and
  the UI/ingestion/Collate lanes - each as a small standalone PR off main;
- the 13-pain list that becomes one sub-issue each under #32946;
- Step 0 (behaviour recording: size ratchet + golden master), which gates
  every refactor PR;
- the wave order and the per-PR verification recipe.

Docs only. Adds one row to docs/index.md.

Sub-issue of #32946.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Sep 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

…32946

Five sub-issues were opened on 2026-09-15 by porting #33248's atomicity tests
onto main at 500d929, and the plan as written would have duplicated them:

- #33353 is the P1 read-path N+1 (table custom metrics / column extensions);
- #33358 is the passing subset of the ported atomicity ITs, i.e. the pin that
  T2/T3 must reconcile against rather than re-create;
- #33359, #33360 and #33361 are three bugs on main that the port uncovered and
  that the salvage inventory did not list at all - bulk soft delete/restore
  committing twice per level, hard delete cancelling Flowable instances before
  the enclosing commit, and deadlock replay missing on hard delete plus a
  nested executeInTransaction replaying only the inner unit.

Adds those three to Group 1 with their root cause on main, marks P1 and T2/T3,
adds an "Existing issue" column to the pain table, and narrows the set of
sub-issues still to open to pains 0-6, 9, 11 and 12.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Backfills the issue numbers now that they exist: #33517-#33527 for pains
0-6, 9, 11 and 12, #33524 for the read-path N+1s that #33353 does not cover,
and #33528 tracking the salvage PRs. Records that #33248 and its Collate
companion are closed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
with `TableScript`/`GlossaryTermScript`/`UserScript`/`TestCaseScript`. It must **not** extend
`BaseEntityIT` (200 inherited tests, protected helpers); it reuses `SdkClients`, the SDK
`EntityServiceBase`, `BulkApi.upsert`, `CsvJobClient`, the `*TestFactory` classes, and
`TestNamespace.trackRoot`.

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.

P2 Line Ratchet Allows Shrinkage

The proposed line-count check does not enforce the stated ratchet. With actual >= budget - 50, up to 50 lines can be removed without lowering the budget, although this section and the Wave-D requirements say every reduction must update the constant. This weakens the planned gate and lets small improvements go unrecorded. Use zero slack for this metric or document that reductions within the slack are intentionally allowed.

scripts/harness/check_harness.py regenerates docs/generated/api-reference.md
in place to detect staleness, and a `git add -A docs/` swept the result in.
The refresh is real - main gained the dataQuality/dimensions endpoints and
/v1/lineage/scene without regenerating the doc - but it does not belong in a
docs-plan PR. Leaving the standing harness warning for its own change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@gitar-bot

gitar-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Adds comprehensive documentation for the EntityRepository decomposition epic, detailing a salvage plan to replace PR #33248's big-bang refactor with incremental improvements. The plan includes baseline metrics, a ~20-PR inventory of wins to re-land, 13 pain-point sub-issues, and verification recipes for each refactor PR. All paths and line references were verified against main, and manual testing confirms no new dead-reference warnings. Documentation is complete and ready to guide the incremental decomposition effort.

Review coverage

Rules No rules evaluated

Functional validation Not enabled · Set up

Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@github-actions

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit ff4f5c41e0c19187faaa7e45d75d654aa7bc23a1 in Playwright run 35236051358, attempt 1.

✅ 557 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 54m 40s

⏱️ Max setup 4m 34s · max shard execution 17m 19s · max shard-job elapsed before upload 20m 50s · reporting 4s

🌐 226.31 requests/attempt · 2.24 app boots/UI scenario · 36.48% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 36.48% (convergence target: at most 15%).
  • Browser traffic was 226.31 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.24 per UI scenario (1292 boots / 578 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 123 0 0 0 0 0
✅ Shard chromium-02 141 0 0 0 0 0
✅ Shard chromium-03 135 0 0 0 0 0
✅ Shard data-asset-rules-01 65 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@harshach harshach added the skip-pr-checks Bypass PR metadata validation check label Sep 17, 2026
@harshach
harshach merged commit 2af14b3 into main Sep 17, 2026
165 of 167 checks passed
@harshach
harshach deleted the harshach/entity-repository-epic-docs branch September 17, 2026 16:39

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant