Skip to content

Fixes #37806: DQ: Historical run details display current tolerance instead of the tolerance used at execution - #37809

Merged
TeddyCr merged 6 commits into
mainfrom
agent/issue-37806
Nov 17, 2026
Merged

TeddyCr merged 6 commits into
mainfrom
agent/issue-37806

Conversation

@TeddyCr

@TeddyCr TeddyCr commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

This pull request was opened by an olivaw agent. It is an input to review, not an approved change — read the diff, not this description.

Fixes #37806

Screenshot 2026-11-16 at 7 52 18 PM Screenshot 2026-11-16 at 7 48 34 PM

What olivaw checked (machine-observed, §8.2/A.1)

  • diff: non-empty
  • build: not_run
  • tests: not_run
  • base: d47d0c5f208bdb9ff6f8d73603b6747169b0e4ee
  • head: 9567f1e2e38e99cd72526e23e109c8419eb8ad05

No build or test command is configured for this workspace, so only the diff's existence was checked. Set run_config.build_cmd/test_cmd to have olivaw verify its own work.

What the agent says it did (unverified)

Committed on agent/issue-37806 as 9567f1e2e3.

What the fix does

A run now carries the tolerance it was judged by, and the card reads that instead of the test case:

Schema (tests/basic.json, createTestCaseResult.json)

  • testCaseResult and testCaseDimensionResult gain appliedThreshold ({value, unit}, with a new thresholdUnit enum) plus configuredMinBound/configuredMaxBound — the window a statistical test asked for before the threshold widened it into the already-recorded minBound/maxBound.

Ingestion (base_test_handler.py)

  • result_applied_threshold() snapshots get_failure_threshold() in run_validation(), from the parameters the evaluator itself read. Aborted runs record none. Configured bounds come from the existing configured_bounds() widening record, set in get_test_case_result_object() and per dimension in _convert_to_test_case_dimension_results(), so every validator gets them without touching each one.
  • New class flag THRESHOLD_IS_TOLERANCE, set False on BaseTableCustomSQLQueryValidator whose threshold is the expected query result, not a tolerance.

Server — mapper passes the three new fields through, storeDimensionalResults copies appliedThreshold onto dimension results (as it already does evaluationScope), and INCLUDE_SEARCH_FIELDS includes them so the search-backed result listing carries them to the UI.

UI — getRunThresholdData() reads tolerance and configured bound from the result; the test case is only consulted for which definition it is. A run with no snapshot shows its threshold as label.unavailable (existing key, quiet styling) rather than the current setting, and still shows the effective range.

Assumptions I made

  • Field shape: tolerance as one object (shared by a run's dimensions, so the server can copy it), configured bounds as top-level siblings of minBound/maxBound (per-dimension, mirroring the existing naming).
  • Legacy display: reused label.unavailable rather than adding a key across 21 locale files. The statistical "Configured range" cell keeps the card's em dash for unknown.
  • Dynamic assertion: the configured range now comes from the run, so it is absent exactly when the agent recorded none — matching today's behaviour, without re-reading the current useDynamicAssertion flag.

Verification

  • UI: 109 suites / 1819 tests pass (src/components/DataQuality, src/utils/observability, src/components/Database/Profiler), including new regression tests for the 3%-failures-under-5%-then-1% case and the reverse, and for the unrecorded-threshold case. tsc clean for the files I touched (unrelated pre-existing errors elsewhere in the tree); eslint clean; TS types regenerated with the repo's json2ts pipeline.
  • Ingestion: ruff check/format clean. I could not execute the new Python test (test_applied_threshold.py) — metadata/generated is a build artifact absent from this clone and installing the ingestion package was outside the budget. I instead ran the repo's own datamodel-code-generator configuration against the edited schema to confirm the generated ThresholdUnit/TestCaseAppliedThreshold names and the new fields match what the code and tests reference.
  • Java was not compiled (changes are three pass-through lines).

RetriggerView in GreptileConfidence Score: 5/5

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

Summary

Historical runs now keep the tolerance and bounds used during execution instead of showing today’s settings.

  • Each test result now keeps the tolerance and bounds used for that run.
  • Run details now show the tolerance and bounds recorded for that run.

Reviews (5) · Last reviewed commit: "fix: persist bounds for table count vali..." · Reviewed by Greptile

…m it

Selecting an older data-quality run showed the test case's *current*
tolerance beside that run's stored verdict, so an edit to the threshold
could make a historical result contradict itself: a run that passed with
3% failing rows under a 5% tolerance read "Success, 3% failed, threshold
1%" once the test case was tightened.

The agent now records the tolerance it applied with the result it took the
verdict under, and the card reads the run's snapshot rather than the test
case:

- `TestCaseResult`/`TestCaseDimensionResult` gain `appliedThreshold`
  (value and unit) plus `configuredMinBound`/`configuredMaxBound`, the
  window a statistical test asked for before the threshold widened it into
  the already-recorded `minBound`/`maxBound`.
- The snapshot is taken in the validator, from the parameters the
  evaluator itself read -- not re-read on the server when the result
  arrives, where an intervening edit would be attributed to the run. An
  aborted run took no verdict and records none, and neither does a test
  whose `threshold` is not a tolerance (`tableCustomSQLQuery`, whose
  threshold is its expected result).
- Every dimension of a run shares the run's threshold; the server copies
  it onto the dimension results it stores, as it already does the
  evaluation scope.
- `getRunThresholdData()` reads the tolerance and the configured bound
  from the result. A run that recorded neither -- one from an agent that
  predates the snapshot -- shows its threshold as unavailable instead of
  claiming the current setting was applied.

Co-Authored-By: Claude Opus 5 <[email protected]>
@TeddyCr
TeddyCr requested review from a team as code owners November 14, 2026 05:29
@TeddyCr
TeddyCr requested review from Khairajani, chirag-madlani and yan-3005 and a balanced review from Copilot November 14, 2026 05:29

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. Try requesting a review at a lower effort level.

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

Copilot AI balanced review requested due to automatic review settings November 17, 2026 00:22

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. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 17, 2026 03:58

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. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 17, 2026 05:02

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. Try requesting a review at a lower effort level.

@ShaileshParmar11 ShaileshParmar11 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.

UI-side review only. The approach looks right: the card and getRunThresholdData read the tolerance and the configured bounds from the run rather than from the test case. The generated types match the schema, and the tests cover tightened and loosened edits, zero tolerance, and runs with no recorded threshold. Locally, testCaseThreshold.utils.test.ts (89 tests) and RunDetailsCard.threshold.test.tsx (13 tests) pass.

One issue to fix before I'd approve the UI side: whether a run shows a threshold section at all still follows the current matchEnum (inline comment). The other two comments are nits.

Copilot AI balanced review requested due to automatic review settings November 17, 2026 05:32

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. Try requesting a review at a lower effort level.

@ShaileshParmar11 ShaileshParmar11 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.

Approving the UI side at 2bac2fc. My inline comments are addressed: run applicability now comes from the run's own snapshot (applied) instead of the current matchEnum, ThresholdUnit re-exports the generated enum, and unknown values read "Unavailable" consistently. Checked locally: the threshold utils, RunDetailsCard threshold and configuration card suites pass (142 tests), and ESLint is clean on the changed sources. This approval covers only the UI files.

Copilot AI balanced review requested due to automatic review settings November 17, 2026 14:12

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. Try requesting a review at a lower effort level.

@gitar-bot

gitar-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 1 closed / 1 findings

Persisting execution-time tolerances and bounds changes data-quality result records; errors could misstate why a historical run passed or failed.

Historical DQ run details now read the tolerance and configured bounds recorded at execution time instead of the current test case setting, with a label.unavailable fallback when no snapshot exists. The previously open finding about the missing decision record for the new appliedThreshold and configured-bound result contract is resolved. No open issues remain.

✅ 1 closed
✅ Quality: New appliedThreshold/configured-bound result contract has no decision record

📄 openmetadata-spec/src/main/resources/json/schema/tests/basic.json:129-143 📄 openmetadata-spec/src/main/resources/json/schema/tests/basic.json:218-229 📄 openmetadata-spec/src/main/resources/json/schema/tests/basic.json:399-410 📄 openmetadata-spec/src/main/resources/json/schema/api/tests/createTestCaseResult.json:65-76 📄 ingestion/src/metadata/data_quality/validations/base_test_handler.py:209-212 📄 ingestion/src/metadata/data_quality/validations/base_test_handler.py:856-870 📄 ingestion/src/metadata/data_quality/validations/table/base/tableCustomSQLQuery.py:48-50 📄 openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/RunDetailsCard/RunDetailsCard.tsx:323-337
This PR adds a cross-component contract to tests/basic.json and createTestCaseResult.json: the testCaseAppliedThreshold object, a new thresholdUnit enum (ABSOLUTE/PERCENTAGE), and appliedThreshold/configuredMinBound/configuredMaxBound on testCaseResult and testCaseDimensionResult. Ingestion writes these fields, the server maps, propagates and indexes them, and the UI reads them. I grepped docs/decisions/ for appliedThreshold, configuredMinBound and threshold and found no record that states the rule, and the PR doesn't add one.

The rules here appear only in the PR description and in scattered comments: "Aborted runs record no applied threshold", "Runs with no recorded threshold show it as label.unavailable instead of the current test case setting", and "The custom SQL query validator sets THRESHOLD_IS_TOLERANCE to False because its threshold is the expected query result". The repo squash-merges, so the description won't reach history.

The record would assert something like: "A test case result carries the failure threshold its run applied (appliedThreshold) and the bounds configured before widening (configuredMin/MaxBound). The agent writes this snapshot when the run executes, and the server never fills it in from the test case. Readers show the run's snapshot and never the test case's current parameters, and show 'unavailable' when it is absent. Aborted runs, and validators whose threshold is not a tolerance (THRESHOLD_IS_TOLERANCE = False, e.g. tableCustomSQLQuery), record none. Every dimension shares its parent run's snapshot."

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

@TeddyCr
TeddyCr merged commit 29924d1 into main Nov 17, 2026
62 of 63 checks passed
@TeddyCr
TeddyCr deleted the agent/issue-37806 branch November 17, 2026 15:58
ShaileshParmar11 added a commit that referenced this pull request Nov 18, 2026
* Seed the applied threshold on FailureThreshold's seeded runs

Since #37809 the run details card reads the tolerance a run recorded
(appliedThreshold) instead of the test case's current setting, and a run
without that snapshot shows its threshold as "Unavailable". The spec seeded
results with no snapshot, so the strict run read "Unavailable" instead of
"No tolerance" and the relative run lost its percentage unit.

Seed each run with the snapshot an agent would write: 0 ABSOLUTE for the
strict test, 5 PERCENTAGE for the relative one.

* Describe FailureThreshold's displayed threshold as the run's recorded one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DQ: Historical run details display current tolerance instead of the tolerance used at execution

4 participants