Skip to content

Fix #6188: Fail test file check for stale test_file_not_required exemptions - #6444

Merged
adhiamboperes merged 2 commits into
oppia:developfrom
jabrailkhalil:fix/6188-stale-test-file-exemptions
Sep 25, 2026
Merged

adhiamboperes merged 2 commits into
oppia:developfrom
jabrailkhalil:fix/6188-stale-test-file-exemptions

Conversation

@jabrailkhalil

@jabrailkhalil jabrailkhalil commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

Fixes #6188: reject stale test_file_not_required exemptions when the corresponding test already exists.

When an existing test is marked with a test_file_not_required exemption, TestFileCheck silently ignores the exemption (because the test exists) and the check still passes. Stale exemptions accumulate unnoticed and hide the fact that a test now exists.

Changes

TestFileCheck now treats a test_file_not_required exemption as a failure when the corresponding test file already exists:

  • New Unnecessary test file exemptions failure section lists each stale exemption with its prod file path.
  • The check returns failure while any stale exemption remains.

The 13 currently stale test_file_not_required exemptions (one per file that already has a test in test/ or sharedTest/) are removed from test_file_exemptions.textproto so the check passes on the current repo state.

Verification

  • New unit tests: prod file with test in test/ or sharedTest/ plus test_file_not_required exemption now fails with the expected output; missing-test exemptions and normal test presence still pass.
  • Ran the compiled check against the full repository (real exemptions file): TEST FILE CHECK PASSED.
  • ktlint 0.37.1 (as pinned in CI) passes on the changed Kotlin files.

Essential Checklist

  • The PR title starts with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The explanation section above starts with "Fixes #bugnum: " (If this PR fixes part of an issue, use instead: "Fixes part of #bugnum: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

Disclosure of LLM Usage

  • Did you use AI/LLMs when working on this PR? Type Yes or No.: Yes
  • If yes, describe the extent AI was used: e.g. brainstorming, debugging, writing code, writing tests, reviewing code, etc. See Fix #5989, #6053, #6059, #6060, #6097, #6200: Rebuild app & WorkManager initialization #6062 for an example.: AI/LLMs were used for investigating the checker behavior, implementing the fix and regression tests, identifying and removing stale exemptions, running validation, and preparing the PR description.

… exemptions

A test_file_not_required exemption is only valid while the corresponding
test file is absent. When the test already exists, the exemption was
silently ignored and the check still passed, hiding exemptions that are
no longer needed.

The check now reports such exemptions as failures ('Unnecessary test
file exemptions') and the 13 currently stale exemptions are removed from
test_file_exemptions.textproto.

Adds regression tests covering the main and sharedTest test directories.
@jabrailkhalil
jabrailkhalil requested a review from a team as a code owner September 10, 2026 19:07
@github-actions

Copy link
Copy Markdown
Contributor

@jabrailkhalil this PR is being marked as draft because you are not assigned to referenced issue #6188 (or it does not exist). You may only fix issues that you are assigned to to help avoid multiple team members duplicating work on the same issue.

@github-actions
github-actions Bot marked this pull request as draft September 10, 2026 19:18
@jabrailkhalil jabrailkhalil changed the title Fix #6188: Fail test file check for stale test_file_not_required exemptions Fixes #6188: Fail test file check for stale test_file_not_required exemptions Sep 10, 2026
@adhiamboperes
adhiamboperes marked this pull request as ready for review September 11, 2026 17:23
@adhiamboperes

Copy link
Copy Markdown
Contributor

Hi @jabrailkhalil, we require the pull requests to follow a template, otherwise the bot is going to mark it as draft. Please copy the template from here: https://github.com/oppia/oppia-android/blob/develop/.github/PULL_REQUEST_TEMPLATE.md. Also look at other recent PRs to have an idea of how folks usually fill out the PR descriptions.

@jabrailkhalil jabrailkhalil changed the title Fixes #6188: Fail test file check for stale test_file_not_required exemptions Fix #6188: Fail test file check for stale test_file_not_required exemptions Sep 11, 2026
@jabrailkhalil

Copy link
Copy Markdown
Contributor Author

Thanks @adhiamboperes! I have updated the PR description to follow the pull request template.

@jabrailkhalil

Copy link
Copy Markdown
Contributor Author

The current code-coverage workflow (run 34684472874, attempt 2) completed successfully, but the pull_request_target coverage-comment run 34684472168 still reflects its earlier action_required attempt and cannot find final-coverage-report. Please rerun the Comment Coverage Report workflow now that the first-time contributor run has been approved. GitHub reports that only a repository admin can do this.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Results

Number of files assessed: 1
Overall Coverage: 99.03%
Coverage Analysis: PASS ✅

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
TestFileCheck.ktscripts/src/java/org/oppia/android/scripts/testfile/TestFileCheck.kt
99.03% 204 / 206 ✅ 70%

To learn more, visit the Oppia Android Code Coverage wiki page

@oppiabot

oppiabot Bot commented Sep 21, 2026

Copy link
Copy Markdown

Hi @jabrailkhalil, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue.
If you are still working on this PR, please make a follow-up commit within 3 days (and submit it for review, if applicable). Please also let us know if you are stuck so we can help you! If you're unsure how to reassign this PR to a reviewer, please make sure to review the wiki page that details the Guidance on submitting PRs.

@oppiabot oppiabot Bot added the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Sep 21, 2026
@Neer-rn

Neer-rn commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

@jabrailkhalil Is this PR ready for review? If yes assign this to a reviewer by @username PTAL. Without assigning this PR it won't be reviewed.

@oppiabot oppiabot Bot removed the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Sep 21, 2026
@jabrailkhalil

Copy link
Copy Markdown
Contributor Author

@adhiamboperes PTAL. This PR is ready for review: issue #6188 is assigned to me, the template is complete, and the coverage report passes at 99.03%.

@oppiabot oppiabot Bot assigned adhiamboperes and unassigned jabrailkhalil Sep 22, 2026
@oppiabot

oppiabot Bot commented Sep 22, 2026

Copy link
Copy Markdown

Unassigning @jabrailkhalil since a re-review was requested. @jabrailkhalil, please make sure you have addressed all review comments. Thanks!

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

LGTM, thanks @jabrailkhalil!

@adhiamboperes
adhiamboperes merged commit 5836867 into oppia:develop Sep 25, 2026
23 of 25 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

✨ Fantastic work @jabrailkhalil! Your very first PR to Oppia has been merged! 🎉🥳

You've just taken your first step into open-source, and we couldn’t be happier to have you onboard. 🙌
If you're feeling adventurous, why not dive into another issue and keep contributing? The community would love to see more from you! 🚀

For any support, feel free to reach out to the developer onboarding lead: @adhiamboperes. Happy coding! 👩‍💻👨‍💻

adhiamboperes added a commit that referenced this pull request Nov 20, 2026
…st_file_not_required exemptions (#6561)

Fixes part of #6557

This PR reverts #6444 which removed stale
`test_file_not_required: true` exemptions because those files already
had tests.

Unexpectedly, this exposed an issue with coverage configuration:

The coverage runner currently passes
`--instrumentation_filter=//app/....`. This filter excludes sources
built in the root `//app` package, including the four affected UI
classes in #6547.
Their tests pass, but Bazel doesn’t collect coverage for those classes.
The reporter then fails because it cannot find their source records.

Consequently:
1. Before the commit, all six files bypassed coverage analysis.
2. After it, coverage analysis started checking them.
3. That exposed the four missing source records and the two abstract
modules’ 0/0 results.
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.

[BUG]: Test file checker doesn't catch existing tests

3 participants