fix(knowledge): treat Google Workspace users without Gmail or Calendar as out of scope, not listing failures - #8168
Conversation
…r as out of scope, not listing failures Admin-mode Gmail recorded a Directory user without a mailbox, and Calendar recorded a 403 notACalendarUser, as per-user listing failures. Both are standing account properties, so the connector stayed partial, deletion reconciliation never ran, and the scheduler re-probed the same accounts every retry window. - Directory enumeration no longer schedules Gmail users whose mailbox is not set up; the hourly Directory refresh picks them up once provisioned. A partition queued earlier completes with an empty page instead of a failure. - A Calendar 403 whose only reason is notACalendarUser completes the user's partition cleanly and re-probes it no sooner than the Directory refresh (permissions keep their own refresh cadence). Bare forbidden and mixed-reason 403s stay retryable failures.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
|
…l a missing service outlasts propagation Google applies service and organizational-unit changes within 24 hours, so a missing mailbox or notACalendarUser can be transient for a user whose documents are already indexed, and a mid-listing answer does not prove the whole account lacks the service. - The scheduler skips a service-not-enabled user only on their first provider page, and only when readers see none of their documents or the condition was first observed at least 24 hours ago. Otherwise it is a retained failure, as before, whose first observation is kept in the partition failure; after 24 hours a mid-listing user restarts from their first page. - Permission passes skip on the first page, since a retained failure refreshes nothing. - Gmail Directory enumeration keeps scheduling a user without a mailbox while readers still see their mail; the crawl reports the missing mailbox to the scheduler instead of completing the user. - Visibility is read through doc_acl_gin_idx for the user's token behind an OFFSET 0 fence, bounded by that user's grants.
…d cover the probe in PostgreSQL The visibility probe moves to its own module so it can run against a real database. Planned inline, LIMIT 1 made a sequential scan of the document table look cheaper than doc_acl_gin_idx, because PostgreSQL cannot estimate array overlap. A materialized CTE now reads the user's grants from the index first, bounding the probe by that user's grants. The email goes through userToken, so a mixed-case or padded directory address matches the normalized ACL token. The new PostgreSQL integration test covers fresh, stale and missing permission evidence, another user's grant, another connector, excluded, archived and deleted documents, and email normalization, and runs in the Search progress PostgreSQL CI step.
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 12 files
Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
Re-trigger cubic
Summary
notACalendarUser, as per-user listing failures. Those partitions stayedblocked, soremaining()never reached zero,hasMorestayed true, and the listing never reached its end:reconcileCompletedListingwas never called, the connector stayed partial, and the same accounts were re-probed every retry windowcalendar.events.list403 whose only reason isnotACalendarUser) is now a skip only on the user's first provider page, and only when readers see none of that user's documents from this connector or the condition was first observed at least 24 h ago (Google applies service and organizational-unit changes within 24 h). A skipped user's partition completes with no failure and is re-probed no sooner than the Directory refreshsince). The documents are not reconciled until 24 h have passed. A mid-listing answer is always a retained failure; once it has lasted 24 h the user restarts from their first pageforbidden, mixed-reason, and incomplete-reason Calendar 403s stay retryable failuresu:<email>with permission evidence inside the existing 24 h freshness limit. It is read throughdoc_acl_gin_idxbehind anOFFSET 0fence, so the cost is bounded by that user's grants, not the connector's sizeType of Change
Testing
company-crawl.test.tsandgoogle-company-scheduler.test.ts. They cover:sincecarry, mid-listing reset, permission skip, Directory visibility check, crawl mailbox signal), and each turned its tests redlib/knowledge+connectorssuites pass;bun run lint,bun run check:audits, andapps/simtype-check passChecklist