Skip to content

[Drift Audit] Update URL classification rule to match isUrl() and the useUrlPredictor flag#9153

Draft
daxmobile wants to merge 1 commit into
developfrom
drift-audit/url-classification-isurl-20d9246a4a06bfa4
Draft

[Drift Audit] Update URL classification rule to match isUrl() and the useUrlPredictor flag#9153
daxmobile wants to merge 1 commit into
developfrom
drift-audit/url-classification-isurl-20d9246a4a06bfa4

Conversation

@daxmobile

Copy link
Copy Markdown
Collaborator

Task/Issue URL: (app.asana.com/redacted)
Tech Design URL (if applicable):

Description

.cursor/rules/architecture.mdc — "URL vs. Search Classification".

What the doc described: it taught a hand-rolled classification helper — if (queryUrlPredictor.isReady()) { classify(query) is Decision.Navigate } else { UriString.isWebUrl(query) } — and stated that the isWebUrl fallback exists only "while the native library loads" (i.e. the sole fallback trigger is isReady()).

The code change that invalidated it: QueryUrlPredictor (in browser-api) now exposes a first-class isUrl(query): Boolean convenience method, and the implementation gates the native predictor behind a useUrlPredictor remote feature flag:

// app/src/main/java/com/duckduckgo/app/browser/omnibar/QueryUrlPredictor.kt
override fun isUrl(query: String): Boolean =
    if (androidBrowserConfigFeature.useUrlPredictor().isEnabled() && isReady()) {
        classify(query) is Decision.Navigate
    } else {
        UriString.isWebUrl(query)
    }

isUrl() is what the recent search-only / unified-omnibar work calls — BrowserTabViewModel, NativeInputManager, and InputScreenViewModel all use queryUrlPredictor.isUrl(...) rather than the manual pattern. Two facts had drifted:

  • The idiomatic entry point is now isUrl(), not a hand-rolled isReady()/classify()/isWebUrl() block.
  • Classification is gated on the useUrlPredictor flag (AndroidBrowserConfigFeature) in addition to native-lib readiness. The doc implied readiness was the only fallback trigger; the fallback also fires whenever the flag is disabled.

How the doc now reads: it recommends isUrl(query) for a boolean decision (showing the real implementation, flag gate included), keeps classify() + isReady() for callers that need the resolved Decision (noting classify does not check the flag), and corrects the fallback note to mention both the useUrlPredictor flag and readiness. The Decision shape and browser-api/AppScope facts were verified against the code and left unchanged.

Note: I could not confirm the exact merged PR that introduced isUrl()/useUrlPredictor via commit history (integrity-filtered), but the omnibar/URL-classification area was heavily touched by recent search-only-omnibar changes, and the current code plainly diverges from the doc.

🤖 AI-docs Drift Auditor

Steps to test this PR

  • Read the updated rule doc against QueryUrlPredictor (browser-api interface + app-side QueryUrlPredictorImpl.isUrl) and its callers (BrowserTabViewModel, NativeInputManager, InputScreenViewModel) and confirm it now matches.

UI changes

Before After
No UI changes No UI changes

Note

🔒 Integrity filter blocked 20 items

The following items were blocked because they don't meet the GitHub integrity level.

  • #8891 search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #8811 search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #8809 search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #8942 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #9102 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • 6e44d94 list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • ec630a0 list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • abd0658 list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • a0e9b3c list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • 34d1fbf list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • d677313 list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • b7dc05f list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • 4e94f9a list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • f713425 list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • 5f01f62 list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • 18f4a16 list_commits: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • ... and 4 more items

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by AI-docs Semantic Drift Audit ·

…flag

The architecture rule's "URL vs. Search Classification" section taught a
manual isReady() + classify() + isWebUrl() fallback and implied the only
fallback trigger was native-lib readiness. The code now exposes
QueryUrlPredictor.isUrl(query), which the search-only/unified omnibar code
uses, and gates classification behind the useUrlPredictor remote flag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant