Skip to content

feat(patches): Patchy remembers what each person opens #708

Closed

Description

@allisonmahmood

Part of #707.

What

The record behind Your usual and "new to you": one row per person and patch, with when they last opened it and a score that halves every 7 days since.

  • Migration 0017_patch_opens in packages/patches/src/migrations.ts: patch_opens (user_id, patch_id, last_opened_at, score), all non-null, primary key (user_id, patch_id), both foreign keys ON DELETE CASCADE, and an index on patch_id.
  • Patches.recordOpen(userId, patchId): one upsert against a serving patch, score = score · 2^(−(now − last_opened_at) / 7 days) + 1, using the service's clock.
  • Patches.opens(userId): the member's rows as { patchId, lastOpenedAt, score }, decayed to now.
  • ReadPatch gains visits (the existing visit_count).
  • Serving (packages/serving/src/Pages.ts) records an open when it serves the current version's address to an admitted member, beside recordVisit. Not for older version URLs, the content URL or public patches. A failure logs a warning and never denies the page.

Acceptance

  • Opening a company patch's address twice as one member leaves a score of 2; another member has no row.
  • The content URL, an older version's URL, a public patch and a signed-out request write nothing.
  • A failed write still serves the page.
  • Seven days later the score reads 1; opening it again makes 2.
  • Reclaiming a patch deletes its rows.

Docs

Patches glossary: Open. Serving glossary: members' opens belong to Patches. docs/product.md: next to "The host knows who opened a company page", Patchy remembers what each member opened for their own Home, and nobody else sees it.

Ships alone: it records data and changes no page.

Activity

  1. added
    enhancement
    area:ui
    on Oct 15, 2026
  2. added a commit that references this issue on Oct 16, 2026
    5791208
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:uienhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions