Skip to content

Public impl:created/impl:changed event dropped its stable callable field — value relocated into internal wrapper.__impl (3.16→3.17 payload regression) #433

Closed

Description

@Shinrai

Summary

Between 3.16.2 and 3.17.0 the public impl:created / impl:changed event payload changed where the leaf's callable lives. On 3.16.2 a public subscriber read it from a stable impl field; on 3.17.0 that field is gone from the public event, and the callable is only reachable via wrapper.__impl — the framework's own internal wrapper handle.

Removing the raw, unwrapped impl from the public tier is correct and intended (#398 — the public tier should "carry the wrapped callable + metadata, never the raw unwrapped impl"). The problem is the path changed: instead of keeping a stable public field and putting the wrapped callable there, the value was relocated into the internal wrapper.__impl shape, so external consumers both break and are forced to couple to a reserved internal handle.

Evidence (minimal repro)

Compose any api, subscribe to the public event, and inspect the payload:

import slothlet from "@cldmv/slothlet";
const api = await slothlet({ base: BASE, mode: "eager", permissions: { defaultPolicy: "allow" } });
api.slothlet.lifecycle.on("impl:created", (e) => console.log(Object.keys(e), typeof e.impl, typeof e.wrapper?.__impl));
await api.slothlet.api.add([], EXT_DIR, { moduleID: "withsib" });
  • 3.16.2 — event carries impl: { apiPath, impl }, typeof e.impl === "function" for a leaf callable.
  • 3.17.0 — no impl field: { apiPath, wrapper: { __impl }, source, moduleID, filePath, sourceFolder }, typeof e.impl === "undefined", callable only at e.wrapper.__impl.

(Fixture is a self-named file withsib/withsib.mjs exporting activate/deactivate plus a sibling folder withsib/sub/thing.mjs, but the payload change is general — it affects every impl:created event.)

Why it's a problem

  • __impl is explicitly a reserved, internal handle — slothlet's own error strings call it "the framework's own wrapper handle" — and its internal consumers reach it via subscribeInternal (the internal tier, impl:created leaks the raw unwrapped callable and fires for merge-discarded leaves #398). The public .on/.subscribe event is now effectively handing external subscribers the internal emit shape rather than a sanitized public field.
  • Public consumers that read e.impl (the documented pre-3.17 public field) silently get undefined; the only workaround is to reach into e.wrapper.__impl, coupling application code to a reserved internal name.

Suggested fix

Keep a stable public field on the public impl:created / impl:changed event carrying the wrapped callable — e.g. restore impl holding the wrapped callable, or expose a clean documented accessor (callable/fn) — so the #398 intent (no raw impl) is met without relocating the value into wrapper.__impl.

Impact

@cldmv/rummage — the ext-host tree (src/ext-host/api-tree.mjs) and view composer (src/lib/compose-extension-views.mjs) capture each package's activate/deactivate from this event's callable field; both break on 3.17.0. (rummage's longer-term direction is to move that capture onto #400 per-entity routines / .for(key), but that's separate from this payload-contract regression.)

Activity

  1. added
    semver: patch
    type: bug
    priority: high
    status: confirmed
    area: core
    area: tests
    on Sep 20, 2026
  2. added
    status: implemented
    and removed
    status: confirmed
    on Sep 21, 2026
  3. Shinrai commented on Sep 21, 2026

    @Shinrai
    ContributorAuthor

    Implemented on next via PR #434 (commit 33747cfa), riding into 3.18.0.

    The public impl:created / impl:changed events now carry the wrapped callable on a stable public impl field — read data.impl (the pre-3.17 field, restored; never the raw impl, never __wrapperRef). Rather than keep re-exposing the reserved internal wrapper.__impl handle, wrapper is dropped from the public event entirely (it was redundant with impl). The internal event still carries wrapper for the framework's own ownership / metadata / routine subscribers (reached via subscribeInternal), so onImplCreated and friends are unchanged. impl is null before a lazy wrapper materializes.

    Removing the public wrapper also eliminates the metadata-security "wrapper leakage" attack surface at the source — the reworked payload tests now assert the public event exposes only the documented safe fields.

    For @cldmv/rummage: once 3.18.0 is on npm, bumping to ^3.18 restores e.impl with no rummage code change. Verified across the eager/lazy matrix. Release notes: docs PR docs/v3.18.0-notes-433. Left open per the v4 flow — the next → master release closes it.

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

    area: corearea: testspriority: highsemver: patchstatus: implementedtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions