Skip to content

test(workflow): add test for trigger type mismatch in WorkflowNavigator#3387

Merged
facumenzella merged 2 commits into
mainfrom
facu/workflow-trigger-type-mismatch-test
Jun 12, 2026
Merged

test(workflow): add test for trigger type mismatch in WorkflowNavigator#3387
facumenzella merged 2 commits into
mainfrom
facu/workflow-trigger-type-mismatch-test

Conversation

@facumenzella

@facumenzella facumenzella commented Apr 24, 2026

Copy link
Copy Markdown
Member

Summary

Adds a missing WorkflowNavigatorTest case for WorkflowNavigator.triggerAction: when the componentId matches an existing trigger but the supplied WorkflowTriggerType does not, triggerAction must return null and leave the current step unchanged.

This is a test-only change. The production logic it guards (the && it.type == triggerType filter) already landed in main via #3386. This test is the only one that pins the type half of that filter: the existing unknown componentId test would still pass if the type check were removed, whereas this one fails.

Suggested during review of #3386.

Test plan

  • New test passes: triggerAction with mismatched trigger type returns null and does not navigate
  • No regressions in WorkflowNavigatorTest (./gradlew :ui:revenuecatui:testDefaultsBc8DebugUnitTest --tests "...WorkflowNavigatorTest" → BUILD SUCCESSFUL)
AI session context

AI Context

Metadata

  • PR: 3387
  • Branch: facu/workflow-trigger-type-mismatch-test
  • Author / human owner: facumenzella (Facundo Menzella)
  • Agent(s): Claude Code (Opus 4.8)
  • Session source: current conversation
  • Generated: 2026-06-12
  • Context document version: 1

Goal

Bring stale PR #3387 up to date and decide whether it still makes sense or should be closed. Outcome: kept as a focused test-only addition.

Initial Prompt

"Check PR #3387, put it up-to-date, and then see if it still makes sense, or we should close it." Follow-up: "Does the test still make sense?"

Agent Contribution

Human Decisions

  • Chose to force-push and keep the PR (over closing it) after being shown the assessment that the test is a genuine, non-redundant regression guard.

Key Implementation Decisions

  • Decision: Reset branch to origin/main and re-apply only the new test, rather than resolve the rebase conflicts commit-by-commit.
    • Rationale: 4 of the 5 commits were Create WorkflowTriggerType and WorkflowTriggerActionType #3386 content already merged into main; rebasing them produced conflicts and added no value. The only unique content was an 8-line test.
    • Rejected: git rebase origin/main carrying all 5 commits (produced conflicts on already-merged code).

Files / Symbols Touched

  • ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/workflow/WorkflowNavigatorTest.kt
    • Why: add the missing trigger-type-mismatch test case.
    • Symbols: triggerAction with mismatched trigger type returns null and does not navigate
    • Review relevance: confirms the test targets the it.type == triggerType filter (matching componentId btn-next, mismatching type UNKNOWN).

Dependencies / Config / Migrations

  • None.

Validation

  • Commands run:
    • ./gradlew :ui:revenuecatui:testDefaultsBc8DebugUnitTest --tests "com.revenuecat.purchases.ui.revenuecatui.workflow.WorkflowNavigatorTest": BUILD SUCCESSFUL.
  • Manual verification:
    • Confirmed main does not already contain an equivalent mismatched-trigger-type test.
  • CI:
    • Not captured (pending on PR).

Validation Gaps

  • None captured; change is a single unit test with no production code impact.

Review Focus

Risks / Reviewer Notes

  • Risk: none material.
    • Evidence: test-only change; production behavior unchanged from main.

Non-goals / Out of Scope

Omitted Context

  • Raw transcript, unrelated exploration, sensitive details, repetitive attempts, and chain-of-thought-style content were omitted.

Note

Low Risk
Test-only change with no runtime behavior impact.

Overview
Adds a unit test in WorkflowNavigatorTest for triggerAction when the componentId matches a trigger (btn-next) but the WorkflowTriggerType does not (UNKNOWN vs ON_PRESS). The test asserts the result is null and currentStep stays on the initial step.

This complements the existing unknown-componentId case by locking in the it.type == triggerType branch in WorkflowNavigator.triggerAction (already on main). No production code changes.

Reviewed by Cursor Bugbot for commit f32d1b5. Bugbot is set up for automated code reviews on this repo. Configure here.

@facumenzella facumenzella requested a review from a team as a code owner April 24, 2026 11:42
@codecov

codecov Bot commented Apr 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.26%. Comparing base (322d1ee) to head (f32d1b5).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3387   +/-   ##
=======================================
  Coverage   80.26%   80.26%           
=======================================
  Files         378      378           
  Lines       15448    15448           
  Branches     2143     2143           
=======================================
  Hits        12400    12400           
  Misses       2189     2189           
  Partials      859      859           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Base automatically changed from cesar/add-enums-for-types to main April 27, 2026 10:25
Adds a missing WorkflowNavigatorTest case verifying triggerAction returns
null and does not navigate when the componentId matches but the
WorkflowTriggerType does not. Suggested during review of #3386.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@facumenzella facumenzella force-pushed the facu/workflow-trigger-type-mismatch-test branch from dd01e3a to bf6876a Compare June 12, 2026 08:54
@facumenzella facumenzella added this pull request to the merge queue Jun 12, 2026
Merged via the queue into main with commit 9af2f58 Jun 12, 2026
38 checks passed
@facumenzella facumenzella deleted the facu/workflow-trigger-type-mismatch-test branch June 12, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants