Skip to content

Fix Apple Developer Docs search API - #28149

Closed
dustPyrotechnic wants to merge 20 commits into
raycast:mainfrom
dustPyrotechnic:fix/apple-developer-docs-search-api
Closed

dustPyrotechnic wants to merge 20 commits into
raycast:mainfrom
dustPyrotechnic:fix/apple-developer-docs-search-api

Conversation

@dustPyrotechnic

Copy link
Copy Markdown
Contributor

Description

  • replace the deprecated Apple Developer search endpoint with the current production API
  • make archive search optional behind a Raycast preference
  • add archive chapter-level indexing, relevance ranking, and archive status/labels in the UI
  • update the changelog for the new archive search behavior

Validation

  • npm run build
  • npm run lint

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: apple-developer-docs Issues related to the apple-developer-docs extension platform: macOS labels May 20, 2026
@raycastbot

raycastbot commented May 20, 2026 •

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! 🎉

🔔 @CaliCastle you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

📋 Quick checkout commands
BRANCH="fix/apple-developer-docs-search-api"
FORK_URL="https://github.com/dustPyrotechnic/extensions.git"
EXTENSION_NAME="apple-developer-docs"
REPO_NAME="extensions"

git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run dev

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

@greptile-apps

greptile-apps Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the broken Apple Developer search by replacing the deprecated endpoint with the current production API, and adds an opt-in archive search feature that downloads and indexes Apple's retired Documentation Archive for chapter-level search alongside live results.

  • New useArchiveResults hook fetches the archive library index and concurrently builds a chapter-level TOC, exposing multi-phase status with progress tracking and a 25 MB Raycast cache.
  • Combined relevance ranking in index.tsx merges API and archive results when typeFilter === \"all\", using a new scoring.ts module.
  • Archive preference in package.json lets users opt in; tsconfig.json is updated to include raycast-env.d.ts so auto-generated Preferences types resolve correctly.

Confidence Score: 4/5

The core search fix and archive feature are structurally sound but the async state machine in useArchiveResults warrants careful manual testing before merge.

The useArchiveResults hook coordinates three separate effects, two mutable refs, concurrent fetch workers, and progress callbacks that interact during rapid query changes or unmounts. Previous review rounds identified several issues and the current code appears to address most of them, but the combination of isMounted guards, AbortController chaining, and ref-based deduplication is difficult to fully verify statically.

extensions/apple-developer-docs/src/hooks/useArchiveResults.ts — specifically the three-effect interplay around isTocBuildRunningRef, hasCompleteTocIndexRef, and cleanup paths when shouldLoadArchive toggles rapidly.

Important Files Changed

Filename Overview
extensions/apple-developer-docs/src/hooks/useArchiveResults.ts New 500-line hook managing async archive fetch, concurrent TOC building, and multi-phase state; several race-condition concerns were flagged in earlier review rounds
extensions/apple-developer-docs/src/index.tsx Adds archive preference, type-filter dropdown, combined relevance sorting, and archive status UI; overall logic is sound
extensions/apple-developer-docs/src/scoring.ts New scoring utilities (getSearchTerms, includesAllSearchTerms, scoreSearchResult) — straightforward and correct
extensions/apple-developer-docs/src/config.ts Adds archiveNavigationUrl, archiveIndexUrl, and lowers maxResults to 30; apiBaseUrl is an undocumented Apple-internal endpoint (flagged in prior review)
extensions/apple-developer-docs/package.json Adds includeArchiveResults checkbox preference — definition is clean and well-described

Reviews (13): Last reviewed commit: "fix: reset archive TOC index flag after ..." | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@0xdhrv 0xdhrv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @dustPyrotechnic 👋

Thank you for your contribution 🔥

Can you check this merged PR #27963

I feel like it addresses the issues you mentioned, incase you have some enhancements on top of that, can you please fix the conflicts and update the branch?


I converted this PR into a draft until it's ready for the review, please press the button Ready for review when it's ready and we'll have a look 😊

@0xdhrv
0xdhrv marked this pull request as draft May 20, 2026 10:01
@0xdhrv 0xdhrv self-assigned this May 20, 2026
@dustPyrotechnic
dustPyrotechnic force-pushed the fix/apple-developer-docs-search-api branch from 8310092 to d94a5c3 Compare May 20, 2026 10:48
@dustPyrotechnic
dustPyrotechnic marked this pull request as ready for review May 20, 2026 10:49
@dustPyrotechnic
dustPyrotechnic force-pushed the fix/apple-developer-docs-search-api branch from d94a5c3 to 241ac8a Compare May 20, 2026 12:40
@0xdhrv

0xdhrv commented May 20, 2026

Copy link
Copy Markdown
Member

Hey @CaliCastle @dustPyrotechnic 👋

Any thoughts on this?

@dustPyrotechnic

Copy link
Copy Markdown
Contributor Author

Hey @0xdhrv 👋

Thanks for flagging #27963 — I've taken a look. That PR restores the basic search endpoint, and this PR builds on top of it with additional enhancements:

  • Archive (legacy) documentation search — surfaces results from Apple's archived docs that aren't on the new endpoint, gated behind a user preference (off by default)
  • Chapter-level TOC indexing with bundled cache and background refresh
  • Relevance-based ranking to merge online + archive results
  • Status indicator during archive indexing
  • Fix for the normalizeResult fallthrough that would crash on unknown result shapes

I've also addressed the earlier review feedback (multiple follow-up commits). CI is green and the branch is mergeable. Ready for another look whenever you have a moment 🙏

@dustPyrotechnic
dustPyrotechnic force-pushed the fix/apple-developer-docs-search-api branch from dff1649 to c2b6000 Compare May 26, 2026 08:05
@raycastbot raycastbot added the OP is contributor The OP of the PR is a contributor of the extension label May 26, 2026
@dustPyrotechnic

Copy link
Copy Markdown
Contributor Author

Hi @0xdhrv @CaliCastle 👋

Rebased on latest main and resolved the CHANGELOG.md conflict against the recently merged [Fix Search History] entry. Also addressed Greptile's remaining P2 feedback:

  • Switched getPreferenceValues to the auto-generated Preferences type per project convention (no manual local definition).
  • Changelog uses {PR_MERGE_DATE} placeholder for the new [Archive Search Improvements] entry.

Earlier P1 items were already fixed in previous follow-up commits:

  • normalizeResult now guards "developer" in result before access (no more TypeError on unknown shapes).
  • The archive TOC build state now keys off hasCompleteTocIndexRef, so partial progress no longer permanently latches the build off.

Regarding the P1 endpoint concern: the new apiBaseUrl is the same backend that developer.apple.com/search itself calls and that #27963 (already merged) also uses — if it changes, the existing search would break with it, so this PR doesn't introduce additional risk there.

CI is green and the branch is mergeable. Ready for another look 🙏

@0xdhrv
0xdhrv marked this pull request as draft May 26, 2026 13:46
@raycastbot

Copy link
Copy Markdown
Collaborator

This pull request has been automatically marked as stale because it did not have any recent activity.

It will be closed if no further activity occurs in the next 7 days to keep our backlog clean 😊

@raycastbot raycastbot added the status: stalled Stalled due inactivity label Jun 21, 2026
@raycastbot

Copy link
Copy Markdown
Collaborator

This pull request has been automatically closed due to inactivity.

Feel free to comment in the thread when you're ready to continue working on it 🙂

You can also catch us in Slack if you want to discuss this.

@raycastbot raycastbot closed this Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE extension: apple-developer-docs Issues related to the apple-developer-docs extension extension fix / improvement Label for PRs with extension's fix improvements OP is contributor The OP of the PR is a contributor of the extension platform: macOS status: stalled Stalled due inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants