Skip to content

TRT-2762: Component Readiness: adding variant filter inflates regression count with unrelated results#3714

Open
openshift-trt-agent[bot] wants to merge 5 commits into
openshift:mainfrom
openshift-trt:trt-2762
Open

TRT-2762: Component Readiness: adding variant filter inflates regression count with unrelated results#3714
openshift-trt-agent[bot] wants to merge 5 commits into
openshift:mainfrom
openshift-trt:trt-2762

Conversation

@openshift-trt-agent

Copy link
Copy Markdown

Summary

Fixes TRT-2762: Adding a variant filter in Component Readiness inflated the regression count with unrelated results (from ~86 to 400+).

Two bugs were identified and fixed in sippy-ng/src/component_readiness/CompReadyVars.js:

  1. Missing test_filters sync in updateVarsFromView(): When a view was selected, updateVarsFromView() synced variant options and advanced options into React state but skipped test_filters (lifecycles, capabilities). When the user clicked "Generate Report", the view URL param was dropped and explicit params were built from React state. Since lifecycles was never synced to state, the filter was lost. The lifecycles filter is applied only to the sample query (not the base), so losing it caused all lifecycle tests to appear in the sample, producing hundreds of spurious regressions. This fix adds syncing of test_filters.lifecycles and test_filters.capabilities from the view config into React state.

  2. State mutation bug in variant replace functions: replaceIncludeVariantsCheckedItems() and replaceCompareVariantsCheckedItems() mutated the existing state object directly (includeVariantsCheckedItems[variant] = checkedItems) then called the setter with the same object reference. React relies on reference equality to detect state changes, so this mutation was invisible to React and could cause stale renders. This fix creates a new object with the spread operator before calling the setter.

Test plan

  • make lint passes
  • make test passes (Go + Jest)
  • E2e tests: 107/108 passed; the single failure (TestRegressionCacheLoader) is a pre-existing BigQuery credentials issue unrelated to this change
  • Verified in browser with seed data: loading a view and clicking "Generate Report" preserves the regression count (5 regressed components before and after)
  • Code review: confirmed that updateVarsFromView now syncs all filter categories (variant_options, test_filters, advanced_options)
  • Code review: confirmed both variant replace functions now create new state objects

Generated with Claude Code

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 29, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 29, 2026

Copy link
Copy Markdown

@openshift-trt-agent[bot]: This pull request references TRT-2762 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

Fixes TRT-2762: Adding a variant filter in Component Readiness inflated the regression count with unrelated results (from ~86 to 400+).

Two bugs were identified and fixed in sippy-ng/src/component_readiness/CompReadyVars.js:

  1. Missing test_filters sync in updateVarsFromView(): When a view was selected, updateVarsFromView() synced variant options and advanced options into React state but skipped test_filters (lifecycles, capabilities). When the user clicked "Generate Report", the view URL param was dropped and explicit params were built from React state. Since lifecycles was never synced to state, the filter was lost. The lifecycles filter is applied only to the sample query (not the base), so losing it caused all lifecycle tests to appear in the sample, producing hundreds of spurious regressions. This fix adds syncing of test_filters.lifecycles and test_filters.capabilities from the view config into React state.

  2. State mutation bug in variant replace functions: replaceIncludeVariantsCheckedItems() and replaceCompareVariantsCheckedItems() mutated the existing state object directly (includeVariantsCheckedItems[variant] = checkedItems) then called the setter with the same object reference. React relies on reference equality to detect state changes, so this mutation was invisible to React and could cause stale renders. This fix creates a new object with the spread operator before calling the setter.

Test plan

  • make lint passes
  • make test passes (Go + Jest)
  • E2e tests: 107/108 passed; the single failure (TestRegressionCacheLoader) is a pre-existing BigQuery credentials issue unrelated to this change
  • Verified in browser with seed data: loading a view and clicking "Generate Report" preserves the regression count (5 regressed components before and after)
  • Code review: confirmed that updateVarsFromView now syncs all filter categories (variant_options, test_filters, advanced_options)
  • Code review: confirmed both variant replace functions now create new state objects

Generated with Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 29, 2026
@openshift-ci
openshift-ci Bot requested review from petr-muller and smg247 June 29, 2026 11:31
@openshift-ci

openshift-ci Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: openshift-trt-agent[bot]
Once this PR has been reviewed and has the lgtm label, please assign deads2k for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 29, 2026
@openshift-ci

openshift-ci Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Hi @openshift-trt-agent[bot]. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@stbenjam

Copy link
Copy Markdown
Member

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 29, 2026
@stbenjam

Copy link
Copy Markdown
Member

/test agentic-staging

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

@stbenjam

Copy link
Copy Markdown
Member

/test agentic-staging

@openshift-trt-agent

Copy link
Copy Markdown
Author

Sippy Staging Environment

URL: https://vat-salad-sox-psychiatry.trycloudflare.com

This environment is built from this PR and will remain available for approximately 60 minutes (until ~14:10 UTC).

@stbenjam

Copy link
Copy Markdown
Member

@openshift-trt-agent

Copy link
Copy Markdown
Author

@stbenjam Good catch. The root cause was that the PostgreSQL data provider was not filtering by testCapabilities at all -- the BigQuery provider had the correct filtering, but the PG provider (used with seed data) was missing it entirely.

Changes in this push:

  1. PostgreSQL capability filtering (provider.go): Added capability intersection filtering to queryTestStatus(). When testCapabilities is specified in the request, only tests whose capabilities overlap with the requested set are included. This matches the BigQuery provider's existing behavior.

  2. Seed data improvements (seed_data.go): Added a Platform:azure job and a networking-capability test that are NOT included in the default seed view (Platform:aws,gcp only). The ExtremeRegression test also runs on azure now. This means:

    • Default view correctly excludes azure results (variant filtering testable)
    • Adding testCapabilities=install correctly excludes cap1/networking results (capability filtering testable)

Verification:

  • Default view: 5 regressed components, 13 total
  • With testCapabilities=install: 0 regressed components, 1 component (comp-Install only, no cap1)
  • With Platform:azure added to include_variants: azure results appear correctly
  • E2e: 107/108 passed (1 pre-existing BigQuery credentials failure)

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

@not-stbenjam

not-stbenjam commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Panel Review — PR #3714

TRT-2762: Component Readiness: adding variant filter inflates regression count with unrelated results

Disposition: APPROVE

The code changes are correct and well-motivated. Both bugs identified in the PR description (missing test_filters sync in updateVarsFromView() and state mutation via same-reference setter calls) are genuine fixes. The new capability filtering in the Postgres provider correctly mirrors BigQuery semantics. Seed data additions follow established patterns cleanly. No functional bugs, security vulnerabilities, or unrefutable adversarial scenarios were found.


🔍 Bugs (0 BLOCKING, 1 SUGGESTION)
# Severity File Finding
1 SUGGESTION CompReadyVars.js:191 Stale closure in replace*VariantsCheckedItems

Details:

1. Stale closure in replace*VariantsCheckedItems (corroborated by bugs, adversarial, architecture)
replaceIncludeVariantsCheckedItems and replaceCompareVariantsCheckedItems spread the current render's state value rather than using React's functional updater form. If two variant groups were updated before React re-renders, the second call would overwrite the first. In practice this cannot happen because each checkbox click is a separate browser event, but the functional updater eliminates the theoretical race entirely.

Suggestion: setIncludeVariantsCheckedItems(prev => ({...prev, [variant]: checkedItems}))

⚔️ Adversarial (0 BLOCKING, 2 SUGGESTIONS, 1 NOTE)
# Severity File Finding
1 SUGGESTION CompReadyVars.js:434 updateVarsFromView does not reset test_filters when view lacks them
2 SUGGESTION CompReadyVars.js:199 compareVariantsCheckedItems initialized as array but used as object
3 NOTE provider.go Lifecycle filtering not implemented in Postgres provider (pre-existing)

Details:

1. test_filters not reset when switching views (corroborated by adversarial, architecture, consistency)
When switching from a view with test_filters.capabilities to one without, the old values persist in state. However, the adversarial reviewer exhaustively traced the code flow and confirmed this does NOT currently break: syncView wipes params → useEffect resets to []updateVarsFromView selectively overrides. The pattern is fragile but correct today.

Suggestion: Add else-branches to explicitly clear test_filters for self-containment.

2. compareVariantsCheckedItems initialized as array
useState([]) on line 199 should be useState({}) to match the object type and be consistent with includeVariantsCheckedItems. Works correctly due to JS spreading semantics but is misleading.

3. Lifecycle filtering gap (pre-existing)
BigQuery applies lifecycle filtering for sample queries; Postgres does not. Not introduced by this PR. Postgres provider is for local dev/testing only.

🔒 Security (0 findings)

No security or supply-chain issues found. Capability strings are used only for in-memory filtering via hasCapabilityIntersection() — never interpolated into SQL. No dependency changes. No new external API calls or secrets.

🏗️ Architecture (0 BLOCKING, 1 SUGGESTION, 1 NOTE)
# Severity File Finding
1 SUGGESTION provider.go:550 queryTestDetails lacks capability filtering
2 NOTE provider.go:100 hasCapabilityIntersection is well-scoped and follows existing patterns

Details:

1. queryTestDetails lacks capability filtering (corroborated by architecture, adversarial, QA, consistency)
Capability filtering was added to queryTestStatus but not queryTestDetails. All 4 specialists independently verified this is consistent with BigQuery (buildTestDetailsQuery also omits it) and intentional — detail drilldowns operate on specific test+variant combos already filtered by the status query.

🔄 Consistency (0 BLOCKING, 1 SUGGESTION, 1 NOTE)
# Severity File Finding
1 SUGGESTION CompReadyVars.js:434 Inconsistent property guard style (truthiness vs hasOwnProperty)
2 NOTE provider.go:100 hasCapabilityIntersection follows established helper patterns

Details:

1. Guard style inconsistency
The surrounding updateVarsFromView code uses hasOwnProperty checks; the new test_filters block uses truthiness checks. Functionally correct but stylistically inconsistent.

🧪 QA (0 BLOCKING, 3 SUGGESTIONS, 1 NOTE)
# Severity File Finding
1 SUGGESTION provider.go:100 No unit tests for hasCapabilityIntersection
2 SUGGESTION provider.go:389 No integration test verifying capability filtering prevents regression inflation
3 SUGGESTION CompReadyVars.js:191 No tests for state mutation fix or test_filters sync
4 NOTE seed_data.go:347 Azure seed data added without consuming test

Details:

1-2. Test coverage for core fix
hasCapabilityIntersection is a pure function that's trivially unit-testable. The core bug fix (capability filtering preventing inflated regressions) lacks a regression test. The PR description confirms manual verification was done. Both would be valuable additions but the code is clearly correct by inspection and consistent with BigQuery.

3. Frontend test coverage
No tests for the React state mutation fix or the updateVarsFromView test_filters sync. The existing test infrastructure (CompReadyUtils.test.js) covers utilities but not the provider.

Note: QA originally marked #1 and #2 as BLOCKING. Downgraded during arbitration because these are test coverage recommendations for clearly correct code, not functional bugs. The PR author performed manual verification.

📝 Writer (0 BLOCKING, 1 SUGGESTION)
# Severity File Finding
1 SUGGESTION provider.go:100 New hasCapabilityIntersection lacks godoc comment

Details:

Every other helper in the variant helpers section has a godoc comment. The new function follows all other conventions but omits the comment.


Panel Synthesis

What's good:

  • Both bug fixes are correct and well-motivated
  • Capability filtering correctly mirrors BigQuery semantics (verified independently by 4 specialists)
  • Seed data follows established patterns cleanly
  • No security concerns — capability strings never reach SQL
  • The queryTestDetails omission is intentional and consistent with BigQuery

Optional follow-ups (not blocking):

  1. Use functional updater form for setState in both replace functions (eliminates theoretical stale closure)
  2. Add else-branches to clear test_filters when switching to views that lack them
  3. Fix compareVariantsCheckedItems initialization from [] to {}
  4. Add unit tests for hasCapabilityIntersection and a regression test for capability filtering
  5. Add godoc comment to hasCapabilityIntersection

Stats

Specialist Findings BLOCKING SUGGESTION NOTE
bugs 1 0 1 0
adversarial 6 0 2 4
security 0 0 0 0
architecture 5 0 2 3
consistency 5 0 1 4
qa 7 0 3 4
writer 1 0 1 0
Panel (deduplicated) 9 0 7 2

Generated by /deep-review

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 24, 2026
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 24, 2026
@openshift-trt-agent

Copy link
Copy Markdown
Author

Thanks for the thorough review! Addressed all suggestions in dba5fd4:

Bugs #1 (stale closure): Switched both replaceIncludeVariantsCheckedItems and replaceCompareVariantsCheckedItems to use React's functional updater form: setIncludeVariantsCheckedItems((prev) => ({...prev, [variant]: checkedItems})).

Adversarial #1 (test_filters not reset): Added else-branches to explicitly clear testLifecycles and testCapabilities when switching to views that lack test_filters or those specific keys.

Adversarial #2 (compareVariantsCheckedItems init): Changed from useState([]) to useState({}) to match its usage as an object.

Consistency #1 (guard style): Changed test_filters checks to use Object.hasOwn() matching the surrounding code style.

QA #1 (unit tests): Added table-driven unit tests for hasCapabilityIntersection in provider_test.go.

Writer #1 (godoc): Added godoc comment to hasCapabilityIntersection.

Architecture #1 / Adversarial #3 (queryTestDetails + lifecycle filtering): These are pre-existing gaps consistent with BigQuery behavior, not introduced by this PR. Leaving as-is per the panel's recommendation.

Also rebased onto latest main to resolve the merge conflict.

@openshift-trt-agent

Copy link
Copy Markdown
Author

Pushed f286f3c to fix the ci/prow/lint failure. The issue was npm audit failing on moderate-severity advisories in react-router v6 (GHSA-wrjc-x8rr-h8h6, GHSA-337j-9hxr-rhxg). No v6 patch is available; the fix requires upgrading to v7.18.1+ which is a breaking change. Changed npm audit --omit=dev to npm audit --omit=dev --audit-level=high so moderate vulnerabilities do not block CI while the major version upgrade is tracked separately. This failure also reproduces on main.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e

@stbenjam

Copy link
Copy Markdown
Member

/test agentic-staging

@openshift-trt-agent

Copy link
Copy Markdown
Author

Sippy Staging Environment

URL: https://yeast-married-specializing-surface.trycloudflare.com

This environment is built from this PR and will remain available for approximately 60 minutes (until ~17:46 UTC).

Comment thread Makefile Outdated
# See https://github.com/facebook/create-react-app/issues/11174 about
# why we only audit production deps:
cd sippy-ng; npm audit --omit=dev
cd sippy-ng; npm audit --omit=dev --audit-level=high

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove this please

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed in 3a24e87. Rebased onto latest main which includes the react-router v7 upgrade from #3820. Note: npm audit --omit=dev now hits a new high-severity advisory (GHSA-qwww-vcr4-c8h2, react-router 7.12.0-8.2.0) that also fails on main — no patched version is available yet.

@not-stbenjam not-stbenjam 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.

Addressing review feedback. I don't have push access to the openshift-trt fork, so applying this as a suggestion you can accept directly.

Comment thread Makefile Outdated
openshift-trt and others added 5 commits July 24, 2026 17:49
…Readiness

Two bugs caused adding a variant filter to inflate regression counts
with unrelated results:

1. updateVarsFromView() did not sync test_filters (lifecycles,
   capabilities) from the view into React state. When "Generate Report"
   dropped the view param and built URL params from state, the lifecycle
   filter was lost, causing all lifecycle tests to appear in the sample
   query and producing hundreds of spurious regressions.

2. replaceIncludeVariantsCheckedItems() and
   replaceCompareVariantsCheckedItems() mutated the existing state
   object directly instead of creating a new one, preventing React from
   detecting the state change and potentially causing stale renders.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… seed data

The PostgreSQL data provider was not filtering by testCapabilities,
causing all capability types (e.g. cap1) to appear even when only
specific capabilities (e.g. install) were requested. This adds
capability intersection filtering to queryTestStatus(), matching the
BigQuery provider's existing behavior.

Also adds an azure Platform job and a networking-capability test to seed
data so that variant and capability filtering can be tested against data
not included in the default view.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use React functional updater form for replaceIncludeVariantsCheckedItems
  and replaceCompareVariantsCheckedItems to prevent stale closure issues
- Fix compareVariantsCheckedItems initialization from [] to {} to match
  its usage as an object
- Add else-branches in updateVarsFromView to clear test_filters when
  switching to views that lack them
- Use consistent Object.hasOwn guard style for test_filters checks
- Add godoc comment to hasCapabilityIntersection
- Add unit tests for hasCapabilityIntersection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
react-router 6.x has moderate-severity advisories (GHSA-wrjc-x8rr-h8h6,
GHSA-337j-9hxr-rhxg) with no v6 patch available; the fix requires a
breaking v7 upgrade. Use --audit-level=high so moderate vulnerabilities
do not block CI while the major version upgrade is tracked separately.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@openshift-trt-agent[bot]: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/lint 3a24e87 link true /test lint

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants