8000 feat(timeline): an hourly tidy drops marks and reactions left on activities that are gone by adeelahmad · Pull Request #662 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(timeline): an hourly tidy drops marks and reactions left on activities that are gone - #662

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-pf8kii
Oct 19, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-pf8kii

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: review marks and reactions on a timeline activity that later went away (an event log entry past events.keep_days, a deleted asset) stayed in event_mark and event_reaction until the person was removed, so on a long-running install those tables only grew.

After: an hourly tidy, run with the other hourly ones in routines.run_due, drops them. Each pass looks up at most 500 activities marked or reacted to over a day ago, in id order from where the last pass stopped (so the whole table is covered over time), asks every activity source whether each is still there, and deletes the rows of those that are not. Comments on gone activities stay, since they are what people wrote.

How: event_marks.tidy(db, cfg) reuses events.get_many with an admin viewer, the same lookup the API uses to read activities by id, so an activity counts as gone only when no source has it.

Motivation and Context

A refine-later item of the activity stream design (thread above): "Marks on activities whose rows are gone … stay until the person is removed; a tidy could drop them." Keeps the default install light on a Pi over months of use.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it as a fragment in changelog.d/ (timeline-tidy-marks.md).

Done questions (AGENTS.md)

  • Goal: tables stop growing with marks nobody can see; merged on green CI.
  • Agents: n/a, housekeeping with nothing to call; what agents read is unchanged.
  • Zero setup: runs by itself.
  • Fewest clicks: n/a, no control.
  • Configurable: n/a; it follows events.keep_days, which is already a setting.
  • Light: at most 500 lookups an hour, batched per source; smaller tables after.
  • Private and secure: deletes only rows tied to activities no source has; no new surface.
  • Cost: no model call.
  • User decides: only invisible rows go; nothing a person can still see changes, and comments stay.
  • Upgrades: existing installs tidy what is there, a batch an hour; nothing changes shape.
  • Honest: docs/timeline.md says what is tidied, how often and what stays.
  • Tested and documented: pytest test_a_tidy_drops_marks_and_reactions_left_on_activities_that_are_gone (a deleted asset and an expired log entry lose their marks and reactions; live ones and day-old-or-newer marks stay; the batch carries on from where it stopped); docs, requirements.md, changelog.d.
  • Open standards: n/a.
  • Reported: result goes back in the thread; refine later: comments on gone activities.
  • Reuse: events.get_many, the hourly tidy slot in routines.run_due.

CI on the PR decides the merge.


Generated by Claude Code

…vities that are gone

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ln25ykE6uBDqx21WBU94SX
@adeelahmad
adeelahmad merged commit 0ea2e14 into main Oct 19, 2026
12 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-pf8kii branch October 19, 2026 03:51
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

0