Repository navigation
Conversation
Smart test selectionpytest smoke testsMode: shadow. The selection below is computed but not applied; this PR still runs the default matrix (
Medium confidence: a wrong tag means tests are skipped, so check the tags above against what this PR touches. Selected scopes (37 files or classes, 207 tests)
Add the Playwright E2E testsThis run:
Specs selected because of this PR (5)
Add the commit |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
PR SummaryOverview Batch MCP ingest: A proposal that adds a reference to an entity type the rolled-back build doesn't know used to fail the entire ingest group. Post-commit saves: If a write commits but the MCL's previous aspect holds enums or fields only a newer version defines, post-commit side effects no longer fail the API response. Breaking-change notes were added for both behaviors. Reviewed by Cursor Bugbot for commit 4f74ba9. Bugbot is set up for automated code reviews on this repo. Configure here. |
…ves during a rollback With unknown-data tolerance on: - The batch MCP consumer writes each group of proposals in one transaction. A proposal that adds a reference to an entity type this version doesn't know is only found inside that transaction, so it failed the whole group and every proposal went to the failure topic. EntityServiceImpl now throws UnknownReferenceAddedException (a ValidationException naming the urn and aspect); JavaEntityClient.ingestValidProposals rejects that proposal and writes the rest of the group again. Timeseries aspects, written before the transaction, are not written twice. - Post-commit side effects validate the MCL's previous value. When that value holds an enum symbol only a newer version defines, the save was committed and its MCL produced, but the request still failed. The side effects now run without the previous value in that case, as indexing already does. The helpers indexing used for this move to MCLItemImpl and GenericRecordUtils so both paths share them. With tolerance off nothing changes.
b387c86 to
4f74ba9
Compare
Follows #20280. Two problems in the rollback tolerance. Both only apply with unknown-data tolerance on, which is off by default.
📋 Summary
With unknown-data tolerance on, keep the rest of an async batch when one proposal adds an unknown reference, and stop returning an error for a save that was already committed because its previous value came from a newer version.
What was wrong
batchIngestSize, default 50) in one transaction, so that rejection failed the whole group and every proposal in it went to the failure topic. A typo type in the same position fails on its own, because it is rejected before the transaction.MCLItemImpl, which validates the previous value. If that previous value holds an enum symbol only the newer version defines, the request fails after the fact: Rest.li answers 422 and OpenAPI 400, while the row was written and the MCL produced. Clients may retry a write that already succeeded.Changes
EntityServiceImpl.mergeStoredReferencesthrows the newUnknownReferenceAddedException, aValidationExceptionwith the same message that names the urn and aspect it rejects. API callers get the same 400/422 as before.JavaEntityClient.ingestValidProposals(used by the batch MCP consumer) catches it, rejects the first proposal for that urn and aspect (it goes to the failure topic as before), and writes the rest of the group again. Nothing of the group was committed: everyapplyUpsertruns before the firstcommitAndContinue. Timeseries aspects, written before that transaction, are not written again. If no proposal of the group matches (a write hook added the reference), it rethrows and the group fails as today.EntityServiceImpl.processPostCommitMCLSideEffectsbuilds each item throughsideEffectItem. When only the previous value fails validation and is attributed to a newer version, the side effects run without it and a rate-limited warning is logged. Any other validation failure still throws. Indexing already follows this rule for the same case (UpdateIndicesService).MCLItemImpl.buildWithoutPrevious,MCLItemImpl.withoutPreviousFromNewerVersionandGenericRecordUtils.deserializeAspectOrNull. Indexing behaviour is unchanged.docs/how/breaking-changes.md: an entry for both changes. It also says which saves of an aspect holding a newer enum value are rejected (a patch, or an edit that writes the stored aspect back) and which are saved (a request that replaces the whole aspect).Design
Options considered for the batch consumer: (A) retry the group without the rejected proposal, (B) report the rejection per item inside the same transaction, (C) read the stored row before the transaction. A was chosen: it stays inside the consumer's entity-client call and leaves the core write transaction untouched. Sync APIs are unchanged on purpose: a sync batch stays all-or-nothing, as it is for any invalid item.
Flags off
With tolerance off nothing changes. Strict handling never reports an added reference, and the previous value is only left out when unknown data is tolerated.
Known limitations
DataProductAssetsSideEffectmirrors the assets that save adds but not the ones it removes. Today no side effects run for the whole batch.Testing
JavaEntityClientTest(22): only the proposal adding the reference is rejected and the rest are written; a later proposal for the same urn and aspect is kept; timeseries aspects aren't written twice; a reference no proposal added is rethrown.EntityServiceImplTest(59):produceMCLAsyncsucceeds when the previous value is from a newer version, and strict handling still throws.UpdateIndicesServiceTest(30) for the moved helpers.entityTyperow is registered, and an ownership row holds an owner type it defines.With tolerance off, the branch gives the same result as master in every case. With it on, the post-commit case logs
ownership's previous value, from a newer version (running post-commit side effects without it)once per save.