Skip to content

Fix 'Error resolving revision' flash after package creation#4778

Merged
sir-sigurd merged 3 commits intomasterfrom
sergey/fix-partial-cache-revision-error
Mar 23, 2026
Merged

Fix 'Error resolving revision' flash after package creation#4778
sir-sigurd merged 3 commits intomasterfrom
sergey/fix-partial-cache-revision-error

Conversation

@sir-sigurd
Copy link
Member

@sir-sigurd sir-sigurd commented Mar 23, 2026

Description

After packageConstruct mutation, the GraphCache has the new revision cached under revision(hashOrTag: "latest") but not under the specific hash. When the success dialog navigates to the package page using the specific hash, GraphCache returns a partial cache hit with revision: null.

The code only checked fetching to show the loading placeholder, missing the partial cache case. This caused "Error resolving revision" to render until the background network fetch completed with the real data.

Fix: Check for partial cache outcome (as the fold helper already does) to show the loading placeholder instead of the error.

TODO

🤖 Generated with Claude Code

Greptile Summary

This PR fixes a brief "Error resolving revision" flash that appeared when navigating to a just-created package. It replaces manual fetching/error/data checks with the existing GQL.fold helper, which correctly handles urql GraphCache partial cache hits.

Root cause: After a packageConstruct mutation, GraphCache has the revision cached under revision(hashOrTag: "latest") but not under the specific hash. Navigating to the specific hash returns a partial cache hit (cacheOutcome === 'partial') with revision: null. The old imperative checks only gated on fetching, so the partial cache response fell through to render PackageTree with a null revision, triggering the error display.

Fix: GQL.fold (in utils/GraphQL/wrappers.ts, line 96) already detects cacheOutcome === 'partial' and routes it to the fetching handler by default, showing the loading placeholder until the real network response arrives. Switching to GQL.fold is therefore both the idiomatic pattern in this codebase and the correct solution.

Additional changes:

  • Minor JSX whitespace fix in the "No Such Package" message (adds an explicit {' '} between the <M.Box> close tag and "could"), which is a no-op in rendering but cleaner formatting.
  • Changelog entry added.

Confidence Score: 5/5

  • Safe to merge — minimal, targeted fix using an established codebase pattern with no regressions.
  • The change is small and well-reasoned. GQL.fold already handles the partial cache case correctly (confirmed by reading wrappers.ts line 96). The fix is consistent with how other components in the codebase use fold. No new logic is introduced, no data paths are changed, and the only behavioral delta is showing a loading placeholder instead of a broken UI during the brief window between navigation and the real network response.
  • No files require special attention.

Important Files Changed

Filename Overview
catalog/app/containers/Bucket/PackageTree/PackageTree.tsx Refactors PackageTreeQueries to use GQL.fold, which correctly treats partial cache hits (cacheOutcome === 'partial') as a fetching state, preventing the "Error resolving revision" flash when navigating to a newly-created package.
catalog/CHANGELOG.md Adds a changelog entry for the fix under the latest unreleased changes section.

Sequence Diagram

sequenceDiagram
    participant User
    participant Dialog as Success Dialog
    participant Router
    participant PkgTreeQueries as PackageTreeQueries
    participant GraphCache as urql GraphCache
    participant Network

    User->>Dialog: packageConstruct mutation succeeds
    Dialog->>Router: Navigate to /pkg/:hash (specific hash)
    Router->>PkgTreeQueries: render with hashOrTag=hash

    PkgTreeQueries->>GraphCache: REVISION_QUERY (hashOrTag=hash)
    GraphCache-->>PkgTreeQueries: cacheOutcome='partial', revision=null

    Note over PkgTreeQueries: OLD: fetching=false → shows broken UI<br/>NEW: GQL.fold detects partial → shows Placeholder

    GraphCache->>Network: background fetch (hashOrTag=hash)
    Network-->>GraphCache: full revision data
    GraphCache-->>PkgTreeQueries: cacheOutcome='hit', revision={...}

    PkgTreeQueries-->>User: renders PackageTree correctly
Loading

Reviews (2): Last reviewed commit: "Refactor PackageTreeQueries to use GQL.f..." | Re-trigger Greptile

After packageConstruct mutation, the GraphCache has the new revision
cached under revision(hashOrTag: "latest") but not under the specific
hash. When the success dialog navigates to the package page using the
specific hash, GraphCache returns a partial cache hit with revision: null.

The code only checked `fetching` to show the loading placeholder, missing
the partial cache case. This caused "Error resolving revision" to render
until the background network fetch completed with the real data.

Check for partial cache outcome (as the `fold` helper already does)
to show the loading placeholder instead of the error.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review.

Tip: disable this comment in your organization's Code Review settings.

@codecov
Copy link

codecov bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.32%. Comparing base (ce52cf2) to head (c91750c).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
.../app/containers/Bucket/PackageTree/PackageTree.tsx 0.00% 7 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4778      +/-   ##
==========================================
- Coverage   44.33%   44.32%   -0.01%     
==========================================
  Files         813      813              
  Lines       32734    32736       +2     
  Branches     5723     5721       -2     
==========================================
  Hits        14511    14511              
- Misses      16220    16224       +4     
+ Partials     2003     2001       -2     
Flag Coverage Δ
api-python 92.65% <ø> (ø)
catalog 19.52% <0.00%> (-0.01%) ⬇️
lambda 96.63% <ø> (ø)
py-shared 98.18% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a brief UI flash of “Error resolving revision” after creating a package by treating URQL/GraphCache “partial” cache hits as a loading state when navigating to the newly created package revision.

Changes:

  • Detect URQL partial-cache outcomes for the revision query and render the loading placeholder instead of the error state.
  • Add a changelog entry describing the fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
catalog/app/containers/Bucket/PackageTree/PackageTree.tsx Treats cacheOutcome === 'partial' as loading for the revision query to prevent an error flash.
catalog/CHANGELOG.md Adds a “Fixed” entry for the navigation flash issue.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Use the established fold pattern for consistency with the rest of the
codebase. fold handles partial cache hits as the fetching state, which
is the actual fix for the "Error resolving revision" flash.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sir-sigurd sir-sigurd requested a review from Copilot March 23, 2026 11:49
@sir-sigurd
Copy link
Member Author

@greptileai

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sir-sigurd sir-sigurd requested a review from nl0 March 23, 2026 11:58
Copy link
Member

@nl0 nl0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome

@sir-sigurd sir-sigurd added this pull request to the merge queue Mar 23, 2026
Merged via the queue into master with commit 16709f2 Mar 23, 2026
48 of 50 checks passed
@sir-sigurd sir-sigurd deleted the sergey/fix-partial-cache-revision-error branch March 23, 2026 12:51
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.

3 participants