The advisory baseline check has announced a deviation on every PR since #113: the tree "carries 4 tests marked @FailsOnEmulatorApi37" where it carries three and FAILS_ON_EMULATOR_API37_BASELINE says three. The fourth is a KDoc in Media3EngineTest saying the opposite -- "Deliberately not `@FailsOnEmulatorApi37`: nothing here decodes or encodes" -- which the old matcher counted because it looked for the string anywhere on any line. Neither ingredient was wrong on its own, and the number is not the real damage. #83 added this check so that a new failure joining the known ones could not be invisible; a notice that is wrong every single time teaches everyone to skim past deviation notices, which is precisely the signal it was built to create. Editing the baseline to 4 would have silenced it by breaking it -- the check would then have been wrong the moment someone added or removed a real marker. Anchor the pattern at line start and require whitespace or end-of-line after the name. The second half is the part that is easy to get wrong: "only the annotation on a line of its own" also stops counting `@FailsOnEmulatorApi37 @Test`, which is legal Kotlin, and undercounting is the dangerous direction -- it hides a genuine new marker, the one thing this exists to catch. Measured against a fixture carrying every shape at once: the old matcher 5, own-line-only 2, this one 3; on the real tree 4 / 3 / 3, so the baseline is untouched. `grep -v import` goes too, since `^[[:space:]]*@` cannot match an import. The check is a pure function of the working tree, so the fixture is committed and e2e-report-shape-test.sh runs the real report against it -- inside a throwaway repo root, which the script finds from BASH_SOURCE, so no knob had to be added that could point the live count somewhere else. The fixture sits under .github/, where Gradle does not compile it and :app's ktlint and detekt do not see it; running the report against the real root with it committed still reports 3. Every other path through the report is byte-identical to the previous version on both stdout and the job summary -- passing, failing, wedged, no-run, and advisory-with-an-unreadable-baseline all diff empty -- and the two advisory legs differ only by the false line disappearing. No job's status or pass/fail rules change; the advisory leg stays continue-on-error and stays red by design. The test is deliberately not wired into CI: adding a step to Static analysis would add a new way for a gating job to go red, which #120 ruled out. shellcheck still covers the file, since that step reads `git ls-files '*.sh'`. Closes #120 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
55 lines
2.2 KiB
Kotlin
55 lines
2.2 KiB
Kotlin
// NOT A TEST, AND NEVER COMPILED. This is fixture data for e2e-report-shape-test.sh, which
|
|
// copies it into a throwaway repo root and runs the real report script against that. It lives
|
|
// under .github/ deliberately: Gradle only compiles app/src/**, ktlint and detekt are applied to
|
|
// :app only, and the report's own count reads app/src/androidTest -- so nothing here can reach
|
|
// the build, the linters, or the number the advisory job compares against. Verified by running
|
|
// the report against the real repo root with this file committed: still 3.
|
|
//
|
|
// It carries every shape the counter has to tell apart, in one file, because the bug in #120 was
|
|
// exactly that two of them look alike to a substring match. Three count and three must not:
|
|
//
|
|
// COUNTS the annotation on its own line
|
|
// COUNTS the annotation sharing a line with @Test -- legal Kotlin, and the case the
|
|
// obvious "own line only" repair silently drops
|
|
// COUNTS the annotation indented inside a nested class
|
|
// must NOT a KDoc mentioning it -- this is #120 itself, copied from Media3EngineTest
|
|
// must NOT a commented-out annotation
|
|
// must NOT the import
|
|
//
|
|
// Three count. That is what the synthetic baseline in the test is set to, so the fixture and the
|
|
// baseline agree exactly the way the real tree and FAILS_ON_EMULATOR_API37_BASELINE do.
|
|
//
|
|
// The `@Test` here is spelled the way a real test spells it so the fixture reads like source
|
|
// rather than like a regex exercise. Nothing runs it.
|
|
|
|
package org.libremediaconverter.fixture
|
|
|
|
import org.junit.Test
|
|
import org.libremediaconverter.FailsOnEmulatorApi37
|
|
|
|
class MarkerShapes {
|
|
@FailsOnEmulatorApi37
|
|
@Test
|
|
fun ownLine() = Unit
|
|
|
|
@FailsOnEmulatorApi37 @Test
|
|
fun sameLineAsTest() = Unit
|
|
|
|
/**
|
|
* Deliberately not `@FailsOnEmulatorApi37`: nothing here decodes or encodes, so no emulator
|
|
* codec is involved and the API 37 image has no quarrel with it.
|
|
*/
|
|
@Test
|
|
fun mentionedInKdoc() = Unit
|
|
|
|
// @FailsOnEmulatorApi37 -- taken off on 2026-01-01, kept as a note rather than deleted
|
|
@Test
|
|
fun commentedOut() = Unit
|
|
|
|
class Nested {
|
|
@FailsOnEmulatorApi37
|
|
@Test
|
|
fun indentedDeeper() = Unit
|
|
}
|
|
}
|