genkit icon indicating copy to clipboard operation
genkit copied to clipboard

Repo-wide license header check only runs on Python PRs

Open hilariie opened this issue 5 months ago • 0 comments

Summary

Missing license headers in some JS file types can merge to main without CI catching them, then surface later on an unrelated PR that happens to touch py/**. We just hit this: two .mjs files added in #5426 failed the license check on a Python PR that did not add them.

Root cause: two header checks with different coverage

The repo has two separate header checks, and they do not cover the same files.

  1. scripts/copyright.ts, run on every PR via pnpm format:check in formatter.yml (no path filter). It only recognizes these extensions:

    { regex: /\.((ts)|(scss)|(js))$/, ... }  // .ts .scss .js
    { regex: /\.html$/, ... }                // .html
    { regex: /\.go$/, ... }                  // .go
    

    So .mjs, .cjs, .tsx, .jsx, and .css are never checked.

  2. bin/check_license (addlicense), in the "Security and Compliance" job in python.yml. It scans the whole repo and does recognize .mjs, but the workflow is path filtered:

    on:
      pull_request:
        paths:
          - "py/**"
          - "genkit-tools/**"
          - ".github/workflows/python.yml"
    

    So it only runs when a PR touches Python.

Why #5426 slipped through

#5426 added eslint.config.mjs and postcss.config.mjs with no header.

  • The always-on check (scripts/copyright.ts) ignores .mjs, so it passed.
  • The check that catches .mjs (addlicense) never ran, because the PR was JS only and did not touch py/**.

The next PR to touch Python ran addlicense, which scans everything, and failed on the two .mjs files. The failure pointed at the wrong PR and author.

Fix options

  1. Add the missing extensions (.mjs, .cjs, .tsx, .jsx, .css) to scripts/copyright.ts so the always-on check covers them. Smallest change.
  2. Run bin/check_license on all PRs instead of only py/**, so the comprehensive scan is not gated behind Python.
  3. Settle on one tool as the source of truth so coverage cannot drift between the two.

hilariie avatar Jun 26 '26 09:06 hilariie