Skip to content

Fixes #35879: Preserve remaining search fields and refresh move and label copies - #36256

Open
mohityadav766 wants to merge 3 commits into
mainfrom
codex/search-sync-followups
Open

mohityadav766 wants to merge 3 commits into
mainfrom
codex/search-sync-followups

Conversation

@mohityadav766

@mohityadav766 mohityadav766 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Fixes #35879

Follow-up to merged #35888. Additional paths still overwrite complete search documents with partial entities or leave copied fields stale.

Changes:

  • Recover the local-only follow-up 388e3fa670: restrict container/page FQN moves to the correct entity indexes and FQN boundaries; re-index changed users after a team membership PATCH; propagate user labels to query users, editors and lastModifiedBy.
  • Preserve followers and votes on changed PUTs, and resolve inherited fields before their search write. Existing PATCH inheritance behavior remains.
  • Load usageSummary for dashboards, pipelines, ML models and schemas; query users; user activity timestamps; context-file folders; context-memory source references. Correct ML-model usage refresh to read the model as an ML model, not a chart. Most changes recover ec7edde, adapted to current main.
  • Refresh soft-deleted descendants when a classification, tag, glossary or term is renamed/moved. Membership re-indexing still defaults to non-deleted entities.
  • Relabel single reference objects as well as lists, and include a subdomain's parent reference. The recovered local follow-up named lastModifiedBy but its script only handled lists; this closes that gap.

Regression coverage:

  • EntityUpdateSearchDocIT: PUT followers/votes, inherited domains, retained tags, and PATCH owner inheritance.
  • ReindexFieldSetSearchDocIT: live usage reports and query-user reindexing; unique query SQL prevents fixture collisions.
  • Extend RenameCascadeSearchIT for container/page moves and soft-deleted tags/terms; TeamMembershipSearchIT for PATCH; ReferenceLabelSearchIT for query users and subdomain parent labels.

Validation on ab5f5f0:

  • Reactor package through integration tests passed, including compilation of 730 integration-test sources.
  • SearchIndexFactoryTest, SearchRepositoryBehaviorTest and UpdateByQueryReconcilerTest: 383 tests, zero failures/errors/skips.
  • Scoped spotless:apply, git diff --check, and Java impact-map branch check passed.
  • The test planner selects the full service unit suite and broad integration coverage because EntityRepository/SearchRepository are shared. Those suites have NOT completed locally. Docker is unresponsive; full MySQL/Elasticsearch and PostgreSQL/OpenSearch runs will be requested on this branch. Search-it/cache coverage selected by the planner remains unverified. This is a draft pending integration validation.

Still outside this PR:

  • Async cascade task tracking, conflict reconciliation and retry-queue fallback.
  • Cluster-wide staged-index routing during recreate reindexing.
  • Remaining audit items: time-series DQ tag/domain/reference copies, team counts on user create/delete, and additional display-only references (including relatedTerms, role and chart/dashboard copies). These need focused follow-up validation and fixes.

RetriggerView in GreptileConfidence Score: 4/5

Restrict container move writes to the container index before merging.

Findings

  1. P1 Container moves rename unrelated files ▶

Summary

Preserves fields during entity updates and reindexing, refreshes team membership and copied labels, and includes deleted descendants in rename refreshes.

  • Entity updates keep their tags, votes, followers, and inherited fields in search.
  • Search rebuilds keep the usage and relationship fields their pages need.
  • Renames and moves update only the matching search records.
  • Copied labels and team membership stay current in search.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Container moves] --> B[Update matching FQN through all]
  B --> C[Container documents renamed]
  B --> D[File with matching FQN also renamed]
  D --> E[Search path differs from saved file]
Loading

Reviews (1) · Last reviewed commit: "fix(search): preserve PUT relationships ..." · Reviewed by Greptile

…search

- Moving a container or a knowledge page rewrote, by a bare text prefix, the
  FQN of every document whose FQN started with the old one: a sibling such
  as "rawdata" when "raw" moved, and documents of other types that happened
  to start the same way. The rewrite now matches the moved entity and what is
  under it, and replaces only the leading FQN segments.
- Changing a team's users through a team PATCH did not re-index those users,
  so their teams went stale in search.
- A user's display-name change now also reaches query users, knowledge page
  editors and file lastModifiedBy.
…-reading entities

A full reindex, the retry-queue replay, reindexEntities and the live
updateEntity(ref) path load each entity with its index's required field
list. Fields its repository only loads on request were missing from the
list, so the search document lost them:

- usageSummary for pipelines, dashboards, ML models and schemas. Usage
  reports re-index through updateEntity(ref), so live usage never
  reached search for these types.
- users on queries, which the Table > Queries panel reads from search.
- lastLoginTime and lastActivityTime on users, which the Online Users
  search filters on.
- folder on context files, which the Context Center Documents page
  filters on.
- primaryEntity, relatedEntities, sourceEntity and sourceFile on
  context memories, which the asset memories listing filters on.

Reporting usage for an ML model also failed with "Entity not found:
chart": mlModelEntityUsage re-read the model as a chart.
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 26, 2026
@gitar-bot

gitar-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Updating search reindexing, rename cascades, and membership propagation could leave entity relationships, labels, or usage data stale across indexed documents.

Preserves search document fields across PUT, PATCH, reindex, and rename/move paths so partial entity writes no longer overwrite complete search documents or leave copied labels stale. No open issues found in this review; the PR is still a draft pending full MySQL/Elasticsearch and PostgreSQL/OpenSearch integration runs.

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

@mohityadav766 mohityadav766 self-assigned this Oct 26, 2026
@mohityadav766
mohityadav766 marked this pull request as ready for review October 26, 2026 13:39
@mohityadav766
mohityadav766 requested a review from a team as a code owner October 26, 2026 13:39
Comment on lines +798 to +805
t.field(prefixFieldCondition)
.value(FieldValue.of(oldParentFQN))))
.should(
s ->
s.prefix(
p ->
p.field(prefixFieldCondition)
.value(oldParentFQN + Entity.SEPARATOR)))

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.

P1 Container moves rename unrelated files

The boundary check still leaves the intended index restriction incomplete. ContainerRepository.updateAssetIndexes passes GLOBAL_SEARCH_ALIAS, and both Elasticsearch and OpenSearch filter only by fullyQualifiedName. Service names can repeat across service types, so a container and a file can both have svc.raw as their FQN. Moving that container also rewrites the file's search document, although its saved path never changed.

Target the container's write index and add a regression test with matching FQNs across entity types.

@mohityadav766 mohityadav766 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the latest head against current main, #35879 and merged #35888. Although #35879 is closed, this follow-up still contains absent fixes: PUT followers/votes and inheritance, reindex field hydration, membership refreshes and copied labels. It is not superseded by the earlier tag-preservation fix. The existing P1 about container moves targeting the global search alias remains applicable; I am not duplicating it inline. No additional substantiated finding from this static pass. The latest service-unit workflow failed, broad integration lanes were skipped, and the PR remains draft pending integration validation. Please resolve the existing index-scoping finding and validate the search/cascade cases on both engines before treating this as ready. No tests run locally.

Reviewed head: ab5f5f0dd223f4fbfb464e7d78d4075a480e6f81.

This branch has not been deployed

No deployments
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.

Tags and Tier disappear from search after an ingestion run that changes the table

1 participant