Repository navigation
Delete usage metrics and feedback after five years - #726
Merged
Merged
Conversation
…nd daily purge_expired_metrics deletes request_log and feedback_log rows older than METRICS_RETENTION_YEARS (5) calendar years. Startup runs it (the scheduler only starts with sync enabled); the scheduler repeats it daily at 03:15. Failures are logged. Tested: tests/test_metrics (incl. new test_retention.py), tests/test_api, tests/test_frontend: 2267 passed.
…deleted; changelog Tested: tests/test_frontend (privacy page) passes.
neuromechanist
added a commit
to OpenScience-Collective/documentation
that referenced
this pull request
Nov 11, 2026
…s, then deleted Mirrors OSA's PRIVACY.md after OpenScience-Collective/osa#726. mkdocs build: the page builds; the only warning is OSCAR's examples link (submodule, same pin as main).
1 task
…calate repeated job failures, test the 03:15 registration, fixed-offset zone test, skip the startup purge when init failed Tested: tests/test_metrics, tests/test_api, tests/test_frontend: 2270 passed. The erase test fails with secure_delete and the checkpoint removed (negative control run by hand).
Member
Author
Review round 1 (Sonnet code reviewer): outcomesNo critical findings, 1 important, 4 suggestions; all fixed in the round 1 commit.
|
…g names the erasure and the escalation, accurate blocked-checkpoint wording Tested: tests/test_metrics and test_bedrock_deployments (331 passed).
Member
Author
Review round 2 (Sonnet code reviewer): outcomesAll 5 round 1 findings are confirmed resolved. The reviewer also ran the case where a reader blocks the checkpoint: the purge returned, logged the warning and raised nothing. 3 new suggestions, all fixed in the round 2 commit:
This was the second and last round. |
2 tasks
neuromechanist
added a commit
to OpenScience-Collective/documentation
that referenced
this pull request
Nov 11, 2026
…erence (#46) * OSA privacy page and widget reference: the Privacy choices dialog and Share usage data * docs(osa): privacy, usage metrics and feedback are kept for five years, then deleted Mirrors OSA's PRIVACY.md after OpenScience-Collective/osa#726. mkdocs build: the page builds; the only warning is OSCAR's examples link (submodule, same pin as main). * docs(osa): privacy, [email protected] for privacy questions and requests about your data Mirrors OpenScience-Collective/osa#727. * docs(osa): privacy, contact wording matches OpenScience-Collective/osa#727 after review
Merged
13 of 14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The maintainer decided on 2026-11-11 that usage metrics and feedback are kept for five years. This PR makes the server delete them after that, and makes
PRIVACY.mdsay so in place of "no automatic deletion".src/metrics/db.py:METRICS_RETENTION_YEARS = 5.retention_cutoff(now): five calendar years beforenow, in UTC. On 29 February it falls back to 28 February.purge_expired_metrics(db_path, now): deletes therequest_logrows andfeedback_logentries older than the cutoff, in one commit, and returnsPurgeCounts. Every writer storesdatetime.now(UTC).isoformat(), so rows are compared as strings, and a test covers the mixed forms with and without microseconds.src/api/main.py: startup runs the purge afterinit_metrics_db. The scheduler only starts withsync_enabled, so without this a deployment with sync off would never purge. A failure is logged with its traceback and startup goes on.src/api/scheduler.py: the scheduler runs it daily at 03:15 (metrics_retention). A SQLite or OS error is logged and the scheduler keeps running.PRIVACY.md: "kept for five years, then deleted automatically", for both usage metrics and feedback. Server logs are not covered by this decision and the text about them is unchanged.Nothing is older than five years today; the first deletions come in 2030 at the earliest.
The docs.osc.earth mirror (OpenScience-Collective/documentation#46) and NEMAR's policy (nemarOrg/docs#116) get the same sentence in their open PRs.
Closes #725
Tests
tests/test_metrics/test_retention.py(new), on real SQLite files with the real writers:lifespanwith sync off;pytest tests/test_metrics tests/test_api tests/test_frontend -m 'not network and not llm'(Python 3.12): 2267 passedruff checkandruff formaton the changed files: clean