Skip to content

fix: do not serve stale data from /data and /export - #75

Merged
firefly-cpp merged 1 commit into
mainfrom
fix/stale-data
Nov 2, 2026
Merged

firefly-cpp merged 1 commit into
mainfrom
fix/stale-data

Conversation

@firefly-cpp

Copy link
Copy Markdown
Owner

Problem

Processing.data() and Processing.export() only reload self.df when the data file exists. If the file is missing (e.g. it was removed while the server was running to start a fresh collection), both endpoints kept returning the DataFrame left in memory from an earlier request instead of reporting that no data is available.

Fix

  • Reset self.df to an empty DataFrame when the data file does not exist, in both data() and export(). process() already did this.
  • /data and /export now return 400 No data available. in that case.

Tests

  • New TestStaleData.test_removed_data_file_is_not_served: stores a measurement, removes data.csv, and checks both endpoints. It fails on the previous code and passes with the fix.
  • Full suite: 28 passed.

No behaviour change when the data file exists.


Generated by Claude Code

When the data file does not exist (e.g. it was removed while the server
was running), data() and export() kept returning the DataFrame left in
memory from an earlier request. They now return "No data available."

- Reset self.df to an empty DataFrame when the data file is missing
- Add a test that removes the data file and checks both endpoints

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VCvw8haRnmyrVKrLkz5Yf8
@firefly-cpp
firefly-cpp merged commit bbcedaa into main Nov 2, 2026
12 checks passed
@firefly-cpp
firefly-cpp deleted the fix/stale-data branch November 2, 2026 19:18
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