Skip to content

fix: stop serving stale cached org pages for blocked organizations IN-1399 - #2322

Merged
gaspergrom merged 3 commits into
mainfrom
feat/IN-1399
Sep 29, 2026
Merged

gaspergrom merged 3 commits into
mainfrom
feat/IN-1399

Conversation

@gaspergrom

@gaspergrom gaspergrom commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Stops the organization page and the organization-page API from serving stale cached 200s for organizations that were blocked after they were cached. The production route rules for /organization/** and /api/organization-page/** now set swr: false, so an expired entry recomputes inline and the 404 reaches the visitor. Entries written before this deploy are invalidated because the cache options change the entry hash, so no manual purge is expected.
  • Documents that the public API organization slug is '' for organizations without a public page (blocked organizations stay listed on leaderboards without a link), with a test.

Why

After the Tinybird pipes started returning no rows for blocked organizations, production kept serving 200 for /organization/garden-linux and /api/organization-page/garden-linux. Nitro's stale-while-revalidate keeps the stale entry when the refresh throws, and those Redis entries had no TTL.

Deploy order

  1. crowd.dev Tinybird changes (feat: hide affiliation-blocked organizations from org pages and dashboards (IN-1399) crowd.dev#4793): already pushed to prod lfx_insights from its branch; that PR is still open.
  2. This PR: the cache rules exist only in the production build, so staging cannot exercise them.

Runtime impact

  • Org page and org-page API only. An origin failure at expiry (for example a Tinybird error) now reaches the visitor instead of a stale page.
  • Cache entries for these routes now expire in Redis after maxAge.

Test plan

  • frontend/setup/caching.test.ts covers the production and development rules
  • api/tests/contributors-organization-leaderboard.test.ts covers the empty slug
  • After the production deploy: /organization/garden-linux and /api/organization-page/garden-linux/kpis return 404, a live organization such as sap-se still returns 200, and the logs show no [cache] errors

Commit format

Signed off and GPG signed; type: description IN-1399.

Checklist

  • Commits signed off and GPG signed
  • Tests pass
  • No new source files, so no new license headers
  • No migrations
  • Under 1000 lines of diff

JIRA: https://linuxfoundation.atlassian.net/browse/IN-1399

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Copilot AI balanced review requested due to automatic review settings September 28, 2026 21:57
@cursor

cursor Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Production caching behavior changes for org routes—visitors may see errors on origin failure at expiry instead of stale content—and leaderboard consumers must treat empty slug as no link.

Overview
Fixes blocked organizations still returning 200 from production after upstream data stops serving them, by turning off stale-while-revalidate on /organization/** and /api/organization-page/** in production Nitro route rules (swr: false). Expired cache entries recompute inline so 404 responses are not masked by an old successful page; the changed cache options also invalidate prior Redis entries via a new entry hash.

The public API Organization schema now documents that slug is an empty string when there is no public page (e.g. blocked orgs on leaderboards), with a leaderboard integration test mirroring the existing empty-logo behavior. Production-only cache behavior is covered in caching.test.ts.

Reviewed by Cursor Bugbot for commit a2386dc. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The PR title includes IN-1399, contrary to the repository rule prohibiting JIRA tickets in PR titles.

Review effort: Balanced
Findings: None

What changed in this PR

Documents that organizations without public pages use an empty slug and verifies pass-through behavior.

Changes:

  • Clarifies the Organization.slug API contract.
  • Tests empty-slug responses.
File Description
api/​src/​lib/​organizations.ts Documents empty organization slugs.
api/​tests/​contributors-organization-leaderboard.test.ts Verifies empty slugs remain unchanged.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Copilot AI review requested due to automatic review settings September 28, 2026 22:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The production caching change contradicts the stated docs-and-test-only scope and must be removed or documented and validated.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)

Comment thread frontend/setup/caching.ts
@gaspergrom gaspergrom changed the title feat: document empty organization slug for blocked orgs IN-1399 fix: stop serving stale cached org pages for blocked organizations IN-1399 Sep 28, 2026
Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Copilot AI review requested due to automatic review settings September 28, 2026 22:58

@themarolt themarolt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused changes correctly address stale blocked-organization responses and include appropriate regression coverage.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)

@gaspergrom
gaspergrom merged commit b5ef26c into main Sep 29, 2026
14 checks passed
@gaspergrom
gaspergrom deleted the feat/IN-1399 branch September 29, 2026 07:39
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.

3 participants