Skip to content

RDKB-66207: [CI] gcc diff-gate on gcc-14, complexity and source-coverage nudges - #1538

Merged
mateuszCieslak-GL merged 6 commits into
rdkcentral:developfrom
mateuszCieslak-GL:ci/nudges
Oct 23, 2026
Merged

mateuszCieslak-GL merged 6 commits into
rdkcentral:developfrom
mateuszCieslak-GL:ci/nudges

Conversation

@mateuszCieslak-GL

@mateuszCieslak-GL mateuszCieslak-GL commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Reason for change.

  • gcc diff-gate recompiles with gcc 14. Base and head are recompiled with gcc-14 / g++-14
    (preinstalled on the ubuntu-24.04 runner; the build itself stays on gcc 13), so the gate also
    covers the two default errors gcc 13 has no flag for: -Wreturn-mismatch (what actually breaks
    this build on gcc 14) and -Wdeclaration-missing-parameter-type; -Wcalloc-transposed-args joins
    the warnings. The recompile also undefines _FORTIFY_SOURCE: Ubuntu's gcc fortifies at -Os,
    which reports an overflowing memcpy/strcpy inside a glibc header, a line the gate never
    matched; it is now reported on the .c line.
  • Complexity nudge. lizard compares each changed function's cyclomatic complexity at the PR base
    and head. A function the PR pushes over 30 gets a ❗ inline comment on its first changed line and
    a summary entry; one that grew by 5 or more and ends at 20 or above is listed in the summary. A
    function moved out of another changed or removed file keeps its old complexity. If lizard cannot
    analyze a file, nothing is compared and the summary says so. Never fails the build.
  • Source-coverage nudge. A source file the PR adds that a Makefile.am builds but neither
    build/linux/{bpi,rpi}/makefile compiles (explicit entries plus what their $(wildcard ...)
    patterns match, minus $(filter-out ...); in a directory a leg already compiles from) is
    reported in the summary with a file annotation: CI would never compile it. XB-only files are the
    legitimate exception, so it never fails the build.
  • The summary comment gets a nudge section after the diff-scoped checks, each nudge capped at 6000
    bytes or its share of what is left above a 4000-byte build minimum;
    the inline job posts complexity comments alongside gcc and clang-tidy ones. ci-README.md 3d, 3f,
    3g and the artifact lists updated.

Both nudges report only what the PR adds (complexity compared with the base, coverage on added
files). The stage-2 parts (summary section, inline complexity comments) run from develop, so they
take effect after merge.

@mateuszCieslak-GL
mateuszCieslak-GL requested a review from a team as a code owner October 22, 2026 00:05
Copilot AI balanced review requested due to automatic review settings October 22, 2026 00:05

Copilot AI 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.

🟡 Changes recommended

Coverage classification, complexity comparison, and summary budgeting can produce incorrect or truncated CI feedback.

5 open issues
What changed in this PR

This PR extends OneWifi’s diff-scoped CI feedback while keeping the main build on GCC 13 and the new nudges non-blocking.

Changes:

  • Recompile the GCC diff gate with GCC 14, expand warning coverage, and disable fortification during analysis.
  • Add complexity-delta and source-coverage nudges with unit tests.
  • Integrate nudge artifacts into summary and inline comments, and document their behavior.
File Description
ci-README.md Documents GCC 14 analysis, nudges, and artifacts.
.github/​workflows/​pr-comments.yml Includes nudge summaries and inline complexity candidates.
.github/​workflows/​makefile.yml Configures GCC 14 and runs both nudges.
.github/​scripts/​tests/​test_source_coverage.py Tests source parsing and coverage classification.
.github/​scripts/​tests/​test_gcc_diff_gate.py Tests compiler substitution and analysis flags.
.github/​scripts/​tests/​test_complexity_delta.py Tests complexity parsing, comparison, and output.
.github/​scripts/​source_coverage.py Detects added sources missing from CI build coverage.
.github/​scripts/​review_poster.py Assigns complexity findings a posting priority.
.github/​scripts/​gcc_diff_gate.py Supports compiler overrides and disables fortification.
.github/​scripts/​complexity_delta.py Compares function complexity and produces advisory feedback.

Review effort: Balanced

Comment thread .github/scripts/complexity_delta.py
Comment thread .github/scripts/complexity_delta.py
Comment thread .github/scripts/source_coverage.py Outdated
Comment thread .github/scripts/source_coverage.py Outdated
Comment thread .github/workflows/pr-comments.yml Outdated
@mateuszCieslak-GL mateuszCieslak-GL added the enhancement New feature or request label Oct 22, 2026
Copilot AI balanced review requested due to automatic review settings October 22, 2026 00:38

Copilot AI 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.

🔵 Needs a closer look

Complexity analysis can report false crossings for moved functions and select invalid inline anchors in renamed files.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Preserve rename mapping for valid inline comment anchors

.github/​scripts/​complexity_delta.py:119

The workflow includes renamed files, but limiting this diff to the new path excludes the old path from rename detection. Git then reports the whole file as added. If a function in a renamed file grows from CCN 29 to 31, first_changed selects its definition rather than its first edited line. When that definition is outside the PR's rename diff, the review API rejects the inline comment and review_poster skips it on HTTP 422. Preserve the old/new path mapping and derive ranges from a rename-aware diff containing both paths, so the comment anchors to an actual edited line.

Medium severity Aggregate maximum complexity for ambiguous moved functions

.github/​scripts/​complexity_delta.py:235

When multiple changed or removed files lose a function with the same name, this comprehension keeps the last complexity value, so the baseline depends on file order. Moving an unchanged CCN-40 helper into a new file while deleting a CCN-12 namesake elsewhere can therefore produce a false 12 -> 40 crossing. Aggregate the maximum CCN per moved name, as parse_lizard_csv already does within a file, so ambiguous moves remain conservative rather than reporting complexity the PR did not introduce.

5 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 22, 2026 01:29

Copilot AI 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.

🔵 Needs a closer look

The compiler switch and two-stage artifact/comment integration need end-to-end CI validation and final human review.

No open issues 🎉

Review effort: Balanced

Copilot AI 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.

🟢 Approval recommended

No unresolved blocking issues remain, and prior feedback is addressed or accepted as documented limitations.

No open issues 🎉

Review effort: Balanced

Base and head are recompiled with gcc-14/g++-14 (preinstalled on the
runner), gating -Wreturn-mismatch and -Wdeclaration-missing-parameter-type
too. -U_FORTIFY_SOURCE puts mem*/str* overflows on the .c line.
lizard compares per-function CCN at the PR base and head. A function
pushed over 30 gets an inline warning and a summary entry; one that grew
by 5 to 20 or more is listed in the summary. Moved functions keep their CCN.
Report an added source that a Makefile.am builds but neither the bpi
nor the rpi makefile compiles, in a directory a leg already compiles
from: summary section plus a file annotation; never fails the build.
complexity: a lizard failure stops the comparison (no false "new at N").
source coverage: expand leg $(wildcard)s minus $(filter-out); am tokens
relative to their Makefile.am. Summary: nudges share what is left above
a 4000-byte build minimum, so the build budget never goes negative.
A moved function's base CCN is the highest among this file's base and the
files that lost that name (Copilot round 2). README: renamed-file anchor.
#ifdef/#else pairs that each open a brace derailed lizard and hid the
rest of the file: 344 functions in 8 core files. -Ecpre skips #else.
Copilot AI balanced review requested due to automatic review settings October 23, 2026 16:12

Copilot AI 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.

🟢 Approval recommended

No unresolved blocking findings remain, and the changes preserve non-blocking nudge behavior and the existing two-stage posting trust boundary.

No open issues 🎉

Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

🔨 Build summary

Commit d41d86a · Build Check #5781

Banana Pi R4 - MLO — build success

⚠️ OneWifi warnings: 0

Raspberry Pi — build success

⚠️ OneWifi warnings: 0


🔬 Diff-scoped checks (changed lines only)

🔎 clang-tidy: no changed .c/.cpp to scan

🚦 gcc diff-gate: clean on changed lines

@mateuszCieslak-GL
mateuszCieslak-GL merged commit 24ae4db into rdkcentral:develop Oct 23, 2026
15 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants