Skip to content

Public entrypoint re-exports document internals, letting consumers bypass the op layer #18

Closed

Description

@christian-byrne

Reviewed at 26995a3.

src/index.ts:26 re-exports src/doc.ts wholesale, exposing mset/mdel/apush, the root maps, the bookkeeping map, and the module-global mutation counter. The README states ops are the only way to change a document, but any consumer can import these and mutate nodes/stamps/applied-ids directly, bypassing the stamp/idempotency invariants and coupling consumers to the physical Yjs layout.

Direction: export only the public surface (mint/applyOps/project/migrate/types); keep the low-level map helpers module-private or behind an explicitly-internal entrypoint.

Activity

  1. coderabbitai commented on Aug 20, 2026

    @coderabbitai
    🔗 Related PRs

    Comfy-Org/ComfyUI_frontend#15092 - fix(layout): keep a node layout ref alive until its last holder releases [merged]
    Comfy-Org/ComfyUI_frontend#15406 - [DO NOT MERGE] preview: Team Plan V1 workspace settings prototype (billing mock harness) [open]
    Comfy-Org/workflow_templates#1157 - fix(i18n): remove the duplicated flip guard that breaks the build [merged]


    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. christian-byrne commented on Aug 21, 2026

    @christian-byrne
    ContributorAuthor

    Severity context from a consumer sweep (ComfyUI_frontend, cloud, comfy-cloud-mcp-server, ComfyUI checkouts): no external consumer currently imports the raw maps (nodesMap, linksMap, mset, apush, …) from the package root — the exposure is real but unexercised today. Good time to fix before doc-host/frontend adoption hardens the surface (cloud PR #7130 moves doc-host to the npm package).

  3. christian-byrne commented on Aug 21, 2026

    @christian-byrne
    ContributorAuthor

    Concrete evidence the wildcard export is actively widening the surface: because src/index.ts:31-33 re-exports types.ts/stamps.ts/doc.ts wholesale, two recent commits grew the public API without touching the export statements — 6793d754 (added OPAQUE_WIDGETS_KEY, isOpaqueWidgets) and 98c3c8f (added WIDGET_STORAGE_STRATEGIES, WidgetStorage, widgetStorageFor, widgetStorageOf + op-kind aliases). Every new module-level export silently becomes API. Curated named exports would make widening a deliberate diff. (14-day invariant sweep, 2026-08-21 @ 2792319 — otherwise clean: no test weakening, no writeTarget collapse widening, KA-4/KA-12 coverage grew.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions