MCPcopy Create free account

hub / github.com/PerpetualSoftware/pad / functions

Functions9,998 in github.com/PerpetualSoftware/pad

↓ 17 callersMethodrelease
* Drop the lease. `released` is false on a repeat call (no-op). `stackEmpty` * reports whether any lease remains AFTER this release — the caller use
web/src/lib/a11y/viewerBackdrop.ts:37
↓ 17 callersFunctiontestServerWithCollab
testServerWithCollab wires a RoomManager onto a fresh test server so the collab handler answers 200/101 on the happy path. Tests that only assert on a
internal/server/handlers_collab_test.go:21
↓ 17 callersFunctiontestServerWithPresence
testServerWithPresence gives a server both the watch bus and the presence registry — the production pairing (cmd_server.go wires them on adjacent line
internal/server/handlers_sessions_test.go:19
↓ 17 callersFunctiontestStoreOAuth
Tests for the OAuth server constructor + audience strategy + storage adapter (PLAN-943 TASK-951 sub-PR B). Each layer is covered: - NewServer: requir
internal/oauth/server_test.go:40
↓ 16 callersMethodAdd
Add implements SessionPresence. Returns the generated id even when the Redis write fails. That is deliberate and it is the same posture the rest of t
internal/server/session_presence_redis.go:458
↓ 16 callersMethodCreateAccessToken
============================================================ Access tokens (handler/oauth2/storage.go AccessTokenStorage) ============================
internal/store/oauth.go:310
↓ 16 callersMethodGetPlatformSetting
GetPlatformSetting returns a single platform setting value, or empty string if not set.
internal/store/platform_settings.go:6
↓ 16 callersFunctionNewProcessor
NewProcessor returns the Processor compiled into this binary. Pure-Go build → pureGoProcessor. libvips build → vipsProcessor (Phase 2). Constructed o
internal/attachments/processor_purego.go:43
↓ 16 callersFunctionNewRedisSessionPresence
NewRedisSessionPresence returns a shared registry backed by client. The client is the SAME one the watch bus uses (cmd/pad/cmd_server.go dials once o
internal/server/session_presence_redis.go:420
↓ 16 callersMethodSetObserver
SetObserver attaches an Observer. Passing nil detaches. Safe to call after the bus is running; cmd/pad/cmd_server.go calls it at wiring time.
internal/watchevents/observer.go:157
↓ 16 callersMethodSetSessionPresence
SetSessionPresence attaches the live-session registry read by GET /api/v1/sessions and written by GET /api/v1/events/stream (PLAN-2558 S1). Nil-checke
internal/server/server.go:822
↓ 16 callersMethodSetUserPlan
SetUserPlan updates a user's billing plan.
internal/store/limits.go:327
↓ 16 callersMethodSetWatchEventsBus
SetWatchEventsBus attaches the watch/nudge notification bus consumed by GET /api/v1/events/stream (TASK-2533). Nil-checked by every producer and by th
internal/server/server.go:812
↓ 16 callersFunctionWithTokenAllowedWorkspaces
WithTokenAllowedWorkspaces returns ctx decorated with the OAuth token's workspace allow-list set at consent time (TASK-952). The list is either a set
internal/server/context.go:140
↓ 16 callersMethodcycledCount
()
internal/events/observer_test.go:73
↓ 16 callersMethodfanOutFromRedis
fanOutFromRedis is the receive path: a message that arrived on the subscription identified by gen, carrying the ID space it belongs to. A zero epoch
internal/events/redis_bus.go:2444
↓ 16 callersMethodgetAsset
getAsset issues GET on the asset endpoint. rawQuery is appended verbatim (already URL-formed, no leading '?').
internal/server/handlers_share_attachments_test.go:214
↓ 16 callersFunctiongetOnlyAttachmentID
getOnlyAttachmentID returns the ID of the single live attachment row in a workspace — the test infrastructure uploads at most one blob per call, so th
internal/server/handlers_storage_test.go:410
↓ 16 callersFunctionimageRef
(id string)
internal/server/handlers_share_attachments_test.go:179
↓ 16 callersFunctionnewMovedToFixture
(t *testing.T)
internal/server/item_moved_to_test.go:49
↓ 16 callersMethodsetContent
setContent overwrites an item's markdown body.
internal/server/handlers_share_attachments_test.go:172
↓ 15 callersMethodAdd
Add implements SessionPresence.
internal/server/session_presence.go:348
↓ 15 callersMethodCreateShareLink
CreateShareLink creates a new share link and returns it with the raw token. The raw token is only available in this response — it is not stored.
internal/store/share_links.go:47
↓ 15 callersMethodDeleteWorkspace
(slug string)
internal/store/workspaces.go:262
↓ 15 callersMethodGetItemIncludeDeleted
GetItemIncludeDeleted finds an item by id including soft-deleted items. Used by code paths that need to act on records the user already owns even thou
internal/store/items.go:881
↓ 15 callersMethodIsConfigured
IsConfigured reports whether the client has an explicit global connection configuration, either from config.toml or an environment/flag override.
internal/config/config.go:564
↓ 15 callersMethodJSONExtractText
JSONExtractText returns SQL to extract a text value from a JSON column. SQLite: json_extract(col, '$.key') PostgreSQL: col->>'key'
internal/store/dialect.go:33
↓ 15 callersFunctionMigrateFields
MigrateFields maps field values from a source schema to a target schema. Fields with matching keys and compatible types are transferred. Incompatible
internal/items/migrate.go:62
↓ 15 callersFunctionParseCollectionTraits
ParseCollectionTraits decodes a stored traits JSON blob. An empty or "null" blob yields the zero value with no error — a collection that declares no t
internal/models/collection_traits.go:176
↓ 15 callersMethodRestoreItem
RestoreItem un-archives a soft-deleted item and bumps the workspace-scoped seq so delta-sync clients re-materialize the row. Same lock + subquery shap
internal/store/items.go:2813
↓ 15 callersMethodSeedDefaultCollections
SeedDefaultCollections rescues a workspace that ended up with zero collections by seeding it with the standard Software-shape Defaults(). It is intent
internal/store/collections.go:836
↓ 15 callersMethodarchiveSource
()
internal/server/item_moved_to_test.go:108
↓ 15 callersMethodbearerHeaders
()
internal/server/handlers_grant_visibility_test.go:104
↓ 15 callersMethodcopy
(t *testing.T, req CrossWorkspaceCopyRequest)
internal/store/items_cross_workspace_copy_test.go:55
↓ 15 callersMethodcycleIfIdle
cycleIfIdle ends this instance's coverage and replaces its subscription when nothing has arrived for the idle timeout. DROP-AND-CYCLE, NOT DROP ALONE
internal/watchevents/heartbeat.go:297
↓ 15 callersFunctiondecodePayload
decodePayload parses the "<epoch>|<id>|<json>" wire form publishScript emits, and ALSO accepts a bare JSON body with no prefix. THE BARE FORM IS NOT
internal/events/redis_bus.go:2331
↓ 15 callersFunctionnewMockStore
(hooks []models.Webhook)
internal/webhooks/dispatcher_test.go:26
↓ 15 callersFunctionnewShareAssetFixture
(t *testing.T)
internal/server/handlers_share_attachments_test.go:115
↓ 15 callersFunctionpostFormWithCookie
postFormWithCookie POSTs an x-www-form-urlencoded body with both a session cookie and the matching CSRF cookie set, plus the session-bound User-Agent.
internal/server/handlers_oauth_test.go:2497
↓ 15 callersFunctionpostOAuthForm
postOAuthForm POSTs an x-www-form-urlencoded body without any auth (used for /oauth/revoke + /oauth/token, where client_id rides in the form for publi
internal/server/handlers_oauth_test.go:2631
↓ 15 callersFunctionrunAuthCodeFlow
runAuthCodeFlow drives a full /oauth/authorize/decide → /oauth/token exchange and returns the parsed token JSON. Each invocation needs a unique verifi
internal/server/handlers_oauth_test.go:2567
↓ 15 callersFunctionseedParentAndChildren
seedParentAndChildren creates a plan + N child tasks with the given statuses (one per child), returning the parent and the slice of child refs in crea
internal/server/handlers_items_open_children_guard_test.go:24
↓ 15 callersFunctionwaitElectable
waitElectable polls until the room for itemID has at least n conns that pickApplier would actually elect — writable, anchored (replayDone), not frozen
internal/collab/manager_test.go:306
↓ 15 callersFunctionwaitForFrameWithEvent
(t *testing.T, frames <-chan string, eventType string)
internal/server/handlers_events_resume_test.go:63
↓ 15 callersFunctionwriteOutboxTx
writeOutboxTx appends one canonical event to the outbox on the caller's transaction. Two rejections, both deliberately hard errors that fail the encl
internal/store/event_outbox.go:145
↓ 14 callersMethodApply
Apply walks doc and stamps EnumSource + resolved Enum values on matching args and flags. Resolution failures are silent: the document continues to adv
internal/cmdhelp/dynamic.go:113
↓ 14 callersMethodCreateDocument
(workspaceID string, input models.DocumentCreate)
internal/store/documents.go:147
↓ 14 callersFunctionCrossWorkspaceWorkspaceOnlyScope
CrossWorkspaceWorkspaceOnlyScope requests a WORKSPACE-LEVEL CHECK ONLY, which is almost never sufficient on its own. It answers "does this caller hav
internal/server/authz_cross_workspace.go:374
↓ 14 callersMethodFetch
(ctx context.Context, args []string)
internal/mcp/resources.go:47
↓ 14 callersMethodGetItemLinks
GetItemLinks returns links where the given item is either source or target. Links pointing to or from soft-deleted items are filtered out so callers (
internal/store/items.go:3182
↓ 14 callersMethodListWorkspaces
(ctx context.Context)
internal/mcp/errors.go:322
↓ 14 callersMethodMoveItem
MoveItem moves an item to a different collection within the same workspace. It updates the collection_id and fields JSON. The item_number is preserved
internal/store/items.go:4628
↓ 14 callersFunctionNewStorage
NewStorage wraps a *store.Store as a fosite-compatible adapter. The store must be a fully-initialized pad store (migrations applied); no validation he
internal/oauth/storage.go:129
↓ 14 callersMethodSetEventBus
SetEventBus attaches an event bus for real-time SSE streaming.
internal/server/server.go:804
↓ 14 callersMethodSetSSELimits
SetSSELimits configures the streaming connection limits. A value of 0 means unlimited for any of them. `global` and `perUser` bound BOTH stream endpo
internal/server/server.go:1103
↓ 14 callersMethodSubscribeAndReplaySince
SubscribeAndReplaySince atomically checks the per-workspace limit, registers the subscriber, and captures the buffered events above sinceID — all in O
internal/events/bus.go:254
↓ 14 callersMethodappend
append adds an event to the ring buffer, evicting the oldest if full.
internal/events/bus.go:403
↓ 14 callersFunctionassertSourceSet
(t *testing.T, p *AttachmentCopyPlan, want ...string)
internal/store/attachments_copy_plan_test.go:115
↓ 14 callersMethodcopyOK
copyOK issues the copy as the owner and requires a 201.
internal/server/handlers_items_copy_test.go:94
↓ 14 callersFunctiondialCollab
dialCollab opens a WebSocket against the test server's collab endpoint with the given itemID. Returns the connection and the HTTP response. The respon
internal/server/handlers_collab_test.go:40
↓ 14 callersFunctiondoRequestWithBearer
doRequestWithBearer dispatches a request with an Authorization: Bearer header set. The existing test helpers in server_test.go don't take a token para
internal/server/middleware_auth_public_paths_test.go:25
↓ 14 callersFunctiondoTransform
(srv *Server, slug, attachmentID string, body transformRequestBody)
internal/server/handlers_attachments_transform_test.go:29
↓ 14 callersMethodexecuteRequest
executeRequest builds + serves + packages a single HTTP request against the wrapped handler. Pulled out of Dispatch so the special-case methods (dispa
internal/mcp/dispatch_http.go:475
↓ 14 callersMethodgetSource
getSource performs GET on the source item exactly as the router would and requires a 200. Use rawGetSource when the status is what is under test.
internal/server/item_moved_to_test.go:124
↓ 14 callersFunctionmcpAndOAuthEnabledTestServer
===================================================================== mcp ↔ OAuth integration (sub-PR E, TASK-1027) ==================================
internal/server/handlers_mcp_test.go:512
↓ 14 callersFunctionmcpEnabledTestServer
mcpEnabledTestServer builds a Server with cloud mode + a stub streamable-HTTP transport so tests targeting auth / discovery / routing don't need to dr
internal/server/handlers_mcp_test.go:487
↓ 14 callersFunctionmustList
mustList reads a registry's session list, failing the test if the read itself failed. ListForUser gained an error when an out-of-process implementati
internal/server/session_presence_test.go:192
↓ 14 callersFunctionnewRecordingObserver
()
internal/watchevents/observer_test.go:30
↓ 14 callersFunctionoutboxPayloadFor
outboxPayloadFor returns the decoded payload of the single event of the given type for an item, failing if there is not exactly one.
internal/store/event_outbox_test.go:50
↓ 14 callersFunctionrequireRole
requireRole checks if the user's workspace role meets the minimum required level. Role hierarchy: owner > editor > viewer.
internal/server/middleware_auth.go:772
↓ 14 callersMethodrunOrphanGCSweep
runOrphanGCSweep walks the orphaned-attachments query and reclaims rows past the grace period. Two reclamation paths: - DB row only. content_hash is
internal/server/orphan_gc.go:78
↓ 14 callersFunctionsetupPushTest
setupPushTest mirrors setupItemOpenTest (item_open_test.go): points getClient()/getWorkspace() at a fake httptest server via the same urlFlag/workspac
cmd/pad/cmd_push_test.go:14
↓ 14 callersFunctionwaitFor
waitFor polls until cond holds or the deadline passes. Delivery crosses a goroutine and a socket, so a bare read after Publish is a race.
internal/watchevents/redis_bus_integration_test.go:41
↓ 14 callersFunctionwedge
wedge simulates the failure this whole unit exists to detect: the outbound probe keeps SUCCEEDING and nothing ever comes back. It has to be simulated
internal/events/redis_heartbeat_test.go:115
↓ 14 callersFunctionworkspaceRole
workspaceRole returns the user's role in the current workspace, as set by RequireWorkspaceAccess. Returns empty string if not set.
internal/server/middleware_auth.go:716
↓ 14 callersMethodwriteItemResolveError
writeItemResolveError distinguishes a soft-deleted (archived) item from a genuinely-missing one for mutation handlers. An archived item still appears
internal/server/handlers_items.go:845
↓ 13 callersMethodBackfillOAuthConnections
BackfillOAuthConnections walks every distinct grant chain found in oauth_access_tokens and oauth_refresh_tokens, parses the newest chain row's session
internal/store/oauth_connections_backfill.go:93
↓ 13 callersFunctionEnsureServer
EnsureServer checks if the pad server is running; if not, starts it in the background.
internal/cli/server.go:16
↓ 13 callersMethodGetCrossWorkspaceBacklinks
GetCrossWorkspaceBacklinks returns inbound `[[ws::REF]]` backlinks pointing at the queried target (`targetWorkspaceID`, `targetRef`) from EVERY OTHER
internal/store/wiki_links.go:1239
↓ 13 callersMethodInsertMCPAuditEntry
InsertMCPAuditEntry persists one audit row. Called from the audit middleware's async writer; the caller owns the buffered channel + the ordering, so t
internal/store/mcp_audit.go:53
↓ 13 callersFunctionNewRedisBusWithKeys
NewRedisBusWithKeys is NewRedisBus with an explicit key namespace (BUG-2724). cmd/pad/cmd_server.go uses this one, passing the value shared with the w
internal/events/redis_bus.go:830
↓ 13 callersFunctionNewRegistry
NewRegistry returns an empty registry.
internal/attachments/registry.go:26
↓ 13 callersFunctionNormalizeItemLinkType
NormalizeItemLinkType canonicalizes supported link types and returns an error for unknown values.
internal/models/item_links.go:33
↓ 13 callersFunctionSetWorkspaceTool
SetWorkspaceTool returns the (Tool, Handler) pair for the built-in pad_set_workspace tool. The handler updates state in place. Exposed as a construct
internal/mcp/workspace.go:121
↓ 13 callersMethodStart
Start begins probing in the background. It runs one probe SYNCHRONOUSLY before returning, so a server that has finished starting has a real answer rat
internal/server/redis_health.go:142
↓ 13 callersMethodUpdateItemWithParentLink
UpdateItemWithParentLink is UpdateItemWithPreCheck plus an OPTIONAL parent-link mutation applied inside the same transaction (BUG-2013). When parentLi
internal/store/items.go:2068
↓ 13 callersMethodValidateSession
ValidateSession hashes the provided token, looks it up, checks expiry, and returns the session info including the associated user and binding metadata
internal/store/sessions.go:62
↓ 13 callersFunctionWithTokenScopes
WithTokenScopes returns ctx decorated with the API token's JSON-encoded scopes string (e.g. `["read"]`, `["*"]`). Stashed by the MCP Bearer middleware
internal/server/context.go:89
↓ 13 callersMethodacquireWorkspaceSeqLock
acquireWorkspaceSeqLock takes a Postgres advisory transaction lock keyed on the workspace ID so concurrent seq-bumping mutations serialize. The lock a
internal/store/items.go:121
↓ 13 callersFunctionbootstrapAccountDeleteUser
bootstrapAccountDeleteUser creates the first admin user, sets a Stripe customer ID on them, and returns (userID, sessionToken). Used by the handleDele
internal/server/handlers_account_test.go:70
↓ 13 callersFunctiondeleteAccountReq
deleteAccountReq issues the delete-account request from a client IP that differs from the loopback address bootstrap ran on. The session-IP-change mid
internal/server/handlers_account_test.go:93
↓ 13 callersFunctiondownloadAs
downloadAs issues GET or HEAD on the blob endpoint as a specific user + workspace role, bypassing the auth middleware the same way deleteAsUser does.
internal/server/handlers_attachments_download_authz_test.go:158
↓ 13 callersMethodflush
Run a flush immediately for the given `markdown` + `ctx`, applying the * full recovery/dedupe gauntlet before the injected PATCH. Used by the *
web/src/lib/collab/collabFlush.svelte.ts:114
↓ 13 callersFunctiongetSessions
(t *testing.T, baseURL, token string)
internal/server/handlers_sessions_test.go:26
↓ 13 callersMethodgoAsync
goAsync spawns fn in a goroutine that's tracked by s.bg, so Stop() can wait for in-flight background work to finish. Use this for any fire-and-forget
internal/server/server.go:377
↓ 13 callersFunctionisolateHome
isolateHome redirects HOME to a temp dir and chdirs to a fresh temp project dir so credential writes and .pad.toml detection don't leak into the real
cmd/pad/setup_headless_test.go:89
↓ 13 callersFunctionliveGen
--- reconciliation on the receive path --------------------------------- liveGen subscribes the workspace and returns the generation a real receive lo
internal/events/redis_idspace_test.go:263
↓ 13 callersFunctionmustSeedWorkspaceWithRole
mustSeedWorkspaceWithRole is a test helper that creates a workspace + adds the user as a member with the given role. Centralized here because TASK-952
internal/server/handlers_oauth_test.go:1915
↓ 13 callersFunctionnewTestClient
Tests for the OAuth 2.1 storage layer (PLAN-943 TASK-951 sub-PR A). The store layer is fosite-agnostic by design — sub-PR B introduces the fosite impo
internal/store/oauth_test.go:22
↓ 13 callersFunctionpassThrough
passThrough returns an ActionFn that forwards the input verbatim to the given cmdPath via env.Dispatch. The vast majority of catalog actions use this
internal/mcp/catalog.go:178
← previousnext →301–400 of 9,998, ranked by callers