Skip to content

Fixes 32946: Replace entity repository inheritance with composition - #33248

Closed
harshach wants to merge 17 commits into
mainfrom
harshach/split-entity-repo
Closed

harshach wants to merge 17 commits into
mainfrom
harshach/split-entity-repo

Conversation

@harshach

@harshach harshach commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #32946

Replace the 13,569-line EntityRepository with 209 composed components and migrate repository, updater, service and application consumers while preserving REST contracts, Redis caching and transaction ownership.

Type of change:

  • Breaking change — Java extension interfaces

High-level design:

Seven startup assemblies bind Java 21 records, read/write services and ordered mutation policies around the retained DAO graph, preserving one owning transaction per existing flush, nested rollback, deadlock replay and deferred cache/search effects.

Java extensions migrate through the Collate companion, with the design, migration guide, verification status and performance evidence documenting the boundaries and coordinated rollout.

Open acceptance gates: repeatable API latency and the complete database/cache/width/load/allocation matrix, 90% coverage for every changed executable class, and CI on the current native and companion revisions

Tests:

Use cases covered

  • ID/FQN reads, requested fields, authorization, pagination, history, CSV and bulk operations
  • Single owning commits, enclosing rollback, deadlock replay and deferred Redis/search publication
  • One batched query for table and column metrics; exact extension scopes, overlapping column names, table-only selection and widths 3/100/1,000
  • Paginated columns without unused owner reads; persisted profiles, owner access and non-owner PII masking
  • RDF foreign-key projection and dedicated mapper inputs; suite configuration and named-graph isolation
  • Indexing-trigger completion before subsequent column-grid reads
  • Separate JVMs for secondary integration servers, preserving the primary DAO/transaction graph
  • Tour profiler permissions, pagination persistence and bounded RDF readiness recovery

Unit tests

  • Component and regression tests added
  • Metrics-stage service suite: 10,365 passes, one skip, no failures/errors
  • Final RDF/CSV selection: 890 passes; lifecycle default/retention selection: nine passes
  • New lineage graph/validation selection: ten passes; LineageHydrator line coverage rises from 4.26% to 97.16%
  • Native MCP: 630 passes
  • Browser shard planner: 114 passes; complete discovery fits 3,947 Chromium tests into 30 shards at the unchanged three-worker/19-minute budget; CI planning passes
  • Updated companion Slack selection: 628 passes; SlackComponents reaches 97.04% line coverage
  • Benchmark protocols: 43 passes, including real HTTP burst/authorization checks, failed warmup traces, measured allocation windows, concurrent cold-start reset and manifest upgrades
  • Portable benchmark/acceptance/coverage tools: 31 Python tests; real JaCoCo CLI fixtures pass for complete coverage and fail for missed nested classes; opt-in gates, not wired into CI workflows
  • Final companion service suite: 4,193 passes, six skips, no failures/errors; all 3,697 production class files match the package used for the modal API regressions; spec: 61 passes; MCP: 28 passes
  • Full native coverage gate: 349/1,115 executable classes below 90%, across 512 changed service/MCP sources; all 455 executable classes in the 209 extracted component sources reach 90%
  • Full companion coverage gate: 118/177 executable classes below 90%, across 105 changed service/plugin sources; both reports include only completed passing executions, with source/artifact hashes and no missing sources or class-identity warnings
  • Spotless and installed pre-commit checks passed on both branches

Backend integration tests

  • Real database/API regressions for transactions, cache publication, metrics, columns, RDF and indexing completion
  • PostgreSQL/MySQL with Redis: 79 critical-selection passes and one cache-mode assumption abort each
  • PostgreSQL/MySQL without Redis: 29 critical-selection passes and two cache-mode assumption aborts each
  • RDF: 115 passes; two pre-existing SQL access assertions excluded after reproducing on the original artifact
  • Application/column-grid regression selection: 44 passes on each database
  • Governance: 363 passes; search: 411 passes, with recorded configuration skips/assumption aborts
  • Ten lineage API classes: 184 passes and three skips on each database with Redis, no failures or assumption aborts
  • Additional 48-class consumer selection: 1,837 passes, 23 skips and 132 configuration assumption aborts per database, no failures
  • Companion modal and transaction/cache regressions: 20 passes per database; scoped results, full count, bounded page, statuses, soft deletion and incident rendering
  • Full canonical MySQL/Elasticsearch/Redis suite on ARM Java 21: 14,731 passes, zero failures, 101 skips and 1,247 configuration assumption aborts
  • Native isolated PostgreSQL/OpenSearch/Redis/RDF selection: 513 passes, zero failures, recorded skips/assumption aborts
  • Version-history empty terminal-page regression: three passes on each database; retains the last populated backward cursor after concurrent deletion
  • Companion canonical PostgreSQL/OpenSearch/Redis: 612 passes and three skips; isolated search: five passes; hybrid selection: 12 passes and two optional external/multi-node skips
  • Earlier broad suites and their failures retained with artifact provenance
  • All three native integration CI profiles, RDF, main/nightly browser and formatting checks passed at 49d9290397
  • Matching native 49d9290397 / Collate 4def2335b1: backend and governance/data access passed; all 37 applicable companion checks passed
  • Current native 1f52c5930b / Collate 8c0096662a: automatic CI pending; current-revision coordinated CI remains an open gate

Ingestion integration tests

  • Deterministic data-quality clock fixtures: 57 Python cases and midnight-rollover reproduction
  • Java ingestion/import consumers in backend selections

Playwright (UI) tests

  • Three production-bundle guided-tour entry flows, including profiler step 13
  • Three pagination persistence repetitions across table, Explore and Users pages
  • All 14 Knowledge Graph browser cases after an injected readiness HTTP 500
  • Full Playwright lint and changed-file formatting; recorded pre-existing TypeScript diagnostics

Performance validation

  • Frozen service 854c3d28…, original 306263df…; Java 21, fixed 1 GB G1 heaps, durable PostgreSQL 16/MySQL 8.3, OpenSearch 3.4 and Redis 7
  • 78 reads per database in warm/cold/L1-cold/unavailable/recovered Redis and Redis-disabled mode: 69 lower and nine equal SQL totals in every comparison; all 16 read/write comparisons pass across 10,320 measured responses
  • 60 mutation/CSV workloads per database: no higher synchronous SQL totals; Redis-disabled PostgreSQL has 53 lower and one equal, other measured write configurations have 54 lower; one owning commit per single-entity mutation
  • Five warm requests for 100-column table/column metrics: 505 → 5 SQL statements
  • Companion Slack 12-test modal fixture: 57 → at most six SQL statements on both databases, with unrelated table tests excluded
  • Earlier three five-pair warm latency series: 130,000 successful responses, with inconsistent column direction and unstable baseline p99
  • New Linux original-versus-original calibration: 100,000 measured responses, zero errors, five alternating pairs, fixed CPU/heap configuration; all six percentile repeatability groups fail, so no candidate latency acceptance
  • Acceptance driver: calibration before comparison, bracketed capacity, equal offered loads, overload/recovery and allocations after warmup; missing design workloads and incomplete matrix remain explicit failures
  • JFR confirms one shared request-cache serialization; isolated ETag allocation prototypes remain unadopted because results vary with fixture size
  • Repeatable acceptance commands, full class inventory and machine-readable checkpoint
  • Reviewable paired-run and SQL CSV summaries linked from the performance report; SQL/profiling timings excluded from latency acceptance

Manual testing performed

  • Local production bundle: open Help → Tour, advance through profiler step 13 and complete the flow
  • Local pagination checks: select table page size 25 and Explore page size 50, then verify Users page-size persistence
  • Isolated ARM64 Kind stack: reproduce MinIO setup failure and verify Argo artifact upload/download after the companion repair

UI screen recording / screenshots:

Production-bundle Help-entry guided tour, including profiler step 13

Checklist:

  • Issue linked; Java compatibility migration documented
  • Transaction/cache boundaries and validation provenance documented
  • Regression tests and captured UI recording
  • 90% coverage for every changed executable class
  • Complete API latency acceptance
  • Coordinated production implementation CI at 49d9290397 / 4def2335b1
  • CI on the current native and companion revisions

Native wrappers still dispatch Collate main, so both PRs require a coordinated rollout after the acceptance gates pass.

Compose Java 21 entity policies and shared read, mutation, history, bulk,
deletion and cache services, and migrate REST, MCP and background consumers.
Preserve owning transaction boundaries, retry replay and Redis publication
while batching metadata lookups and reusing canonical serialized rows.

Add regression suites, API benchmark protocols and architecture, extension
migration and performance documentation. Keep the unresolved latency and
changed-class coverage acceptance gates explicit.
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Sep 12, 2026
@harshach
harshach marked this pull request as ready for review September 12, 2026 14:46
@harshach
harshach requested a review from a team as a code owner September 12, 2026 14:46
@greptile-apps

greptile-apps Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Too many files changed for review (911 files, 100 file limit).

Port upstream certification, history, column-lineage and Context Center
changes to the composed entity services. Retain owning transaction
boundaries and deferred cache/search effects.
@sonarqubecloud

Copy link
Copy Markdown

@harshach

Copy link
Copy Markdown
Collaborator Author

Closing this in favour of an incremental epic. The branch harshach/split-entity-repo stays — it is
the source of every hunk in the salvage list below, so please don't delete it.

Verdict

The platform review is accepted: this PR mostly reorganises. The 13,731-line EntityRepository
becomes 9 interfaces supplying 207 default methods; total lines go 13.7k → 23k; one-line reads become
7–9 line calls (99 hunks in service/resources/**, 113 more in Collate); 69 updater subclasses gain
boilerplate; global lookups and self-registration are unchanged in substance; and storeEntity and
prepare become public. The pains that motivated #32946 — diff fused with writes, duplicated
import/bulk write paths, "add a capability = edit 8 places" — all survive the move. This PR's own
docs/entity-repository-unified-design.md reaches the same conclusion.

What made it unlandable as one change:

  • Nothing pins today's behaviour. There is no recording of stored JSON, versions,
    ChangeDescription or change_event to diff 1,000 files against. This PR's latency gate never
    closed — its runner failed its own calibration.
  • Backports would break. 18 of the last 30 days' commits on main touched
    EntityRepository.java itself (out of 700 commits in that window), so 2.0/1.13 cherry-picks stop
    applying almost immediately.
  • Two repos in lockstep. Collate (open-metadata/openmetadata-collate#6639) and every Java
    extension would have to move the same day.

What replaces it

#33516 — docs/plans/2026-09-17-entity-repository-epic.md: the baseline measured on main, the
salvage inventory, the 13-pain list that becomes one sub-issue each under #32946, Step 0 (the
behaviour recording that gates every refactor PR), and the wave order.

The decomposition itself continues under #32946, one pain per sub-issue, one RFC per pain, one
PR per step — each with the ratchet budget lowered in the same diff and the golden master byte-equal.

Salvaged from this branch

Each of these lands as its own small PR off main (hunk-level ports — this branch also carries an
automated comment reflow that damaged comments in PatchEntityTool, FieldPathUtils, EntityUtil
and stripped ~800 comment lines from BaseEntityIT, so nothing is cherry-picked whole-file):

Bugs on main today — B1 Painless tag re-separation script redeclares def newTags/tier/classTags/glossTags; B2 description.index_options is docs/freqs in 5 index mappings so phrase queries can't match; B3 RDF indexing drops tableConstraints/profile/pipelineStatus/usageSummary; B4 Chart/Dashboard updaters delete-and-reinsert every HAS relationship before checking for change; B5 SearchSettingsMergeUtil class-load resolution + double-DEL alias eviction.

Performance — P1 table + column custom metrics and column extensions 505 → 5 SQL; P2 column pages resolve owners only when profile is requested (20 → 0); P3 patchChangeSummary stops rewriting the whole entity JSON; P4 owners + domains in one UNION ALL; P5 read-bundle partial fill + compare-and-swap publish; P6 pipelined bulk cache publication; P7 one serialization per request-cache entry instead of one per alias.

Tests — T1 the JDBI decorators (SqlQueryCounter, SqlFailureProbe, TransactionCounter); T2/T3 the transaction ITs (these already caught a real Collate bug — see #6639); T4 forked-JVM multi-node isolation; T5 the zero-edit guards; T6 the per-class coverage checker.

Other lanes — U1 guided-tour permission fetch; U2 Playwright flake fixes; U3 shard capacity 28 → 32; I1 datalake fixture dates vs midnight UTC; M1 MCP test-dependency cleanup.

Explicitly not salvaged: the 147 component-only unit-test files, the it/perf/** latency harness
and its scripts, scripts/entity_repository_size.py, the six docs/entity-repository-*.md (mined for
the pain list), EntityDependentCleanupIT, and every API rename in resources/migrations/MCP tools.

This was referenced Sep 17, 2026

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 Backward-Incompatible-Change safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decompose the EntityRepository god class

5 participants