Skip to content

Fixes #35293: Glossary CSV docs, approval by non-reviewers, and expected failures logged as errors [2.0] - #35302

Merged
mohityadav766 merged 7 commits into
2.0from
backport/2.0/sentry-noise
Oct 13, 2026
Merged

mohityadav766 merged 7 commits into
2.0from
backport/2.0/sentry-noise

Conversation

@mohityadav766

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #35293

The 2.0 side of #35293: two real bugs, and two expected conditions that were logged as errors. One commit per fix:

  1. Negative search pagination (backport of Fixes #35037: Reject negative search pagination before it reaches the search engine #35039 and Fixes 35037: Prevent negative offsets from UI pagination #35040, for Negative from/size on search endpoints reach the search engine and fail as a server error #35037). A negative from or size is rejected with a 400 before it reaches the search engine, and the UI no longer sends a negative offset. SearchResourceIT conflicted: 2.0 has neither the httpGetSearch helper nor the 400 mapping the old negative-offset test expected, so the new tests and helpers were added by hand.
  2. Glossary-term CSV documentation (same change as Fixes #35293: Serve glossary CSV documentation for glossary-term import #35301 on main). glossaryTerm gets the glossary documentation instead of a 500, a type without documentation returns a 404, and the failure is logged once.
  3. Approval by someone who is not a reviewer. Anyone the task policy lets resolve a glossary-term approval task, such as an admin or an owner, could approve it, but the workflow then set the status as that user and the reviewer check rejected it. The failure was only logged, so the task closed as Approved while the term stayed In Review. As on main since Fixes #34540: Support a shared lifecycle stage on entities and let active workflows own it #34541, a status change the governance workflow makes, as or impersonating governance-bot, skips the reviewer check, and direct edits are still checked. SetGlossaryTermStatusImpl now writes impersonating governance-bot like the other workflow nodes, so its changes are recognised too.
  4. Deleted alert recipients. A user or team an alert names and that was deleted later logged an error with a stack trace for every event. It is now skipped at DEBUG, as main does since feat(alerts): redesign the alerting pipeline for multi-source alerts, reliable delivery and pluggable channels #33967. Any other lookup failure is still logged as an error.

Type of change:

  • Bug fix

High-level design:

No new design: each commit brings 2.0 in line with main.

Tests:

Use cases covered

  • A negative from or size on /v1/search/query, /nlq/query, /fieldQuery and /preview returns a 400.
  • Importing terms into a glossary term gets the glossary CSV documentation, and an unknown type returns a 404.
  • An admin who is not a reviewer approves a glossary term's approval task, and the term moves to Approved.
  • A non-reviewer setting the status to Approved with a direct PATCH is still rejected with a 403.
  • An alert whose user or team was deleted still notifies everyone else, without an error log. Any other lookup failure is still logged as an error.

Unit tests

  • I added unit tests for the new/changed logic.
  • SearchResourceTest (new on 2.0, from Fixes #35037: Reject negative search pagination before it reaches the search engine #35039): 3 tests, 0 failures.
  • EntityCsvTest: 66 tests, 0 failures, including the new glossary-term test.
  • RecipientResolutionTest: 11 tests, 0 failures. The 5 new ones check that a deleted user or team is skipped without an ERROR log, both when the alert names it and when it is an owner, and that any other lookup failure still logs one.
  • searchAPI.test.ts (Jest, from Fixes 35037: Prevent negative offsets from UI pagination #35040): not run locally. The change is identical to main's.
  • Coverage on changed lines: 22 of 29 changed executable lines (76%), measured with jacoco over these test classes. EntityCsv, UserRecipientResolver and TeamRecipientResolver are fully covered. SearchResource line 550 runs, but it always throws in the tests, and jacoco counts a line that throws as missed. The other 6 lines are the approval change in EntityRepository and SetGlossaryTermStatusImpl. Only the workflow reaches them, so the ITs below cover them, and ITs are not instrumented.

Backend integration tests

  • I added integration tests in openmetadata-integration-tests/ for new/changed API endpoints.
  • SearchResourceIT: the negative pagination tests from Fixes #35037: Reject negative search pagination before it reaches the search engine #35039.
  • CsvDocumentationResourceIT (new): glossaryTerm returns the glossary documentation, and an unknown type returns 404.
  • GlossaryTermInheritedReviewerApprovalIT: new test_nonReviewerApprovingTheTask_movesTermToApproved and test_nonReviewerApprovingByDirectEdit_isRejected.
  • Not run locally: the local Docker VM had no room for the IT stack. The merge queue runs them.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

Manual testing performed

None beyond the tests above.

UI screen recording / screenshots:

Not applicable — the only UI change is #35040's clamp on the page offset sent to the search API, which changes nothing visible.

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. The new checks say why a workflow change skips the reviewer rule and why a missing recipient is not a failure.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. N/A — no schema changes.
  • For UI changes: N/A — no visible UI change.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • I have added a test that covers the exact scenario we are fixing.

🤖 Generated with Claude Code

… engine [2.0]

Backport of #35039 and #35040. A negative from or size on the search
endpoints is rejected with a 400 that names the parameter instead of failing
in the search engine as a 500, and the UI no longer sends a negative offset.

SearchResourceIT conflicted: 2.0 has neither the httpGetSearch helper nor the
400 mapping the old negative-offset test expected, so the new tests and
helpers were added by hand.

(cherry picked from commit 893cd1b)
(cherry picked from commit e3914c5)
…rt [2.0]

The bulk import page asks /v1/csv/documentation/{entityType} for the type it
imports into. For a glossary term that is glossaryTerm, which has no
documentation file, so every request returned a 500 and was logged twice at
ERROR. Glossary-term import already goes through GlossaryCsv, so glossaryTerm
now gets the glossary's documentation. A type with no documentation returns a
404, and the FATAL log before the rethrow is gone.
Anyone the task policy lets resolve an approval task, such as an admin or an
owner, could approve a glossary term without being one of its reviewers. The
workflow then set the status as that user, the reviewer check rejected it, and
the failure was only logged: the task closed as Approved while the term stayed
In Review.

As on main since #34541, a status change the governance workflow makes, as or
impersonating governance-bot, skips the reviewer check: the approval task
already decided who may approve. Direct edits are still checked.
SetGlossaryTermStatusImpl now writes impersonating governance-bot like the
other workflow nodes, so its changes are recognised too.
An alert can name a user or team that is deleted later. Every event for that
alert logged the lookup failure at ERROR with a stack trace, although there is
simply no one left to notify. A missing recipient is now skipped at DEBUG, as
main does since #33967; any other lookup failure is still logged as an error.
@mohityadav766
mohityadav766 requested review from a team as code owners October 13, 2026 06:33
@mohityadav766 mohityadav766 added safe to test Add this label to run secure Github workflows on PRs backend skip-pr-checks Bypass PR metadata validation check labels Oct 13, 2026
@mohityadav766 mohityadav766 self-assigned this Oct 13, 2026
.fn()
.mockResolvedValue({ data: mockTableSearchResponse });

jest.doMock('./axiosClient', () => ({ get: mockGet }));

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.

./axiosClient only exists on main. On 2.0, searchAPI.ts still imports its client from ./index, so this mock can't resolve and all 12 new pagination cases fail with Cannot find module './axiosClient'. The one ui-coverage-tests run on this PR failed with that error (job log), and I get the same locally (12 failed, 4 passed). The skip-pr-checks label skipped that job on the rerun, so the PR looks green but would land red on 2.0.

Mocking ./index, like the other tests in this file do, makes all 16 pass locally:

Suggested change
jest.doMock('./axiosClient', () => ({ get: mockGet }));
jest.doMock('./index', () => ({ get: mockGet }));

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.

Good catch, thanks. ./axiosClient only exists on main, and on 2.0 searchAPI.ts imports the client from ./index. I applied your suggestion in be659a7, and searchAPI.test.ts now passes on 2.0 locally (16 of 16).

The green status came from the runs GitHub starts when a label is added. They skip the test jobs unless the label is safe to test (the job condition in yarn-coverage.yml and openmetadata-service-unit-tests.yml), and their skipped result replaced the failed one on the PR. be659a7 is a normal push, so the unit and UI tests run on it.

The pagination tests from #35040 mock ./axiosClient, which only exists on
main. On 2.0 searchAPI imports its client from ./index, so the mock could not
resolve and all 12 new cases failed. Mock ./index like the rest of the file.
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 68%
68.12% (82575/121210) 52.96% (51074/96428) 53.75% (15198/28273)

#35239 brought this test to 2.0 while this branch made SetGlossaryTermStatusImpl
patch impersonating governance-bot, so the test still expected the plain
four-argument patch. It now checks the same call main's copy of the test does.
@gitar-bot

gitar-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · Exempting governance-bot workflow status changes from reviewer checks could allow glossary terms to be approved without reviewer authorization if attribution is misapplied.

Backports four 2.0 fixes: negative search pagination is rejected with a 400, glossary-term CSV documentation is served, workflow approvals by non-reviewers are applied, and deleted alert recipients are skipped without error logs. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

Options

Display: compact → Counting what did not apply, without listing it.

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

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@mohityadav766
mohityadav766 merged commit 492b90f into 2.0 Oct 13, 2026
76 of 78 checks passed
@mohityadav766
mohityadav766 deleted the backport/2.0/sentry-noise branch October 13, 2026 13:46

This branch was previously deployed

1 inactive deployment
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 skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants