Make entire "why" deterministic across clones and surface actionable checkpoint-metadata miss reasons#1552
Open
karthik-rameshkumar wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves entire why attribution diagnostics when checkpoint metadata can’t be resolved locally by adding a structured “missing reason” field, propagating it through attribution resolution, and surfacing it in both human-readable and JSON outputs. It also changes entire why to attempt the same remote-refresh path as entire checkpoint explain when metadata is missing, and adds tests covering the new behavior.
Changes:
- Add
metadata_missing_reasonto per-line (attributionLine) and per-checkpoint (attributionCheckpointContext) attribution payloads and propagate it through resolution and rendering. - Enable fetch-on-miss in the
entire whypath so missing metadata triggers the remote enrichment attempt. - Add tests validating the reason appears in outputs and that checkpoint maps remain stable across successive calls.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/attribution.go | Adds missing-metadata reason plumbing and display; enables fetch-on-miss for entire why. |
| cmd/entire/cli/attribution_test.go | Adds coverage for missing-reason propagation and stable checkpoint-map behavior. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Low
Comment on lines
+223
to
+225
| // entire why is explanation-focused: when local metadata is missing it | ||
| // should attempt the same remote enrichment path as checkpoint explain. | ||
| result, err := resolveFileAttribution(ctx, file, true) |
Comment on lines
420
to
423
| if err != nil { | ||
| ctx.MetadataMissing = true | ||
| ctx.MetadataMissingReason = metadataMissingReason(r.ctx, cpID.String(), err) | ||
| return ctx |
| if line == nil || len(line.Candidates) == 0 { | ||
| return nil | ||
| func metadataMissingReason(ctx context.Context, checkpointID string, cause error) string { | ||
| reason := "checkpoint metadata was not found locally" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances the attribution "why" functionality by providing more informative error messages and metadata when checkpoint metadata is missing. It introduces a new field to capture the reason for missing metadata, ensures this reason is propagated through the codebase, and improves both the human and JSON output to include actionable suggestions for remediation. Several new tests are added to verify these behaviors.
Improvements to missing metadata handling:
MetadataMissingReasonfield to bothattributionLineandattributionCheckpointContextstructs to store detailed reasons when checkpoint metadata is missing. [1] [2]metadataMissingReasonfunction to generate actionable and descriptive messages, including suggested commands to fetch missing metadata.MetadataMissingReasonfield when metadata is unavailable, including after failed remote fetch attempts. [1] [2] [3]User-facing output improvements:
MetadataMissingReasonwhen available, giving users clearer guidance on how to resolve missing metadata issues. [1] [2]Testing enhancements: