docs: les deux commentaires qui decrivaient encore le mecanisme supprime

Le JSDoc de `resetOpenedRepos` parlait encore de demonter "les
souscriptions bootstrap detenues", et celui de `getSyncState` decrivait
ses valeurs comme stockees. Les deux disent maintenant ce que le code
fait : liberer les auditeurs et desavouer les documents, et deriver.
This commit is contained in:
Sylvain Duchesne
2026-09-24 13:06:03 +02:00
parent 8338b0efd7
commit 72b4607cbe
@@ -198,8 +198,9 @@ export function setOpenTimeoutForTests(ms: number): void {
OPEN_TIMEOUT_MS = ms; OPEN_TIMEOUT_MS = ms;
} }
/** Reset the open registry (mainly for tests / a switched wallet). Tears down the /** Reset the open registry (mainly for tests / a switched wallet). Releases the bootstrap
* held bootstrap subscriptions so a subsequent open re-subscribes cleanly. */ * listeners so a subsequent open takes out a new subscription, and DISOWNS the documents it
* takes them from rather than forgetting them - see {@link disowned}. */
// @provenance resetOpenedRepos kind=invention level=none ref=none — per-session bookkeeping reset; upstream the verifier owns `self.repos` and nothing resets it from outside // @provenance resetOpenedRepos kind=invention level=none ref=none — per-session bookkeeping reset; upstream the verifier owns `self.repos` and nothing resets it from outside
export function resetOpenedRepos(): void { export function resetOpenedRepos(): void {
for (const [nuri, open] of [...opens]) { for (const [nuri, open] of [...opens]) {
@@ -241,12 +242,15 @@ export function resetOpenedRepos(): void {
/** /**
* The bootstrap sync state of `nuri` (lib-internal accessor; NOT a reactive * The bootstrap sync state of `nuri` (lib-internal accessor; NOT a reactive
* app-facing hook — that is a later phase). Returns `"unknown"` if the repo was * app-facing hook - that is a later phase). **DERIVED on every call, never stored**: from the
* never opened via {@link ensureRepoOpen} (or was opened on the fake-ng no-op * document's one real subscription ({@link docChannel}) and this module's record of having
* path, which has no `State` semantics). Otherwise `"syncing"` (subscribed, no * opened it. Returns `"unknown"` if the repo was never opened via {@link ensureRepoOpen} (or
* `State` yet), `"synced"` (first `State` received — the barrier), or * was opened on the fake-ng no-op path, which has no `State` semantics); `"synced"` once a
* `"timed-out"` (fallback fired without a `State`). `"synced"` and `"timed-out"` * `State` has arrived on the channel standing NOW - the barrier; `"syncing"` while the open is
* are deliberately distinct — a later readiness signal must not confuse them. * inside its bounded wait; and `"timed-out"` when it was opened here with no barrier to show
* for it, whether the fallback fired, the subscribe was refused, or the channel was taken
* away. `"synced"` and `"timed-out"` are deliberately distinct - a readiness signal must not
* confuse them - and deriving both is what stops either outliving its subscription.
*/ */
// @provenance getSyncState kind=aligned level=1 ref=engine/net/src/app_protocol.rs:AppResponseV0 — reports whether the first `State` arrived; upstream this is not observable from JS // @provenance getSyncState kind=aligned level=1 ref=engine/net/src/app_protocol.rs:AppResponseV0 — reports whether the first `State` arrived; upstream this is not observable from JS
export function getSyncState(nuri: Nuri): SyncState | "unknown" { export function getSyncState(nuri: Nuri): SyncState | "unknown" {