Skip to content

feat/v2-logging: Name outcome and situation on every summary log line#21

Merged
vedanthvdev merged 1 commit intomasterfrom
feat/v2-logging
Apr 22, 2026
Merged

feat/v2-logging: Name outcome and situation on every summary log line#21
vedanthvdev merged 1 commit intomasterfrom
feat/v2-logging

Conversation

@vedanthvdev
Copy link
Copy Markdown
Owner

Summary

Closes the last open Phase 1 follow-up from docs/DESIGN-v2.md §0 — the summary log format now names the outcome (SELECTED / FULL_SUITE / SKIPPED) and the situation on every run, so CI dashboards and operators can bucket runs without parsing the tail of the line.

Before

Affected Tests: 3 changed file(s), 2 production class(es), 5 test class(es) affected
Affected Tests: 1 changed file(s); running full suite (runAllOnNonJavaChange=true / onUnmappedFile=FULL_SUITE — non-Java or unmapped file in diff).
Affected Tests: 1 changed file(s), 0 production class(es), 0 test class(es) affected
Skipping test execution (ALL_FILES_IGNORED: SKIPPED).

Two summary shapes, no outcome name on the SELECTED branch, and SKIPPED was a follow-up line with different vocabulary.

After

Affected Tests: SELECTED (DISCOVERY_SUCCESS) — 3 changed file(s), 2 production class(es), 5 test class(es) affected
Affected Tests: FULL_SUITE (UNMAPPED_FILE) — 1 changed file(s); running full suite (runAllOnNonJavaChange=true / onUnmappedFile=FULL_SUITE — non-Java or unmapped file in diff).
Affected Tests: SKIPPED (ALL_FILES_IGNORED) — 1 changed file(s); every changed file matched ignorePaths.

One unified shape — Affected Tests: <OUTCOME> (<SITUATION>) — <details> — across all three branches.

What changed

  • AffectedTestTask.renderSummary rewritten to three explicit branches (runAll / skipped / selected), each prefixed with <OUTCOME> (<SITUATION>) —.
  • New describeSkipReason(Situation) helper mirrors the existing describeEscalation so every SKIPPED situation has a distinct phrase:
    • EMPTY_DIFFno changed files detected
    • ALL_FILES_IGNOREDevery changed file matched ignorePaths
    • ALL_FILES_OUT_OF_SCOPEevery changed file sat under out-of-scope dirs
    • UNMAPPED_FILEonUnmappedFile=SKIPPED — non-Java or unmapped file in diff
    • DISCOVERY_EMPTYno affected tests discovered
    • DISCOVERY_SUCCESS → throws (engine contract violation)
  • Redundant follow-up log removed: the "Skipping test execution ({}: {})." side-line was duplicating what the new summary now carries, so it's gone. The defensive "No affected tests to run. Skipping test execution." fallback is also silenced — the engine should already route that through DISCOVERY_EMPTY/SKIPPED, and the summary line above covers it.
  • README.md grows a Summary log format section with concrete samples for all three branches and a note on which pre-v2 phrases are preserved.

Backward compatibility

Every pre-v2 CI-grep phrase still appears verbatim in the reason segment:

  • running full suite
  • runAllIfNoMatches=true
  • runAllOnNonJavaChange=true
  • no affected tests discovered
  • no changed files
  • production class(es) / test class(es) / changed file(s)

This change is purely additive on the log string — it prefixes every line with OUTCOME (SITUATION) — and expands the SKIPPED branch from a follow-up line into the summary. No existing grep should break.

Tests

  • AffectedTestTaskLogFormatTest gains four new cases:
    • summaryPrefixNamesOutcomeAndSituationOnEveryBranch — pins the new prefix for SELECTED / FULL_SUITE / SKIPPED.
    • skippedBranchNamesReasonPhraseForEachSituation — iterates every non-DISCOVERY_SUCCESS situation and asserts the matching phrase is present.
    • describeSkipReasonRejectsDiscoverySuccess / describeSkipReasonRejectsNull — enforce the engine contract at the helper level.
  • The existing formatPlaceholderCountMatchesArgsLength… guard is generalised to cover all three branches so the SLF4J placeholder/arg contract is validated for the new SKIPPED format too.

Test plan

  • ./gradlew check (core + gradle test + functionalTest + validatePlugins) passes locally.
  • CI run on this branch stays green.
  • Spot-check that the existing Modulr security-service pipeline log (which greps running full suite + runAllOnNonJavaChange=true) still matches.

Every `affectedTest` run previously printed one of two summary lines
— a runAll variant that named the escalation reason, or a non-runAll
variant that listed counts — and a separate side-line for SKIPPED
outcomes. Operators had to grep across both forms and infer the
outcome from context, and SKIPPED runs carried the outcome name
("SKIPPED") only in a follow-up log that used different vocabulary
from the main summary.

This change rewrites `renderSummary` to produce one unified shape:
`Affected Tests: <OUTCOME> (<SITUATION>) — <details>`, with three
branches for SELECTED, FULL_SUITE, and SKIPPED. The outcome and
situation are first-class fields on every run so CI dashboards can
bucket runs with a single grep (`^Affected Tests: (SELECTED|FULL_SUITE|SKIPPED)`)
and the reader always sees which of the six situations the engine
resolved to. Every pre-v2 phrase ("running full suite",
"runAllIfNoMatches=true", "runAllOnNonJavaChange=true",
"no affected tests discovered") still appears verbatim in the reason
segment so existing greps keep working. A new `describeSkipReason`
helper mirrors `describeEscalation` to give each SKIPPED situation a
distinct phrase (e.g. "every changed file matched ignorePaths" vs
"every changed file sat under out-of-scope dirs"), and the now-
redundant "Skipping test execution (…)" follow-up line is removed
since the summary already carries that information. The README grows
a Summary log format section with samples for all three branches, and
the log-format test suite gains coverage for the new prefix on every
branch, each SKIPPED reason phrase, and the DISCOVERY_SUCCESS guard
in `describeSkipReason`.
@vedanthvdev vedanthvdev merged commit 7ea6bcd into master Apr 22, 2026
1 check passed
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.

1 participant