Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: github/codeql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 52f2ac6
Choose a base ref
...
head repository: github/codeql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 62a0475
Choose a head ref
  • 1 commit
  • 12 files changed
  • 1 contributor

Commits on Jul 30, 2026

  1. Support --learn for inline expectations via learnEdits

    `codeql test run --learn` could previously only rewrite `.expected`
    files; inline expectations (the `// $ Alert` comments checked by
    `InlineExpectationsTest`) had to be fixed by hand. This teaches the
    shared test library to compute those source edits so the test runner
    can apply them.
    
    The `test-postprocess` query now exposes a `learnEdits` relation
    (`file, line, operation, startColumn, endColumn, text`) describing the
    minimal source rewrite that would make the inline expectations match the
    actual query results. It covers:
    
      - appending a fresh comment carrying every tag learned for a line that
        has an unexpected result and no existing comment to merge into;
      - rewriting an existing expectation comment as a whole so it matches
        the current results: dropping fixed-spurious tags, promoting a
        `MISSING:` expectation that now fires, clearing a stale `SPURIOUS:`
        annotation, and merging in freshly learned tags, re-rendering the
        remaining expectations (or deleting the comment when none remain);
      - preserving expectations this test does not own -- e.g. a tag
        annotated with a different query's id that shares the source file --
        and any trailing regular note (`// $ Alert // note`);
      - recording any unexpected result, not just `Alert`.
    
    Edits are emitted as a query predicate rather than applied here: the
    engine consumes `learnEdits` only under `--learn` and ignores it
    otherwise, so ordinary `test run` output is unchanged.
    
    Comment syntax is provided per language by each
    `InlineExpectationsTestQuery.ql`'s `Input` (`getStartCommentMarker`),
    which for now renders only line-comment languages; block-comment
    languages (XML/YAML) can supply their markers later without changing
    this relation's shape.
    d10c committed Jul 30, 2026
    Configuration menu
    Copy the full SHA
    62a0475 View commit details
    Browse the repository at this point in the history
Loading