docs: cover the options and functions the JS API reference was missing - #178
Merged
Conversation
`docs/api-js.md` was inherited from upstream and lists eight of the seventeen options `CodePushOptions` carries. Among the nine it left out is `releaseHistoryFetcher`, which is required - an app cannot be configured without one - so the reference described a decorator that could not be called as documented. Add the nine entries, taking their wording from the typings and from the README's telemetry section, which already describe them. Two carry a constraint the type states and the prose has to repeat: `updateChecker` is deprecated in favor of `releaseHistoryFetcher`, and `ignoreFailedUpdates` is typed `never` here, so only `sync()` accepts it. `SyncOptions` was missing `ignoreFailedUpdates` and `rollbackRetryOptions`. That section refers back to `CodePushOptions` for the options the two share, so `rollbackRetryOptions` does the same, and `ignoreFailedUpdates` - the one option `CodePushOptions` forbids - is documented in full there instead. Its intro claimed the two sets differ only in `checkFrequency`, which stopped being true once that option is listed. `onRolloutSkipped` is documented as the runtime calls it, with the label alone. The typings declare a second `error` parameter that `src/CodePush.js:86` never passes, and the entry says so rather than promising a caller an argument it will not receive. `onUpdateArchiveResult` was already documented, but ran its call timing, the contents of the result, what a fallback means and the observation guarantee together in one sentence. Split it, and let the link to the type carry the shape the entry was restating.
`clearUpdates` was the only one of the namespace's eight functions with no section of its own, and the entry listing it linked `#clearupdates`, an anchor no heading in the file produced. It was the reference's only broken in-page link. Give it a section next to its siblings, in the order the list at the top already puts it, with the content of the typings JSDoc: what it clears, the deployment switch it exists for, and the warning that CodePush calls it itself when it is needed. The heading is `codePush.clearUpdates`, like every other function section, so its anchor is `#codepushclearupdates` and the link had to move with it. That also makes the entry match the eight above it, which already point at `#codepush`-prefixed anchors. The entry carried trailing whitespace, and the line under it held nothing else; both are cleared while the line is being touched.
floyd-soomgo
force-pushed
the
docs/js-api-reference-coverage
branch
from
August 25, 2026 12:03
96ab0c7 to
ce410ce
Compare
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.
Background
docs/api-js.mdis the JS API reference. It came from upstream Microsoft CodePush and never caught up with what this fork added, so it documented 8 ofCodePushOptions' 17 options.The most consequential omission:
releaseHistoryFetcheris required — an app cannot be configured without it — and the reference did not mention it exists. Six callbacks this fork added were described in the README's "4-1. Telemetry Callbacks" section but nowhere in the reference. AndclearUpdateswas the only one of the namespace's eight functions with no section at all, which is why the entry at the top of the file linked to an anchor that resolved to nothing.None of this is new drift. It is what the reference has looked like since the fork started adding options.
Changes
CodePushOptions— nine entries added.releaseHistoryFetcher(required, with what it receives and must return),updateChecker(deprecated, what replaces it, and that setting it takesreleaseHistoryFetcherout of the path entirely),ignoreFailedUpdates(typedneverhere, so accepted only bysync()— the restriction is documented rather than glossed), and the six callbacksonUpdateSuccess,onUpdateRollback,onDownloadStart,onDownloadSuccess,onSyncError,onRolloutSkipped.SyncOptions— two entries added.ignoreFailedUpdates, documented in full here since this is where it is actually usable, androllbackRetryOptions. The section's intro claimed the two option sets differ only incheckFrequency; that stops being true onceignoreFailedUpdatesis listed, so it now names both exceptions.codePush.clearUpdates— new section, and the link at the top of the file now points at an anchor that exists. The link's target changed from#clearupdatesto#codepushclearupdates, matching the eight sibling entries; a bare#### clearUpdatesheading would have resolved the old anchor but broken the naming every other function section follows.onUpdateArchiveResultwas restructured while adjacent entries were being written — it had grown into one run-on entry carrying call timing, the result's composition, fallback semantics, the observation-only guarantee and the type link.Existing entries were not reordered.
rollbackRetryOptionsstill sits out of alphabetical order afterupdateDialog's sub-list, where it already was.Verification
Nothing checks this file automatically, which is why it drifted. The check is a survey that pulls the option names out of the typings and subtracts the ones the reference lists:
T=typings/react-native-code-push.d.ts { awk '/^export interface CodePushOptions/,/^}/' $T; awk '/^export interface SyncOptions/,/^}/' $T; } \ | grep -oE '^ [a-zA-Z]+\??:' | tr -d ' ?:' | sort -u > /tmp/all.txt awk '/^##### CodePushOptions/{c=1} c&&/^##### /&&!/CodePushOptions/{exit} c' docs/api-js.md \ | grep -oE '^\* __[a-zA-Z]+__' | sed 's/\* __//; s/__//' | sort > /tmp/doc.txt comm -23 /tmp/all.txt /tmp/doc.txtEmpty for both sections after these commits. Every in-page anchor was also checked against the real headings: 19 unique targets, 26 headings, none unresolved.
npm run jest259/259 andtype:cli/type:scripts/type:e2eall green — formality for a markdown change, but run. Onlydocs/api-js.mdchanged.Note that
npm run typecheckdoes not pass on this stack:type:srcfails atsrc/specs/NativeCodePush.ts:4with TS2305 onEventEmitter, which predates all of this work.Follow-ups
onRolloutSkipped's type is wrong.typings/react-native-code-push.d.ts:234declares(label: string, error: Error) => void, butsrc/CodePush.js:86callsonRolloutSkipped?.(latestVersion)— one argument, and there is no error on that path at all; the release was passed over by a rollout bucket check, not by a failure. A TypeScript app readingerror.messagecompiles and then crashes. The reference documents the runtime signature and flags the mismatch inline; fixing the type is a production change and did not belong here.npm runwould catch the next option added without a reference entry, which is the only reason this gap grew as large as it did.