Repository navigation
Conversation
…ose body is unknown Native code will later count attempts whose result was in doubt, and settle a request as accepted when the status said accepted but the body was not received. This adds the TypeScript side so the native work has a contract. Behavior does not change until native sends the new fields. - Meta.ambiguousAttempts: the count from native, 0 when absent or malformed. - AttemptEvent.bodySent: 'none' | 'partial' | 'full', optional. - RawResponse.bodyUnknown: true, optional. A definition without a parser gets it in onSuccess. A definition with a parser gets the new optional onBodyUnknown(response, vars, meta) instead of the parser and onSuccess, never onError. With no onBodyUnknown, no handler runs, the outcome is acknowledged, and the client warns once per key. - The fake native can settle the case and set the count. - Type tests, jest tests, README, and an Unreleased CHANGELOG section. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…a parser Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…known Before, a definition with a response parser and onSuccess but no onBodyUnknown acknowledged the outcome with no handler call and one warning per key. The app never learned that the server had the object. Now the outcome is held unacknowledged, as for a key with no definition: native keeps the row, the client warns for each outcome with the event as detail, and the outcome is delivered when define() adds onBodyUnknown for the key or at the next launch. A parser definition with neither onSuccess nor onBodyUnknown asked for no result, so it is still acknowledged with no call. Any truthy bodyUnknown now counts as the flag, so a wrong value never sends an accepted request to the parser with no body. Native sends a JSON boolean. Tests: three held outcomes with rows kept, release in the same session, a real redelivery at the next launch through the fake, the quiet case, a truthy flag of 1, a chunked completion, a late definition, and an ack that waits for an async onBodyUnknown. Renamed two tests to what they show. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- CHANGELOG states the one change today: meta.ambiguousAttempts is 0. - README: the retry-table row says native does not send the flag yet; the hold rule; an onSuccess that reads body without the check throws once native sends the flag; handler examples use block bodies. - Type tests compile the README examples. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- README: this hold emits no state event, the row stays completed until the ack, and the onWarning warning (with the event as detail) is the signal. It is an exception to the order per id. The list of reasons a completed row stays now includes it. - The fake's settle() doc and its timeout message name the case. - The createDelivery and release() comments cover both holds. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
What this adds and why
Two native changes come later. One counts the attempts whose result was in doubt. The other settles a request as accepted when the status said "accepted" but the response body did not arrive. This PR adds the TypeScript side of both: the types, the delivery rules, the fake native module, tests and docs. The native PRs then have a contract to build to.
One thing changes now: every handler's
metahasambiguousAttempts, which is 0 for today's events. A test that compares the wholemetaobject, and aMetabuilt by hand, need the new field. Nothing else changes until native sends the new fields.Part 1: attempts in doubt
The library always sends a request again when it cannot tell if the server got it. Now it tells the app how often that happened.
Meta.ambiguousAttempts: number: attempts of the current generation that ended with no server answer after the whole request can have reached the server. A count above 0 means the server can have more than one copy. A missing or bad value reads 0.AttemptEvent.bodySent?: 'none' | 'partial' | 'full': how much of the request body had left when the attempt ended.Part 2: accepted, body unknown
When the server accepted a request but the library has no response body, the request is done. It is never sent again and never reported as an error. The
truncatederror keeps its one meaning: the body was over 1 MB.RawResponse.bodyUnknown?: true.bodyis then undefined. Native sends a JSON boolean; JS reads any truthy value as the flag, so a wrong value never sends an accepted request to the parser.responseparser: the definition gets the flag inonSuccess(raw, vars, meta), like any completed outcome.onBodyUnknown: the parser andonSuccessdo not run, andonErroris not called. The new optional handleronBodyUnknown(response, vars, meta)runs instead. Only a definition with a parser accepts it.onSuccess, noonBodyUnknown: the outcome is held, as an outcome with no definition is held today.onWarning. The detail is the outcome, with itsvars.define()of the key addsonBodyUnknown, or at the next launch, withmeta.deliveriesgrown.createFakeNative()settles the case withresponse: { bodyUnknown: true }and sets the count with theambiguousAttemptsoverride.What does not change
truncatedto a definition with a parser.Meta.ambiguousAttemptsis the one required field.Tests
define()addsonBodyUnknown.deliveriesgrown.1and offalse.onBodyUnknown.onBodyUnknownthat runs again at the next launch.src/__typetests__/doubt.ts): the new fields, theonBodyUnknowntypes,onBodyUnknownrefused without a parser, and the README examples.=== true, routing toonErrorand running the parser.yarn lint:ci,yarn typecheckandyarn test(331 tests) pass.swift test(iOS host) and the Android unit tests passed on the first version of this branch; the later commits change no native code.Two independent review rounds were applied. Part of RAD-17385.
🤖 Generated with Claude Code