Renew processing locks and surface handler errors - #15
Draft
mayf3 wants to merge 3 commits into
Draft
Conversation
|
|
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.
Independent review amendment V2
Review identity:
CODEX_LARK_CHANNEL_SDK_PR15_INDEPENDENT_REVIEW_2026_08_19The reviewed source head
3940d8a67709902584f040fea1b4c2aa0418f135receivedREQUEST_CHANGES. Corrective commitbd24f6742513769c80b5401b96ad464d74dd2027addresses all three blockers without rewriting the reviewed history:
ProcessingLock.acquirenow returns an immutable,tokenized
ProcessingLease. Exact leases flow through batching/queueing andare required by
stopRenewalandrelease; stale owners are no-ops. Activeand finalizing leases cannot be stolen on wall-clock expiry.
errorhandler may return a Promise.Sync throws, rejected Promises, and throwing thenables are consumed and
logged without recursive emission, unhandled rejection, or cleanup impact.
milliseconds in
1..2,147,483,647, with renewal strictly below TTL. EN/ZHdocs now record defaults, derived behavior, range, relation, and ownership
semantics.
V2 validation:
pnpm install --frozen-lockfile(CI=true) — passedpnpm test— 56 files, 581 tests passedpnpm typecheck— passedpnpm lint— passed (existing warnings/info only)pnpm build— passednpm pack --dry-run— passedgit diff --check— passedgitleaks git 3940d8a..bd24f67— no leaksPackaging disposition:
existing
preparescriptdependency bug (
npm/cli#4828) beforetsdowncould load the rolldown nativebinding; the same control run fails identically at reviewed head
3940d8a, sothis is not introduced by the V2 corrective commit
IGNORE_SCRIPTS_GIT_SHA_INSTALL: PENDINGonly after focused independent review of the new source head
dist/files are added to this upstream PRSummary
messagehandler promises through the existing publicchannel.on('error')pathRoot cause
SafetyPipelinelogged message handler failures but did not forward them to the channel's public error observer. Its processing lock also used a fixed expiry, so a handler or queued batch that outlived the original TTL could lose its in-flight exclusion before settling.Changes
SafetyPipelineOptions.onErrorseam and wire it to the existingLarkChannel.emitErrorSafetyConfig.processingLock.ttlMsandrenewIntervalMs, with fail-loud validationdist/artifacts during Git dependency installation viaprepare, so a pinned commit is directly consumableNo package version change is included.
Validation
pnpm test— 56 files, 562 tests passedpnpm typecheck— passedpnpm lint— passedpnpm build— passedpnpm pack, followed by installation from the tarball in an empty HOME — passednpm install https://github.com/mayf3/channel-sdk-node.git#3940d8a67709902584f040fea1b4c2aa0418f135in an empty HOME — passedThe added regressions cover queue-enabled and queue-disabled error delivery, a throwing error observer, renewal across multiple original TTL periods, concurrent duplicate suppression, queued lease renewal, post-settlement SeenCache/release behavior, timer disposal, and invalid configuration.
External runtime packaging note: source head
bd24f6742513769c80b5401b96ad464d74dd2027was independently reviewed PASS; fork-only runtime revisionab028f9dbcc09effbdfa4c9885cdcc1f5ecc623fexists separately onmayf3/channel-sdk-node, while this upstream PR still contains nodist/artifacts.