Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(project-tree): persist unfiled #29197

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

feat(project-tree): persist unfiled #29197

wants to merge 7 commits into from

Conversation

mariusandra
Copy link
Collaborator

@mariusandra mariusandra commented Feb 25, 2025

Problem

We're recalculating the unfiled items every time the tree loads

Changes

  • Persist items once, only create new items.
  • Support slashes in filenames

Ideally we'd precalculate this for teams (not on first load like now), but this is good enough for testing.

How did you test this code?

Updated tests, clicked around locally.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR changes the file system handling to persist unfiled items in the database instead of recalculating them on each tree load.

  • Replaced UnfiledFileFinder with UnfiledFileSaver class in /posthog/models/file_system.py to save items to database rather than just retrieving them
  • Implemented _generate_unique_path method to handle naming collisions when creating file paths
  • Added database queries with Exists and OuterRef to check if items are already saved before creating new entries
  • Updated API endpoint in /posthog/api/file_system.py to use save_unfiled_files instead of get_unfiled_files
  • Added comprehensive tests for idempotency to ensure duplicate entries aren't created when function is called multiple times

4 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

Size Change: 0 B

Total Size: 9.72 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 9.72 MB

compressed-size-action

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

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.

2 participants