Repository navigation
refactor(core): own the oauth callback emptiness rule in one place - #5288
Merged
Merged
Conversation
#5282 added `isOAuthCallbackQueryEmpty` to core so the backend callback service could ignore crawler GETs that carry no state, code, or error, then re-implemented the inverse rule in the web landing recorder as `oauthCallbackSearchHasParams`. The two copies disagreed: core tested `value.length > 0`, the web copy tested `value.trim()`. So a callback like `?state=%20` was junk to the web gate (relay skipped) and a real callback to the backend gate, which captured an `oauth_callback` failure with reason `missing_code` - the false failure #5282 set out to remove, still reachable through the other door. No test covered the whitespace case on either side. The web recorder now parses the query and calls core's rule, and the rule trims, so both doors agree and blank params are ignored like bare ones. The `provider === "apple"` skip stays local: it is a fact about Apple's `response_mode`, not about whether the query carries anything. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HmwVQHPX46EeQkypGBcMuw
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HmwVQHPX46EeQkypGBcMuw
tyler-dane
enabled auto-merge
November 18, 2026 11:47
Contributor
|
Boot bundle: 576.4 KB gzip (+0.0 KB vs main) |
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.
The divergence this prevents
#5282 added
isOAuthCallbackQueryEmptytopackages/core/src/analytics/oauth-signup.events.tsso the backend callback service could ignore crawler GETs carrying no state, code, or error. In the same PR, the web landing recorder re-implemented the inverse rule locally asoauthCallbackSearchHasParams, in a file that already imports from that very module.The two copies disagreed on whitespace:
?state=%20isOAuthCallbackQueryEmpty(core, owner)value.length > 0oauthCallbackSearchHasParams(web copy)value.trim()So a callback like
?state=%20was junk to the web gate (relay skipped) and a real callback to the backend gate, which fell through tooauthFailedReasonFromCallbackQueryand captured anoauth_callbackfailure with reasonmissing_code. That is exactly the false failure #5282 set out to remove, still reachable through the other door. No test covered the whitespace case on either side, so the two could keep drifting silently.The change
Behavior delta, stated plainly: the only observable change is for whitespace-only callback params, which now redirect home without a PostHog capture instead of recording a
missing_codefailure. No user-visible behavior and no contract change.The
provider === "apple"early return stays local to the web file on purpose: it is a fact about Apple'sresponse_mode(the form POST already recorded the callback), not about whether the query carries anything. Only the emptiness half moved.Examined and deliberately left alone
Recorded in
.agents/skills/tech-debt-sweep/judged-fine.mdso the next sweep does not redo it: #5283's 6,058-line Mac removal (no orphaned branches; the legacyd: trueOAuth-state tolerance is deliberate),BillingCheckoutRequestSchemagoing.strict()(nothing live can send a property to reject),DESKTOP_QUICK_ADD_PALETTE_PLACEHOLDER(live web palette feature, renaming is inadmissible), #5286's ring-color fix (finished work), andasNonEmptyStringinoauth-callback.analytics.ts(narrows fourunknownvalues and agrees with core rather than diverging).Verify
bun run verify --strict: lint, type-check, knip, test:web, test:a11y and test:e2e all pass.The verdict is driven entirely by pre-existing sandbox failures, confirmed by running both suites at
origin/main(70c4082) in this same container:PRE-EXISTING (identical at
origin/main, unrelated to this diff):test:core1 failure:configureHttpServer > does not reject a request that exceeds maxHeadersCounttest:backend:fast13 failures: 3xGET /api/config, 10xSSE Server(both needcompass.yaml, absent in this sandbox)Counts confirm this branch only adds passing tests: core 1084 pass vs 1083 on main, backend 686 pass vs 685 on main, with the same 14 failures on both sides.
FLAKY, passed on rerun (1):
test:e2e: [chromium-desktop] › e2e/timed/event-form-fast-typing.spec.ts › title keeps every character when typed quickly in day viewCI decides on the suites this sandbox cannot configure.
Generated by Claude Code