Repository navigation
Fixes #34181: resolve inline child collections through one registry and serve them on every entity type - #34182
Conversation
manerow
left a comment
There was a problem hiding this comment.
Moving the nine per-type switches onto one registry, with characterization tests committed before each change, made this much easier to review. I left two comments I think should be fixed before merging: bulk column updates report saved changes as failed for children that aren't table-style columns, and ML feature tags come back empty from the new paginated endpoint when fields=tags is requested. The rest (authorization, lineage, data contract validation, and the table endpoint's response shape) looks good to me.
| String columnFQN, | ||
| String entityType, | ||
| UpdateColumn updateColumn) { | ||
| return (Column) |
There was a problem hiding this comment.
bulkUpdateColumns (line 777) still calls this method, and this cast runs after updateChildByFQN has already saved the patch and the change event. For a topic field, search index field, pipeline task or ML feature, the cast throws ClassCastException. The bulk loop catches it and reports the row as failed, even though the change was saved.
This is reachable from the existing UI: in Column Bulk Operations, filter by Asset type "Topic" or "Search Index", select a few rows, edit the description and save. The job reports every row as failed ("class ...Field cannot be cast to class ...Column"), but the descriptions did change. CSV import (line 946) calls the same method, so it behaves the same way. Before this PR these rows failed with "Unsupported entity type" and nothing was written, so at least the result was reported correctly.
| List<FieldInterface> page = new ArrayList<>(sorted.subList(bounds[0], toIndex)); | ||
|
|
||
| if (fieldsParam != null && fieldsParam.contains("tags")) { | ||
| Entity.populateEntityFieldTags(spec.entityType(), page, parent.getFullyQualifiedName(), true); |
There was a problem hiding this comment.
With fields=tags, this reads each child's tags from the tag_usage table and sets them to an empty list when it finds none there. That works for eight of the nine types, but ML model features keep their tags only inside the model's stored JSON. MlModelRepository never writes feature tags to tag_usage: it has no applyTags override, unlike Topic, Pipeline, SearchIndex, Container, APIEndpoint and Worksheet. So GET /v1/mlmodels/name/{fqn}/columns?fields=tags would return every feature with tags: [], even when it has tags.
This matters for the automation use case. PUT /v1/columns replaces the whole tag list, so a caller that reads the tags from this endpoint, adds one and writes the list back would drop the feature's existing tags.
…ldren, and backfill existing ones
…ead of losing tags silently
Code Review ✅ Approved 3 closed / 3 findings🔴 High risk · Migration moves ML feature tags into tag_usage, making backfill completeness data-critical. Unifies how the server resolves inline child collections (table columns, topic schema fields, container data-model columns, ML features, pipeline tasks, search-index fields, API-endpoint request/response fields, worksheet columns) through a single ✅ 3 closed✅ Bug: Tag suggestions still write to the first match for ambiguous child names
✅ Bug: Bulk-created ML models lose feature tags: stripped but never indexed
✅ Bug: Backfill swallows failures, then the next write erases JSON feature tags
OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
|



Describe your changes:
Fixes #34181
I worked on unifying how the server reaches an entity's inline child collection — table columns, topic schema fields, container data-model columns, ML features, pipeline tasks, search-index fields, API-endpoint request/response fields, worksheet columns — because each of nine call sites carried its own hardcoded entity-type switch, and
/v1/columnsonly served two of those types. Everything else had no read or write path for its children at all, which is what blocked AI Automations from working on any asset but tables.ChildFieldResolveris now the single registry naming each type's child container(s), and every consumer reads it:FieldPathUtils,LineageRepository.getChildrenNames,getParentEntityFQN, DataContract schema validation, the ES/OS column-grid configs andColumnRepository./v1/columnsreads and writes all nine types, and each entity resource gains a paginatedGET /name/{fqn}/columnsbacked by one sharedChildFieldPageReader.TaskandMlFeatureimplementFieldInterfaceso they travel the same paths, and acolumnsalias lets one caller address any type's children uniformly.Two fixes ride along. Entity pages other than Table were never wrapped in
SuggestionsProvider, so a valid AI suggestion on a dashboard, topic, ML model, container, search index, API endpoint or pipeline was created and then silently invisible —useSuggestionsContextreturns{}with no provider, so consumers render nothing rather than failing. AndFieldPathUtilsresolved a child by name, first match wins; since thecolumnsalias concatenates an apiEndpoint's two schemas, which normally share field names, an accepted suggestion for one schema's field silently overwrote the other's. It now refuses an ambiguous name instead of guessing.ML feature tags now live in
tag_usage, like every other entity's child tags.MlModelRepositoryoverridesapplyTags/applyTagsToEntitiesto write each feature's tags under its FQN, hydrates them back insetFieldsviapopulateEntityFieldTagsplus a bulkfetchAndSetFeatureTags, andstorageJsonNodestrips them from the stored JSON.MlModelUpdater.updateMlFeaturespairs features by name (it used whole-objectequals, so any edited feature was skipped) and reindexes tags for features added or removed in a patch.Migration
MlFeatureTagBackfill(v210, MySQL + Postgres) indexes existing feature tags, sinceapplyTagsonly fires on write. It reads the stored JSON, never modifies it, writes through the sametagUsageDAO.applyTagthe runtime uses so the FQN hashing cannot drift, skipsDERIVEDlabels, and derives a feature's FQN when an older row lacks one. Idempotent (INSERT IGNORE/ON CONFLICT DO NOTHING). It fails the upgrade if it cannot complete: with feature tags stripped from the JSON,tag_usageis their only home, so a model the backfill did not reach reads as untagged and the next write of it deletes the JSON copy too. A migration recorded as complete never re-runs on its own, so swallowing the failure would turn it into silent permanent loss.Type of change:
High-level design:
Approach. Extract the knowledge that was duplicated (which property holds a type's children) into a declarative registry, then convert each consumer one at a time, each conversion preceded by a characterization test committed against the old behaviour. That makes the refactor provably a no-op for the paths it replaces, which matters because these paths back lineage, data contracts and search indexing.
Key components.
ChildFieldResolver—entityType → container paths + child class + parent FQN depth. Charts are deliberately absent: a chart is a separate entity with its own RBAC.CHILD_CONTAINER_ALIAS("columns") — one segment any caller may use to mean "this entity's children", whatever the container is actually called. Needed because suggestion field paths are built ascolumns.<name>.<property>for every type.ChildFieldPageReader— one paging/sorting/enrichment implementation, with aChildPageEnricherhook so the table path keeps its custom metrics, extensions and PII-masked profiles while the other eight need nothing beyond tags.Alternatives rejected. Aliasing only where the direct lookup fails (correctness would then depend on which reflective getters happen to exist — the accident that produced the original bug); and a protected hook on
EntityRepository(that class has no authorization dependency and is inherited by many repositories with no child collection at all).Compatibility. The table endpoint's wire shape is frozen by test. Authorization is unchanged: each new endpoint authorizes
VIEW_BASICon the parent viagetResourceContextByName, matching what the table endpoint has always done, and the generic reader passesChildPageEnricher.NONE, so no masked-data path exists to bypass.Tests:
Use cases covered
/v1/columns.Unit tests
ChildFieldResolverTest,FieldPathUtilsTest,ColumnRepositoryValidationTest,ColumnGridIndexConfigsTest,MigrationUtilTaskWorkflowTest,TaskWorkflowHandlerTest,TaskWorkflowLifecycleResolverTest, plus the pinned pre-refactor characterizations forLineageRepository.getChildrenNames,getParentEntityFQN(quoted-dotted segments and struct grandchildren), the DataContract extractors and the grid aggregators.Backend integration tests
DenyPolicyPrincipals(negative authz),UriTestUtils(raw HTTP).Ingestion integration tests
Playwright (UI) tests
Manual testing performed
GET /name/{fqn}/columnsfor all nine types and confirmed each returns its own children (table 12, dashboardDataModel 5, topic 10, container 3, pipeline 1, mlmodel 3, searchIndex 3, apiEndpoint 16, dashboard 2 charts).requestSchema.emailandresponseSchema.emailon one API endpoint and confirmed both landed independently despite the shared field name.Suggestiontask withfieldPath=columns.email.descriptionon that endpoint (two matches) and approved it: HTTP 200, nothing written, both fields untouched. Control withcolumns.full_name.description(one match): approved and applied. Fixture restored afterwards.UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes #34181: resolve inline child collections through one registry and serve them on every entity typeFixes #34181above.TaskandMlFeaturegained aFieldInterfacemarker only — no stored shape changed, so no migration is needed.