An organization in Sentrinel holds several apps, and each app is a whole product — its API, its web pages, its phone app, its workers. The app selector at the top of the dashboard is supposed to be the one control that decides what you are looking at.
Switching from one app to another kept showing the same data on some pages. Not all of them: Traffic changed, Errors changed. Notification channels did not. Neither did status pages, or dashboards, or the list of databases. On a couple of pages, the numbers from the app just left flickered back in a second after the new ones arrived.
It is the kind of bug that is easy to wave away as cosmetic and is not. If an app selector only mostly selects, nobody can trust any page it is on.
Four different causes
We traced it to four things, each of which had looked reasonable on its own.
Some things were stored against the organization. Notification channels, saved views, status pages and some dashboards had an organization and no app, so every app listed all of them. They were built early, when "one org, one app" was the common case, and nothing about them was wrong until an org had two.
Some lookups matched on a name every app shares. Every app has a GET /health. Opening an endpoint's detail looked the endpoint up by method and path — and took whichever came back first, which could be another app's, with another app's latency threshold. The same shape appeared in related requests, which found "the same customer's other requests" by the customer's identifier alone. acme in one app is not acme in another.
Some callers had the organization as their scope. A person belongs to an org, so for a person "no app selected" reasonably meant "the whole org". An API key does not: it is issued for one app. A key that simply left the app out of a request was being answered with the org's data. And a person in two orgs was treated as being in whichever one was listed first, so with an app of their second org selected, some pages quietly came back empty.
And the dashboard raced itself. Switching app starts new requests. The old app's requests were still in flight, and nothing stopped a slow one from landing after the new app's answer and replacing it. Pages also fetched once, briefly, before the app list had loaded — with no app at all — and showed that org-wide answer under whichever app the selector then settled on.
The rule, and how it is enforced
The fix starts with a rule rather than a list of patches: everything belongs to an organization and to one app. Channels, saved views, status pages, dashboards and databases now each carry their app. Anything that existed without one moved to its organization's oldest app — the only app that existed when an org-wide row could have been made — rather than being dropped.
Creating any of them now requires the app, and the server checks it belongs to you before anything is written. An alert or cron monitor can only notify through its own app's channels, so a rule in one app cannot post to a Slack configured for another.
Lookups by name now carry the app as well: an endpoint is (app, method, path), a customer is (app, identifier). An API key that omits the app is answered for its app, never for the org around it. And the organization a request acts in follows the app that is selected, so being a member of two orgs works the same as being a member of one.
The dashboard half
On the client, every page now waits until it knows which app is selected before it asks for anything, and every answer is checked against the app it was asked for. An answer that arrives for an app you have already left is dropped instead of drawn.
Per-app state — fetched rows, an open detail panel, a filter — is held in a small hook that belongs to the selected app. Switch, and it hands back an empty value in the same render that shows the new app's name, so the previous app's numbers never appear under it even for a frame. Switch back, and you start fresh rather than reopening the panel you left.
How we know it holds
A rule like this is only as good as the test that fails when someone breaks it. The suite now builds two organizations — one with two apps, one with one — a person who belongs to both, an API key pinned to one app, and a customer called acme in all three. Then it asks every question above from every angle, and checks that no answer contains anything from an app the question was not about.
The lesson we are keeping is the first one. Each of these places was reasonable when it was written. The bug was not in any of them; it was in not having written the rule down.