[customer analytics] Opportunities tab: confirm salesforce access-denied errors aren't captured
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 232
Description
Summary
Low confidence / needs confirmation. A few You don't have access to table salesforce.opportunity exceptions are captured on the accounts page, even though the Opportunities tab is designed to treat a denied/absent Salesforce table as an expected empty state (not a reported error). Code review suggests the isExpectedMissingTableError matcher already covers the real (enriched, multi-line) message, so these captures most likely originate from a different path — e.g. the initial accountsRetrieve call failing, or the shared loaders onFailure. This needs a captured stack trace to confirm before fixing.
Part of #68887.
Details for coding agents
What was checked
isExpectedMissingTableErroruses substring matching that covers both the bare message and the production-enriched form (… \nTables referenced: salesforce.opportunity), and the "expected" branch does not capture. So the Opportunities query path itself should already be silent for this error.- Therefore the captured events likely come from: (a) the first try/catch around
accountsRetrieve(fetchingsfdc_id) which captures unconditionally, or (b) the shared loadersonFailureininitKea.ts— see also the AbortError/noise issue.
Proposed next step / fix
- Pull a stack trace for one of these
$exceptions to confirm the capture site. - If it's the expected-error path after all, widen the guard (also gate on HTTP status, not just message text) and add a test for the enriched multi-line message (current test only asserts the bare string).
- If it's
accountsRetrieve, make that catch skip the expected access-denied/missing-table case too.
References
products/customer_analytics/frontend/components/Accounts/accountOpportunitiesLogic.ts:43-49(isExpectedMissingTableError),:64-71(accountsRetrievetry/catch),:68,99(captureException)products/customer_analytics/frontend/components/Accounts/accountOpportunitiesLogic.test.ts:62(test uses bare message only)posthog/hogql/metadata.py:199(enrich_hogql_validation_erroradds theTables referenced:suffix)frontend/src/initKea.ts:128-130(sharedonFailurecapture)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the stack trace for a captured exception, then inspect accountOpportunitiesLogic.ts around isExpectedMissingTableError, accountsRetrieve, and captureException. Compare the existing test in accountOpportunitiesLogic.test.ts with the enriched error described in metadata.py, and check initKea.ts for shared capture behavior. Done means the capture path is confirmed and the appropriate guard or test is updated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- analytics, frontend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100