Skip to content

Granular caching#1

Merged
ruarim merged 10 commits into
mainfrom
granular-caching
Feb 17, 2026
Merged

Granular caching#1
ruarim merged 10 commits into
mainfrom
granular-caching

Conversation

@ruarim

@ruarim ruarim commented Jan 27, 2026

Copy link
Copy Markdown
Owner

Still need to do the component that separates out each part of the analysis into its own cache key

@ruarim ruarim merged commit f45284f into main Feb 17, 2026
1 check passed
@ruarim ruarim deleted the granular-caching branch February 17, 2026 14:20
@ruarim

ruarim commented Feb 27, 2026

Copy link
Copy Markdown
Owner Author

@greptile

@greptile-apps

greptile-apps Bot commented Feb 27, 2026

Copy link
Copy Markdown

Greptile Summary

This PR implements granular caching for track analysis by breaking down the analysis generation into individual fields that can be cached and regenerated independently.

Major changes:

  • Refactored analysis generation to conditionally fill only missing fields using dynamic schema construction
  • Changed track data model to always include analysis object with optional fields
  • Removed auto-polling mechanism in favor of manual "Analyze now playing" trigger
  • Updated UI to display loading skeletons for individual unfilled sections
  • Added duplicate track filtering in related tracks query
  • Simplified deployment workflow with conditional dev/prod environments

Issues found:

  • Invalid Tailwind syntax in related-graph.tsx (opacity-0! should be !opacity-0)
  • Logic issue with tags: [] initialization in defaultAnalysis causing unnecessary regeneration

Confidence Score: 4/5

  • Safe to merge with minor fixes needed for Tailwind syntax and tags initialization
  • The core implementation is solid with good architectural improvements. The two issues found are minor: invalid Tailwind syntax will cause styling problems but not runtime errors, and the tags initialization logic issue will cause unnecessary AI regeneration but won't break functionality
  • Pay attention to src/consts.ts (tags initialization) and ui/src/components/related-graph.tsx (Tailwind syntax)

Important Files Changed

Filename Overview
src/analysis.ts Refactored to enable granular caching by conditionally generating only unfilled analysis fields
src/server.ts Changed /api/analyse to POST, removed auto-polling logic, now initializes tracks with defaultAnalysis
src/consts.ts Added defaultAnalysis object and changed REDIRECT_URI to use DOMAIN variable, issue with tags initialization
ui/src/components/analysis.tsx Refactored to show loading placeholders for individual unfilled sections instead of entire card
ui/src/components/related-graph.tsx Minor styling changes with invalid Tailwind syntax for opacity classes

Sequence Diagram

sequenceDiagram
    participant UI as UI Component
    participant API as Server API
    participant Store as Redis Store
    participant Analysis as Analysis Service
    participant AI as Gemini AI

    UI->>API: POST /api/analyse?trackId=xyz
    API->>Store: getTrack(trackId)
    Store-->>API: Track with partial analysis
    API->>API: Check trackAnalysisFilled()
    alt Analysis incomplete
        API->>Store: updateTrack (loading: true, defaultAnalysis)
        API->>UI: SSE: analysisUpdate event
        API->>Analysis: runAnalysis(track)
        Analysis->>Analysis: Filter unfilled fields
        Analysis->>AI: generateText (partial schema)
        AI-->>Analysis: Generated content for missing fields
        Analysis->>Store: updateTrack (merge results)
        Analysis->>UI: SSE: analysisUpdate event
    else Analysis complete
        API->>UI: 200 "Analysis already completed"
    end
Loading

Last reviewed commit: 3e389cf

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

18 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

type="target"
position={Position.Left}
className="!opacity-0"
className="opacity-0!"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Invalid Tailwind syntax - !important modifier must come before the class name

Suggested change
className="opacity-0!"
className="!opacity-0"

type="source"
position={Position.Right}
className="!opacity-0"
className="opacity-0!"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Invalid Tailwind syntax - !important modifier must come before the class name

Suggested change
className="opacity-0!"
className="!opacity-0"

Comment thread src/consts.ts
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.

1 participant