Track held execution locks in keyed-lock instead of a request-level registry
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
- #3879 di @thymikee — integrata
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Refactoring
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- node.js, typescript
Direzione di ricerca
Read packages/kernel/src/keyed-lock.ts and packages/daemon/src/server/request-execution-locks.ts first, then inspect their existing tests and the crossed-replay and nested-batch cases. The linked pull request indicates work is already underway. Done when the keyed lock tracks retained frames across sibling scopes, request execution locks has no separate registry, the specified cancellation and same-host behaviors pass, and the close-refusal test uses the production platform refusal.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Purpose
#3323 makes each native macOS app its own device. It adds a rule: a request that already holds an execution lock on a Mac, or on one of its app devices, does not wait for a second lock on that same Mac. Instead it takes the lock only if it is free, and otherwise it is refused with DEVICE_IN_USE (DEVICE_EXECUTION_LOCK_BUSY).
To answer "which locks does this request hold, including those of the requests it is nested in", packages/daemon/src/server/request-execution-locks.ts keeps a second registry next to the kernel keyed lock:
- an
enclosingRequestLocksAsyncLocalStorage; - a per-request
heldLocksset; - a
beforeAcquirehook onwithRequestExecutionLockKeys; - two re-entry special cases.
The kernel keyed lock (packages/kernel/src/keyed-lock.ts) already tracks the locks held by the current async context, except for retained ones. Reviewer suggestion: https://github.com/callstack/agent-device/pull/3323#issuecomment-6322558994.
Required behavior
packages/kernel/src/keyed-lock.tsowns the answer to "which keys of this lock map does the current async context hold". The answer includes locks retained mid-request (whatretainDevicetakes).- Sketch: a
holdKeyedLock(locks, key, signal)that acquires the key and registers its frame in the caller's context, plus aheldKeyedLockKeys(locks)query.
- Sketch: a
request-execution-locks.tsapplies the same-host rule as one check against that query. TheenclosingRequestLocksstore, theheldLocksset and the two re-entry special cases are deleted.- Behavior stays as in #3323:
- A top-level request still waits for its own initial keys in sorted order (host before app).
- A nested request (batch step) and a mid-request retain take a lock on a Mac already held in the context only if it is free; otherwise they are refused with
DEVICE_EXECUTION_LOCK_BUSY. - A key that the context already holds is re-entered.
- Locks on other devices are still waited for.
- The #3858 cancellation signal still ends a queued lock.
Pitfalls to handle
withKeyedLockgives each nested scope a copy of the frame list. A frame registered by a retain inside a nested scope must stay visible to later sibling scopes of the same request, and must be released when the request ends. Example: a replay action retains through its parent's scope.- The same-host rule has to tell the request's own earlier initial keys apart from keys held by enclosing requests. Otherwise a top-level
open(host, then app) would stop waiting for its own app lock.
Also in scope
- The close-refusal test in
packages/daemon/src/sessions/handlers/__tests__/session-device-claims.test.tscurrently hand-writes the platform error. Build it from the production platform refusal instead:resolveMacOsAppDeviceOpenTargetwith a stub host, where the test layering allows it.
Completion conditions
- The current tests pass unchanged or stronger. In particular:
request-execution-locks.test.ts, including the crossed-replay and nested-batch cases;request-router-app-device-batches.test.ts;- the #3858 cancellation tests.
- A kernel test covers a retained frame that is visible to later sibling scopes and is released at the end of the request.
request-execution-locks.tskeeps no lock registry of its own.
Dependencies
Blocked by: #3323. It must merge first, because this issue refactors the code that #3323 adds.
- Lingua principale
- TypeScript
- Stelle
- 5.1k
- Fork
- 339
- Merge medio
- 12h 22m
- PR unite (30g)
- 701
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di callstack/agent-device
-
iOS: the alert-unrecognized warning of `open --launch-url` says to `alert accept`, which grants App Tracking Transparency when that is the alertForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
callstack/agent-device#3921 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Limrun iOS fill reports success but drops non-ASCII textForse già presa @mvanhorn l’ha presa 3 giorni fa. Apertabug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
callstack/agent-device#3819 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
callstack/agent-device#1869 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
callstack/agent-device#3931 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
callstack/agent-device#3929 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di callstack/agent-device
Issue simili
-
[Bug]: REST API URL starting with "http" but no scheme (e.g. httpbin.org/get) is not given an http:// prefixForse già presa @ItsDeadlyProgrammer l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
appsmithorg/appsmith#42471 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ehmpathy/rhachet-roles-bhrain#705 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Status: Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
mermaid-js/mermaid#8546 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
braintrustdata/braintrust-sdk-javascript#2659 ·
I maintainer di solito rispondono entro 1 giorno