Skip to content

Fixes 36215: Widen task aboutFqnHash and repoint tasks on every FQN change - #36246

Merged
yan-3005 merged 8 commits into
mainfrom
yan-3005/entity-fqn-hash
Oct 27, 2026
Merged

yan-3005 merged 8 commits into
mainfrom
yan-3005/entity-fqn-hash

Conversation

@yan-3005

@yan-3005 yan-3005 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #36215

1. The varchar(256) overflow (the issue). An FQN hash is one 32-char md5 per level joined by dots (33 × levels − 1 chars), so anything 8+ levels deep (263+ chars) overflowed two varchar(256) columns:

  • task_entity.aboutFqnHash: creating a task on an 8+-level entity failed, and moving a glossary term that has tasks to 8+ levels failed (TaskDAO.updateAboutFqnHashBatch ... value too long for type character varying(256)).
  • domain_entity.fqnHash: an 8th-level subdomain could not be created.

The 2.0.8 migration widens both to 768, matching the table and container FQN hash columns. On MySQL aboutFqnHash also moves to ascii_bin like the other hash columns: at utf8mb4, 768 chars push idx_status_about (status, aboutFqnHash) past InnoDB's 3072-byte key limit (ERROR 1071).

2. Tasks lost their entity on most FQN changes. Only Glossary and GlossaryTerm rewrote aboutFqnHash on a rename or move. Renaming a domain, tag, classification or data product, or moving a tag or container, left the tasks under the old FQN, so they vanished from the entity's task list. Even the glossary rename skipped the glossary's own tasks. The glossary path also matched the hash alone: a domain and a glossary both named X share the hash, so renaming one moved the other's tasks.

The rewrite now runs once from EntityUpdater.storeUpdate / storeUpdateWithOptimisticLocking whenever the stored FQN differs from originalFqn. It is a single prefix update over the entity and its subtree, limited to the task rows whose about relationship comes from the subtree's entity types. The workflow-instance repoint runs per subtree type. Recorded in ADR:2026-10-26-tasks-follow-fqn-changes-from-store-update.

Type of change:

  • Bug fix

High-level design:

  • Migration (2.0.8/{mysql,postgres}/schemaChanges.sql, appended; 2.0.7 is released, 2.0.8 is not, and the fix ships in 2.0.x. A DB already on 2.1.0 still runs it: the runner reprocesses the latest executed version of the previous release train too — covered by ContinuousMigrationIT). Probed in throwaway postgres:15 / mysql:8.3.0: Postgres alters the generated column in place and keeps all three indexes; both statements are idempotent; MySQL lookups keep ref/range plans (key 771 vs 1027 bytes). Rollout note: on MySQL the MODIFY of a STORED generated column rebuilds task_entity (table copy).
  • TaskDAO.repointAboutFqnHashSubtree replaces updateAboutFqnHashBatch: aboutFqnHash = old OR LIKE 'old.%' (served by the existing indexes), new hash = new prefix + remaining suffix, AND EXISTS on entity_relationship (toEntity='task', MENTIONED_IN, fromEntity IN (<types>)). MENTIONED_IN into a task is written only for about (TaskRepository); comment mentions go to field_relationship.
  • EntityRepository.getFqnSubtreeEntityTypes() defaults to the entity's own type; Classification → {classification, tag}, Glossary → {glossary, glossaryTerm}. The entity's own tasks move on an exact hash match; only getNestedFqnEntityTypes() (domain→domain, tag→tag, glossary→glossaryTerm, glossaryTerm→glossaryTerm, classification→tag, container→container, page→page) move by hash.% prefix, in the same single UPDATE so no row is rewritten twice. Metric, metric group and data product (bare-name FQNs) get the exact match only. The repoint runs only when the update stored the entity. Workflow-instance links are LIKE-escaped.
  • Removed the glossary-only updateTaskAboutFqnHashes and its calls in GlossaryRepository / GlossaryTermRepository (not used by Collate).
  • Not covered: the bulk updateWithDeferredStore path (ingestion, no renames); reads by aboutEntity still match without a type, so a list for X can show another type's X tasks (pre-existing, separate fix).
  • Alternative rejected: per-repository wiring (the earlier approach): every new renamable entity had to remember it, and it had already been missed for 5 entity types.

Tests:

Use cases covered

  • Task on an 8th-level glossary term can be created and listed by aboutEntity
  • Moving a term with a task from level 7 to level 8 (exact issue repro) succeeds, and the task lists under the new FQN and not the old one
  • 8th-level subdomain can be created
  • Task follows: domain rename (domain + subdomain tasks), tag rename (tag + child tag), tag move, classification rename (classification + tag), data product rename, container move (container + child), glossary rename (glossary + term)
  • Renaming domain X leaves the tasks of glossary X and term X.T in place

Unit tests

  • No unit test: the change is SQL plus the updater hook, so it is covered end to end by ITs on both databases. FeedDAOs and ClassificationRepository are exercised through TaskAboutFqnChangeIT.

Backend integration tests

  • Added TaskAboutFqnChangeIT (8 tests), GlossaryTermResourceIT#test_createTaskAboutEighthLevelTerm, #test_moveTermWithTaskToEighthLevel_repointsTask, DomainResourceIT#test_createEighthLevelSubDomain.
  • Before the fix (Postgres): the 3 width tests hit value too long for type character varying(256); 7 of the 8 repoint tests fail with the task missing from the new FQN.
  • After the fix: Postgres Tests run: 11, Failures: 0, Errors: 0 (8 new + 3 width tests; [fqn-change] repointed tasks logged 9×); MySQL width tests 3/0/0.
  • Regression, -DintegrationTests.lane=parallel, classes TaskAboutFqnChangeIT, GlossaryTermResourceIT, GlossaryResourceIT, GlossaryTermMoveApprovalIT, DomainResourceIT, TagResourceIT, ClassificationResourceIT, DataProductResourceIT, ContainerResourceIT, TaskResourceIT, EntityDeleteTaskCleanupIT, MetricResourceIT, ContinuousMigrationIT:
    • mysql-elasticsearch: Tests run: 2432, Failures: 0, Errors: 0, Skipped: 204
    • postgres-opensearch: Tests run: 649, Failures: 0, Errors: 0, Skipped: 49 (the local run was cut off before the final BUILD line; the CI run below covers it)
  • ContinuousMigrationIT on both engines: 3/0/0 each.
  • After the greptile fixes and the move to 2.0.8 (head of this PR, merged with latest main): TaskAboutFqnChangeIT + the 3 width tests + ContinuousMigrationIT — postgres-opensearch Tests run: 14, Failures: 0, Errors: 0, mysql-elasticsearch Tests run: 14, Failures: 0, Errors: 0.
  • The planner selects the FULL suite (EntityRepository change); a CI full IT run on this branch will be recorded here.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

  1. Reproduced the issue through the API in GlossaryTermResourceIT#test_moveTermWithTaskToEighthLevel_repointsTask (same steps as the issue) on Postgres: value too long before the fix, move succeeds and the task follows after.
  2. Ran the migration DDL by hand against postgres:15 and mysql:8.3.0: widened column, kept indexes, ran it twice, inserted 263-char hashes, checked EXPLAIN plans.

UI screen recording:

Not applicable — backend-only fix.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. (No schema change; DB migration included.)
  • For a UI feature or feature task: N/A, backend only.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: fresh-context review of 1158772e7f against REVIEW.md — no 🔴. 🟡 open: no IT for the workflow-instance repoint on the newly covered types; no knowledge-page move / in-place term rename test; no upgrade-path migration test; INFO log on 0-row renames; aboutEntity reads still match without a type (pre-existing).
  • Decision check: adds ADR:2026-10-26-tasks-follow-fqn-changes-from-store-update.
  • I have added a test that covers the exact scenario we are fixing.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues were found.

Summary

Widens task and domain hash columns to 768 characters in the 2.0.8 migrations and moves task and workflow-link updates into the shared entity updater.

  • Deep entity names fit in task and domain hash columns.
  • Tasks and workflow links follow entities when their FQNs change.

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[Update task hashes in one statement]
  D --> E[Match entity type and exact hash]
  D --> F[Match declared nested types and hash prefix]
  E --> G[Update workflow links once per type]
  F --> G
Loading

Reviews (6) · Last reviewed commit: "Move the hash-width migration to 2.0.8" · Reviewed by Greptile

…hange

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): tasks on deep entities could not
be created, moving a glossary term with tasks that deep failed, and
eighth-level subdomains could not be created. The 2.1.0 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:
only Glossary and GlossaryTerm rewrote aboutFqnHash, so renaming a domain,
tag, classification or data product, or moving a tag or container, left the
tasks under the old FQN. The rewrite now runs once from
EntityUpdater.storeUpdate for any entity whose FQN changed, as a single
prefix update over the entity and its subtree, scoped to the subtree's
entity types through the task's about relationship. The old glossary-only
path matched the hash alone, so renaming domain X also moved the tasks of
glossary X; the type scope prevents that.
@yan-3005
yan-3005 requested a review from a team as a code owner October 26, 2026 11:39
@yan-3005
yan-3005 requested review from harshach and a balanced review from Copilot October 26, 2026 11:39
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This 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 skip-pr-checks label.

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 26, 2026
Copilot AI balanced review requested due to automatic review settings October 26, 2026 12:07

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

A prefix match on the entity's own type moved the tasks of an unrelated
entity whose bare-name FQN contains a dot (metric "X.Y" hashes under metric
"X"). The entity's own tasks and workflow instances now move on an exact
match; only the types a repository declares as nested under its FQN
(getNestedFqnEntityTypes) move by prefix. The repoint also runs only when
the update stored the entity, so a rename the updater drops moves nothing.
Copilot AI balanced review requested due to automatic review settings October 26, 2026 12:27

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

The fix ships in 2.0.x, so the column widening moves from 2.1.0 to 2.0.7.
A database already on 2.1.0 still runs it: the migration runner reprocesses
the latest executed version of the previous release train too.

The task rewrite is now one statement matching the entity's own type by
exact hash or a nested type by hash prefix, so a row the exact match moved
can no longer match the prefix again (moving page A under a root page named
A.B). The workflow-instance repoint escapes LIKE wildcards in the link and
runs once per type for the same reason.
Copilot AI balanced review requested due to automatic review settings October 26, 2026 12:42

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@yan-3005
yan-3005 enabled auto-merge October 27, 2026 04:20
# Conflicts:
#	bootstrap/sql/migrations/native/2.0.7/mysql/schemaChanges.sql
#	bootstrap/sql/migrations/native/2.0.7/postgres/schemaChanges.sql
Copilot AI balanced review requested due to automatic review settings October 27, 2026 04:27

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@yan-3005
yan-3005 added this pull request to the merge queue Oct 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-27T04:33:36Z)

Blocked the queue: java-checkstyle

@yan-3005
yan-3005 added this pull request to the merge queue Oct 27, 2026
@yan-3005
yan-3005 removed this pull request from the merge queue due to a manual request Oct 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — manual (2026-10-27T06:32:02Z)

No required check failed — the entry may have timed out, or been dequeued while a required check was still pending.

2.0.7 is released, so the task_entity.aboutFqnHash and domain_entity.fqnHash
widening moves to 2.0.8; 2.0.7 matches main again.
Copilot AI balanced review requested due to automatic review settings October 27, 2026 10:14

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@gitar-bot

gitar-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · MySQL’s table-copy migration to widen FQN hashes could burden upgrades; the shared hook could mis-repoint task/workflow links across entity types.

Widens task aboutFqnHash and domain fqnHash columns to 768 via a 2.0.7 migration so 8+ level FQNs fit, and makes tasks and workflow links follow stored FQN changes for domains, tags, classifications, glossaries, data products and containers. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

@yan-3005
yan-3005 added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit c5db189 Oct 27, 2026
82 of 85 checks passed
@yan-3005
yan-3005 deleted the yan-3005/entity-fqn-hash branch October 27, 2026 13:57
yan-3005 added a commit that referenced this pull request Oct 27, 2026
…hange (#36340)

Backport of #36246 to 2.1.

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.8 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.
yan-3005 added a commit that referenced this pull request Oct 27, 2026
…hange (2.0) (#36262)

* Fixes 36215: Widen task aboutFqnHash and repoint tasks on every FQN change

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.

* Move the hash-width migration to 2.0.8

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.
@yan-3005 yan-3005 self-assigned this Nov 19, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Glossary term move fails with "value too long for type character varying(256)" when term has tasks and new path is 8+ levels deep

3 participants