Document the actors module to the standard of the other published modules - #273
Draft
daniellekorn wants to merge 2 commits into
Draft
Document the actors module to the standard of the other published modules#273daniellekorn wants to merge 2 commits into
daniellekorn wants to merge 2 commits into
Conversation
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.46-pr.273.678702bPrefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.46-pr.273.678702b"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.46-pr.273.678702b"
}
}
Preview published to npm registry — try new features instantly! |
daniellekorn
force-pushed
the
sdk-actors-docs
branch
3 times, most recently
from
September 6, 2026 06:57
6b31e58 to
a27da6a
Compare
… modules The actors page published as 18 lines: a truncated type signature, two sentences and one snippet. connect(), subscribe(), send(), close() and unsubscribe() did not appear at all. Adds a module overview covering what an Actor instance is, a capability list, the supported authentication modes, and the note that connections stay open until closed. Every public method now has a description, @PARAM, @returns and at least one @example, and each example opens with a comment so the pipeline renders it as the code-block title. Cross-references use explicit same-page anchors such as [connect()](#connect). Every type on this page is appended into it, so {@link Connection.close} resolves to a file the pipeline then unlinks and would 404, while a bare {@link close} resolves to a working anchor and is kept. Plain code spans are used only where no heading exists (ActorNameRegistry, ActorSubscription) or where the reference would point at the section it already sits in. Every behavioural claim is checked against src/modules/actors.ts and src/client.ts rather than inferred. See the PR description for the line-by-line trace.
ActorRef, Connection, ActorConnectOptions and ActorRegistry were absent from types-to-expose.json, so every method on the actors module was stripped before rendering and the page had nowhere to put them. Exposes them and appends them into the actors page, matching how connectors and entities carry their supporting types, so the nav keeps listing only modules. ActorSubscription and ActorClient stay unexposed: ActorSubscription already renders inline as the return type of subscribe() and appending it too produced a duplicate unsubscribe() section. Also drops the actors suppression added while the JSDoc was missing.
daniellekorn
force-pushed
the
sdk-actors-docs
branch
from
September 6, 2026 07:25
a27da6a to
e0764c2
Compare
daniellekorn
marked this pull request as draft
September 6, 2026 07:51
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.
Follow-up to #272, which held the actors page back from base44-dev/mintlify-docs#1997 because it was not publishable. This writes the docs and un-holds it.
Note
Based on
sdk-jsdoc-style(#272), notmain. Merge #272 first and this retargets tomainautomatically.What was wrong
The actors page published as 18 lines: a truncated type signature, two sentences, and one snippet.
connect(),subscribe(),send(),close(), andunsubscribe()did not appear on it at all.The JSDoc was not really the problem.
ActorRef,Connection,ActorConnectOptions, andActorRegistrywere missing fromtypes-to-expose.json, so every method was stripped before rendering and the page had nowhere to put them. A renamed module page is treated as exposed regardless of that file, which is why the module page itself survived while all of its content was removed.@example@param@returns@paramcoversconnect(options),subscribe(callback), andsend(data).close()andunsubscribe()take no arguments and returnvoid, so they carry a description and an example only.Every behavioural claim, traced to the code
connect()is idempotent while open, returning the same connectionactors.ts:232if (conn) return connconnect()afterclose()worksactors.ts:235if (conn === c) conn = nullsend()before open is buffered and flushed on openpartysocket_messageQueueenqueues when not opensend()afterclose()is dropped silentlyactors.ts:205if (this.closed) returnclose()tears down socket, heartbeat, and all listenersactors.ts:209-219close()is safe to call more than onceactors.ts:210if (this.closed) returnactors.ts:174loopsthis.listeners;197listeners.addunsubscribe()removes one listener, leaves the rest liveactors.ts:199listeners.delete(callback)onErroractors.ts:128-137terminal statuses callthis.close()thenonMintError, wired atclient.ts:218onMintError: options?.onErrorconnect()and a re-subscribeactors.ts:216listeners.clear(), newConnectiongets an empty setactors.ts:177-193heartbeat,DEAD_MSwatchdog,ws.reconnect()whenOPENbut silentoptions.idbecomes the actor'sconn.idactors.ts:101then271["_pk", connectionId]asServiceRoleclient.ts:270serviceRoleModuleshas noactorskeyOne claim was wrong, and is corrected here
An earlier draft said "Connecting anonymously requires a browser environment." That was inferred from the comment at
actors.ts:54(422 = no principal, e.g. anonymous outside a browser), and it is wrong.422 is in
PROXY_FALLBACK_STATUSES(actors.ts:59), notTERMINAL_MINT_STATUSES(:65, which is 400/403/404). So an anonymous connect outside a browser does not fail. The direct mint returns 422 and the SDK falls back to the platform proxy, which the same comment block describes as having looser validation and as "always safe" to fall back to.The sentence now states only what the code shows, which is that the module is available in anonymous and user modes and is absent from
asServiceRole.Changes
Pipeline. Exposes the four types and appends them into the actors page, matching how connectors and entities carry their supporting types, so the nav keeps listing only modules.
ActorSubscriptionandActorClientstay unexposed on purpose:ActorSubscriptionalready renders inline as the return type ofsubscribe(), and appending it too produced a duplicateunsubscribe()section.Writing. A module overview explaining what an Actor instance actually is, a capability list, the supported authentication modes, and the lifecycle note that connections stay open until closed. Each example opens with a
//comment, because the pipeline promotes that comment to the code-block title and an example without one loses its first line of code.Links. Cross-references use explicit same-page anchors, such as
[connect()](#connect).Every type on this page is appended into it, so
{@link Connection.close}resolves toConnection.mdx#close, a file the pipeline then unlinks, and it would 404. A bare{@link close}does resolve to a working anchor and is kept, which is the patternentitiesuses, but that only works between members of the same interface.A hand-written markdown anchor works across interfaces and survives the pipeline unchanged, so the cross-references are real links rather than dead code spans. All seven anchors used (
#connect,#subscribe,#send,#close,#connection,#actorregistry,#actorconnectoptions) are checked against the headings on the assembled page.Plain code spans remain in exactly two situations: the target has no heading because it is not appended (
ActorNameRegistry,ActorSubscription), or the reference would point at the section it already sits in.ActorSubscription's own description is the clearest case of the latter, since it renders insidesubscribe()'s Returns block and a link tosubscribe()there would be circular.Still worth a second opinion
The table above is what the SDK does. What the server does with a connection is outside this repo, so someone who owns the subsystem (#212, #260) should confirm:
Verification
npx tsc --noEmitcleanactorsrestored to itPre-existing, not fixed here
Six examples in
integrations.mdxandauth.mdxhave no leading comment, so their first line of code is being consumed as the title and is missing from the rendered block. Four of them start withtry {, so the published sample is atryblock with notry. Worth its own PR, since each needs a real title written rather than a mechanical fix.