Repository navigation
Fixes 36215: Widen task aboutFqnHash and repoint tasks on every FQN change (2.0) - #36262
Conversation
…hange Backport of #36246 to 2.0. An FQN hash is one 32-char md5 per level, so anything eight or more levels deep (263+ chars) overflowed task_entity.aboutFqnHash and domain_entity.fqnHash, both varchar(256). The 2.0.7 migration widens both to 768 (ascii_bin on MySQL so idx_status_about stays under InnoDB's 3072-byte key limit). Tasks also lost their entity whenever an FQN changed outside the glossary. The rewrite now runs once from EntityUpdater.storeUpdate when the stored FQN changed: one statement matching the entity's own type by exact hash and the types nested under it (getNestedFqnEntityTypes) by hash prefix, scoped through the task's about relationship so a same-named entity of another type keeps its tasks. Workflow-instance links are repointed the same way, with LIKE wildcards escaped. 2.0-specific: the task DAO change lives in CollectionDAO.TaskDAO, the glossary repositories keep updating legacy threads, and ListFilter.escapeLikeBindValue is added as on main.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
| int tasks = | ||
| daoCollection | ||
| .taskDAO() | ||
| .updateAboutFqnHashBatch( | ||
| new ArrayList<>(fqnHashUpdates.keySet()), new ArrayList<>(fqnHashUpdates.values())); | ||
| for (int count : counts) { | ||
| rows += count; | ||
| .repointAboutFqnHash( | ||
| FullyQualifiedName.buildHash(oldFqn), | ||
| FullyQualifiedName.buildHash(newFqn), | ||
| entityType, | ||
| Relationship.MENTIONED_IN.ordinal(), | ||
| nestedTypes); |
There was a problem hiding this comment.
The new rewrite changes task rows but leaves their cached JSON unchanged. Read a domain task by ID, rename the domain, then add a comment. EntityRepository.find can return the cached task with its old aboutFqnHash. TaskRepository.addComment calls storeEntity without running prepare, so it saves the old hash back and the task disappears from the renamed domain's task list.
Evict the affected task cache entries after commit. Add a regression test that warms the task cache before renaming, then adds a comment.
Knowledge Base Used: Metadata entity lifecycle
| private void repointTasksAndWorkflowInstancesForFqnChange(String oldFqn, String newFqn) { | ||
| List<String> nestedTypes = List.copyOf(getNestedFqnEntityTypes()); | ||
| int tasks = |
There was a problem hiding this comment.
Unchanged variables omit
final
The new helpers omit final on parameters and local variables that never change. CLAUDE.md explicitly requires it for these declarations. Apply it to the new helpers, including nestedTypes and tasks here and the link variables in repointWorkflowInstancesForFqnChange. This repository requirement must be satisfied before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| new DescriptionUpdatePayload() | ||
| .withFieldPath("description") |
There was a problem hiding this comment.
Test strings lack shared constants
The new tests repeat raw strings such as "tag" and "description" instead of using named constants. CLAUDE.md requires a named constant whenever a string appears more than once. The added task helper in GlossaryTermResourceIT.java also repeats "description". Extract shared constants to satisfy this repository requirement before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
2.0.7 is released, so the task_entity.aboutFqnHash and domain_entity.fqnHash widening moves to a new 2.0.8 version; 2.0.7 matches 2.0 again.
Code Review ✅ Approved🔴 High risk · The migration widens persisted FQN-hash columns and bulk-repoints task/workflow links on renames; SQL or matching errors could orphan or misassociate records. Widens VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
…sh-2.0 # Conflicts: # bootstrap/sql/migrations/native/2.0.8/mysql/schemaChanges.sql # bootstrap/sql/migrations/native/2.0.8/postgres/schemaChanges.sql
Describe your changes:
Fixes #36215
Backport of #36246 to
2.0. Same change; see #36246 for the full design and review discussion.task_entity.aboutFqnHashanddomain_entity.fqnHashfrom 256 to 768 (MySQLaboutFqnHash→ascii_bin, soidx_status_aboutstays under InnoDB's 3072-byte key limit). Fixes task create / glossary-term move failing withvalue too long for type character varying(256)at 8+ levels, and 8th-level subdomains.EntityUpdater.storeUpdaterepointsaboutFqnHashand workflow instances when the stored FQN changed — exact match for the entity's own type,hash.%prefix for the types nested under it (getNestedFqnEntityTypes()), scoped by the task'saboutrelationship type. Covers domain, tag, classification, data product, container, glossary, glossary term, page.2.0-specific differences from #36246:
CollectionDAO.TaskDAO(2.0 has noFeedDAOs).GlossaryRepository/GlossaryTermRepositorykeep 2.0's legacy-threadaboutupdates; only the old glossary-only task-hash rewrite is removed.ListFilter.escapeLikeBindValue(identical to main) for the workflow-instance LIKE escaping.GlossaryTermResourceITgains the task imports that main already had.Type of change:
Tests:
Run on this branch after the move to 2.0.8, merged with latest
2.0(-DintegrationTests.lane=parallel):TaskAboutFqnChangeIT(8),GlossaryTermResourceIT#test_createTaskAboutEighthLevelTerm,#test_moveTermWithTaskToEighthLevel_repointsTask,DomainResourceIT#test_createEighthLevelSubDomain,ContinuousMigrationIT(3):Tests run: 14, Failures: 0, Errors: 0, Skipped: 0Tests run: 14, Failures: 0, Errors: 0, Skipped: 0Broader regression runs and the before/after evidence are on #36246.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.🤖 Generated with Claude Code
The PR should not merge until cached task writes can no longer undo a rename and the outstanding repository requirements are satisfied.
Findings
Summary
Widens task and domain hashes in migration 2.0.8 and moves task and workflow rewrites into the shared entity update path.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Store entity update] --> B{Stored FQN changed?} B -->|No| C[Leave task and workflow links unchanged] B -->|Yes| D[Match own tasks by exact hash and type] D --> E[Match nested tasks by hash prefix and type] E --> F[Rewrite workflow links for matching types] F --> G[Commit transaction]Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/2.0..." · Reviewed by Greptile