Repository navigation
analytics: scope /facts/status to the caller's organisation - #16
Merged
Merged
Conversation
checkFactTableFreshness read MAX() over every tenant, so one organisation's admin saw when any other organisation last had activity, and a busy tenant could hide another's stale fact table. Both queries now filter on tenant_id, and a fact table's source must carry it, as the fact table already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Releasing section described a single-plugin repository. In this one, release.mjs needs every plugin named with --plugin, refuses an empty unreleased.md, and leaves the README install refs to be moved by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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
With the kit's default
TENANT_SCOPE_MODE=offnothing else narrows these queries, so an organisation's admin saw the newest activity timestamp of every organisation, and a busy tenant could hide another's stale fact table. A fact table'ssource.tablemust now carrytenant_id, as the fact table already does (registry doc,fact-tables/CLAUDE.md). The contract does not change: a source without the column fails loudly withcolumn "tenant_id" does not exist.Also: the README's "Releasing" section now describes this monorepo's release (
--pluginfor every plugin, stamps-only notes, README install refs,release-check --tag, tag the release PR's merge commit).Part of 3.8.1. The release waits for this PR; the chunk-size warning is going to an issue rather than into 3.8.1.
Evidence
Scratch kit worktree on kit
main(0.24.0), analytics installed from this branch.Before:
checkFactTableFreshness sees only the caller's tenant:expected 1793727335269 to be 1793727335266, which is the other tenant'srefreshedAt.GET /facts/status reports the caller's organisation, not another one's backlog: another organisation's unbuilt 5-hour-old activity made the caller's table lag.After: both pass; 49/49 analytics API tests;
pnpm gateexit 0 (688 API tests, 1867 others).Merge Danger
Door: two-way
No schema or data change; reverting restores the old query.
Blast Radius: freshness
/facts/status, the dashboard list's freshness badges androcketflare analytics check-factsnow report the signed-in organisation only. An app that contributes a fact table whose source has notenant_idgets a 500 from/facts/statusuntil it adds one (the porting note says so). Apps callingcheckFactTableFreshnessdirectly must pass the tenant id.🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com