Conversation
📝 WalkthroughWalkthroughRegisters JSON deserializers for several provenance types, adds a TreeProvenance constructor, implements a new Changes
Sequence Diagram(s)sequenceDiagram
participant User as User/CLI
participant Cmd as CmdProvenanceShow
participant Store as Store
participant Reg as ProvenanceRegistry
participant Display as Formatter
User->>Cmd: nix provenance show <store-path>
Cmd->>Store: request provenance JSON for path
Store->>Reg: Provenance::from_json(provenance JSON)
Reg->>Reg: match "type" and call registered parser (may call from_json recursively for "next")
Reg-->>Store: std::shared_ptr<const Provenance>
Store-->>Cmd: provenance object
Cmd->>Display: displayProvenanceChain(provenance)
Display->>Display: dynamic cast to Copied/Build/Flake/Tree/Subpath
Display-->>User: formatted provenance chain (or JSON fallback)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/nix/provenance-show.md`:
- Around line 17-28: Add a brief note to the provenance docs indicating that the
command is behind the experimental feature gate named "provenance" so users know
it may be disabled by default; update the section that introduces "nix
provenance" (the heading and the opening paragraphs describing what it shows) to
include a single sentence like "This command is experimental and requires
enabling the 'provenance' feature flag" and, if present, link to the global
experimental features/configuration instructions for enabling it.
In `@tests/functional/flakes/provenance.sh`:
- Around line 123-125: Replace the hard-coded /tmp/x write and duplicate `nix
provenance show "$outPath"` invocation by capturing the command output once
(e.g., assign the result of `nix provenance show "$outPath"` to a variable) and
use that variable in the subsequent comparison block; remove the `> /tmp/x`
write and the second command call so the script uses the single captured value
for the `[[ ... = $(cat <<EOF` check.
261b1bc to
06d9828
Compare
06d9828 to
0a5eef6
Compare
| if (info->provenance) | ||
| displayProvenance(*store, storePath, info->provenance); | ||
| else | ||
| logger->cout(ANSI_RED " (no provenance information available)" ANSI_NORMAL); |
There was a problem hiding this comment.
I think we should probably exit with an error in this case; wdyt?
There was a problem hiding this comment.
Not sure, a path having no provenance is in itself not an error. For a nix provenance verify command it should be, but it's probably fine here.
Motivation
This adds a subcommand
nix provenance showthat displays the provenance record of a store path in a human-readable form, e.g.Context
Summary by CodeRabbit
New Features
nix provenance showto print the provenance chain for store paths; now recognizes and displays more provenance kinds (build, flake, subpath, tree, etc.) and nested provenance links.Documentation
Tests
nix provenance showoutput for flake-based store paths.