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

Data explorer shows not actual(cached?) content of file when saving different tables with the same filename. #5860

Open
ivan-balashov opened this issue Dec 25, 2024 · 3 comments
Assignees
Labels
area: data explorer Issues related to Data Explorer category. area: duckdb Issues related to positron-duckdb bug Something isn't working support

Comments

@ivan-balashov
Copy link

System details:

macos 13.5.1 (22G90)

Positron and OS details:

Версия: Positron Version: 2025.01.0 (Universal) build 39
Code - OSS Version: 1.93.0
Commit: c7ef34f
Date: 2024-12-09T02:49:50.608Z
Фиксация: 30.4.0
Дата: 124.0.6367.243
Electron: 20.15.1
ElectronBuildId: 12.4.254.20-electron.0
Chromium: Darwin x64 22.6.0
Node.js: undefined
V8: undefined
ОС: undefined

Interpreter details:

Does not matter
tests with different R-4* and python 3-9.-3.12. interpreters

Describe the issue:

Data explorer shows not actual(cached?) content of file when saving different tables with the same filename.

I've saving file (e.g. 'test.tsv') from R or python (doesnt matter) and then click on it so it opens in Data Explorer.
I am closing the Data Explorer tab.
After this, I've saving another dataframe with other columns using the same filename ('test.tsv') and when I am clicking on it the Data explorer shows to me the old file content while file is changed;

If I an opening this file using 'open with..' text editor - it shows new content, sofile is really changed while Data explorer could not track it and shows not actual content(I assume it is due to cache invalidation problem);

Steps to reproduce the issue:

I've saving file (e.g. 'test.tsv') from R or python (doesnt matter) and then click on it so it opens in Data Explorer.
I am closing the Data Explorer tab.
After this, I've saving another dataframe with other columns using the same filename ('test.tsv') and when I am clicking on it the Data explorer shows to me the old file content while file is changed;

If I an opening this file using 'open with..' text editor - it shows new content, so file is really changed while Data explorer could not track it and shows not actual content(I assume it is due to cache invalidation problem);

Expected or desired behavior:

Data Explorer should show actual file content, not cached;

Were there any error messages in the UI, Output panel, or Developer Tools console?

Nothing

Video of bug

2024-12-25.15.26.28.mov
@juliasilge
Copy link
Contributor

juliasilge commented Jan 6, 2025

I believe this is the same as #5551 which was solved by #5651. This fix is not yet in a publicly available build but should be later this week! Keep an eye out for a new release at https://github.com/posit-dev/positron/releases in the next couple of days!

(For internal folks, this fix is in builds 2025.01.0-50 and later.)

EDIT: NOPE, this was wrong. This is a different bug that I can reproduce in the very latest builds.

Thank you for the report, @ivan-balashov!

Here are some reproducible steps:

  • Run iris |> readr::write_csv("test.csv")
  • Click on the file in the File Explorer to open it up; note that we correctly see the iris data
  • Run mtcars |> readr::write_csv("test.csv")
  • Again click on the file in the File Explorer to open it up; note that we incorrectly still see the iris data

You can do readr::read_csv("test.csv") to see that the file is in fact updated.

@juliasilge juliasilge added bug Something isn't working area: data explorer Issues related to Data Explorer category. support labels Jan 6, 2025
@juliasilge
Copy link
Contributor

If you run mtcars |> readr::write_csv("test.csv") while the Data Explorer tab is open, it correctly updates. It is only if the Data Explorer tab is closed that we see the bug.

@wesm wesm self-assigned this Jan 6, 2025
@wesm
Copy link
Contributor

wesm commented Jan 6, 2025

Thanks for the investigation -- I'm having a look at this. File updates with the DuckDB backend are a bit finicky

@wesm wesm added the area: duckdb Issues related to positron-duckdb label Jan 6, 2025
@juliasilge juliasilge added this to the 2025.02.0 Pre-Release milestone Jan 6, 2025
wesm added a commit that referenced this issue Jan 7, 2025
…into duckdb (#5890)

Addresses #5860. duckdb-wasm has some kind of file caching behavior that
is not resilient to file changes on the underlying file system. This
patch nukes this issue from orbit by always registering the file
contents as a virtual file and reading from that. I think if and when we
migrate to the duckdb NodeJS bindings per #5889 that we can avoid this
chicanery. This does the same thing for Parquet files, too, since they would also
become stale. 

e2e: @:data-explorer

### QA Notes

Here was the reproducible failure from the issue:

* Run iris  |> readr::write_csv("test.csv")
* Click on the file in the File Explorer to open it up; note that we
correctly see the iris data
* Run mtcars  |> readr::write_csv("test.csv")
* Again click on the file in the File Explorer to open it up; note that
we incorrectly still see the iris data
wesm added a commit that referenced this issue Jan 7, 2025
…into duckdb (#5890)

Addresses #5860. duckdb-wasm has some kind of file caching behavior that
is not resilient to file changes on the underlying file system. This
patch nukes this issue from orbit by always registering the file
contents as a virtual file and reading from that. I think if and when we
migrate to the duckdb NodeJS bindings per #5889 that we can avoid this
chicanery. This does the same thing for Parquet files, too, since they would also
become stale. 

e2e: @:data-explorer

### QA Notes

Here was the reproducible failure from the issue:

* Run iris  |> readr::write_csv("test.csv")
* Click on the file in the File Explorer to open it up; note that we
correctly see the iris data
* Run mtcars  |> readr::write_csv("test.csv")
* Again click on the file in the File Explorer to open it up; note that
we incorrectly still see the iris data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: data explorer Issues related to Data Explorer category. area: duckdb Issues related to positron-duckdb bug Something isn't working support
Projects
None yet
Development

No branches or pull requests

3 participants