Skip to content

Report Dockerfile RUN provenance for installed requirements - #630

Merged
patrickballard merged 10 commits into
wheelgap:mainfrom
kunalkshah1:fix/dockerfile-input-report-provenance
Nov 21, 2026
Merged

patrickballard merged 10 commits into
wheelgap:mainfrom
kunalkshah1:fix/dockerfile-input-report-provenance

Conversation

@kunalkshah1

Copy link
Copy Markdown
Contributor

Closes #599

What this changes

Put the installing Dockerfile RUN line beside each requirements input in text and Markdown. Add the dockerfile_inputs array to JSON, preserving the existing sources labels. GitHub annotations point to the requirement line and identify the RUN in the message. The stderr diagnostic remains.

Tests cover two distinct RUN lines and input files, schema validation, annotation message and location, and byte-for-byte output parity when Dockerfile input discovery is disabled. The three provenance checks fail on the original source.

AI tools used: Codex

Ruff formatting and lint, mypy, and the full pytest suite passed locally (5,187 passed, 3 skipped). The Unreleased entry will be added with the PR number.

@patrickballard

Copy link
Copy Markdown
Collaborator

Thanks @kunalkshah1, this looks good overall: the installing RUN line now shows beside each input in the text and Markdown reports, in a new dockerfile_inputs array in --json (with the schema and docs updated) and in the annotation message, and the output is unchanged when input discovery is off.

It touches the same parts of dockerfile.py and cli.py as your other --dockerfile-inputs PRs (#621, #622, #625, #626, #630), so Patrick will sort out the merge order and any conflicts between them.

CI is green on this commit.

#599 is a help wanted issue, so Patrick will review and merge this one himself. Nothing more needed from you for now.

(Review assisted by Claude.)

Kunal Shah and others added 5 commits November 21, 2026 16:20
…tinued RUN

Merges main (CHANGELOG conflict only). The docs now mark the header, the dockerfile_inputs key and the annotation text as after 0.13.0, say which line a RUN that continues over several lines gets and what file holds, and sit away from the text sample that wheelgap#629 marks. New tests: a RUN continued over four lines in a Dockerfile in its own folder with --dockerfile-context (header, --json and annotation all name the line it starts on), and no dockerfile_inputs key or installed-by text without --dockerfile-inputs.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The author merged main while the review was under way; this joins the two, keeping the longer CHANGELOG bullet.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…#628's

Both PRs added a paragraph at the same spot in docs/output.md, which would conflict whichever merges second.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
CHANGELOG conflict only: both bullets kept, this PR first.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@patrickballard

Copy link
Copy Markdown
Collaborator

Thanks @kunalkshah1! Adding to the earlier review: the --json key is only added, annotations go through the usual escaping, and without --dockerfile-inputs the output is unchanged.

We've made these changes so it can go in:

  • Docs marked "after 0.13.0", and they now say which line a continued RUN gets and what file holds.
  • Two tests: a RUN continued over several lines with a separate build context (header, --json and annotation agree on the line), and no key without the flag.
  • The CHANGELOG bullet is reworded, and main is merged in.

It'll merge once a final review passes.

(Review assisted by Claude.)

patrickballard and others added 3 commits November 21, 2026 11:14
CHANGELOG.md conflicted with wheelgap#622's bullet: both kept, this PR's first.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The file value was the path as wheelgap joined it, so it changed with the working directory, with how --dockerfile-context was given (absolute or not) and with the OS's separator. It is now the path the Dockerfile's COPY names: relative to the build context, with /. The schema describes the three keys.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@patrickballard
patrickballard merged commit 000ec96 into wheelgap:main Nov 21, 2026
13 checks passed
@patrickballard

Copy link
Copy Markdown
Collaborator

Merged, thanks @kunalkshah1! One change from the final review, made before the key becomes public: file in dockerfile_inputs is the path relative to the build context with / on every OS, the name the Dockerfile's COPY uses. Before, it varied with the OS and with how the context was given.

(Reply assisted by Claude.)

patrickballard added a commit to kunalkshah1/wheelgap that referenced this pull request Nov 21, 2026
main gained wheelgap#622 (pip flags, -c FILE on the RUN line, the --prefer-binary
gate), wheelgap#621 (verified -r/-c includes) and wheelgap#630 since this branch was written.

dockerfile.py: main moved the COPY lookup into _find_copied_file, called by
the copied_requirements closure and by _check_includes. The ignore rules are
now a required argument of _find_copied_file and _check_includes and reach
_copied_file from both, so a file that .dockerignore leaves out under a folder
COPY is refused with the rule named whether it is the installed file, a -c
file on the RUN line, or a -r/-c inside either. Without this an excluded
include would have been read from disk although the image doesn't have it.
The old "a .dockerignore is refused" loop stays deleted (main still had it),
and the merged docstring no longer lists a .dockerignore among the refusals.

tests: both sides' new tests are kept; the nested-includes test keeps wheelgap#621's
assertions and this branch's removal of its .dockerignore tail. New tests for
the interaction: an excluded include (one and two levels down), an excluded
-c file, an excluded -r inside the -c file, the same under --prefer-binary,
an include a later ! rule puts back (and a later rule takes out again), a
file COPY naming an excluded source, and the CLI looking nothing up.

docs/cli.md: the ignore-file paragraph says included and constraints files
are covered. CHANGELOG: every bullet once, this PR's first.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
patrickballard added a commit to kunalkshah1/wheelgap that referenced this pull request Nov 21, 2026
…t be pinned

main gained -c FILE and harmless pip flags (wheelgap#622), verified includes (wheelgap#621),
.dockerignore rules (wheelgap#626), install provenance (wheelgap#630), uv's Requires-Python
lower-bound rule (wheelgap#623) and MCP wording (wheelgap#624) since this branch was written.

_pip_install_files returns (files, constraints, prefer_binary, uv) and has one
flag loop with the uv branch first. On a uv line only uv's own flags are read:
--system, -r/--requirements, -c/--constraints, --no-cache, --no-cache-dir,
--upgrade/-U and --quiet/-q (checked against `uv pip install --help`, 0.13.1).
pip's --no-input, --root-user-action and --prefer-binary don't exist in uv, and
--disable-pip-version-check only warns there, so they are refused.

A uv line's files are found by the same copied_requirements closure as pip's,
so the ignore rules and the include checks apply. Three things are uv's own:
- every requirement must be pinned with == (through includes; a pin from a
  constraints file counts), using the gate --prefer-binary already had, and
  --deps is refused: wheelgap resolves a range as pip does, and uv can pick
  another release;
- a -r inside a constraints file is refused: pip installs what it names and uv
  only constrains with it (uv 0.13.1 against pip 26.2);
- included and -c files must be named *.txt or *.in, like the -r file.
A file installed by pip on one line and uv on another is refused, and a caller
that doesn't pass uv_installs gets an error rather than pip's answer.

cli.py: the stderr note keeps main's list of every file read and says which
installer ran; uv-installed files get restore_uv_python_files, as a uv.lock
with --online does, so the pip_refuses note is main's.

docs/cli.md has one paragraph for uv; CHANGELOG keeps every bullet once, this
PR's first, reworded.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@patrickballard patrickballard mentioned this pull request Nov 23, 2026
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.

--dockerfile-inputs: say which Dockerfile line installs each file, in the table, --json and the annotations

2 participants