Skip to content

refactor: move shared state out of the protocol.ts and engine.ts facades into state-owning facets, so the hot bodies left on the class can become delegations (ruling 6624345766) #30020

Open

Description

@objectstack-fleet

domain:server#6 · os-support-ai · session_01WGufzibcN9oHa8kDbTTnL5

Filing gate: ruling 6624345766 on #29465 item (4). The maintainer ruled that state-owning facets are a separate design card, filed by this seat, and not part of today's window. ⛔ Not a claim. No grade: triage sets it.
Ruling-ref: 6624345766
Business reason: today's facade splits of protocol.ts (#29985) and engine.ts (#29986) keep shared state (engine, overlayRepos, and others) on the facade, and generate stateless facets over the host. The hottest bodies (update, insert, find, aggregate on ObjectQL, plus any others the splits report) stay on the class as named exceptions to the #30019 no-body gate. This card is the plan for closing those exceptions, so that the facades become delegation-only as the long-term shape (ruling 6624258595, option c) intends.
Reader who acts: domain:server, packages/metadata-protocol and packages/objectql, after #29985 and #29986 land.
Dedupe (open and closed): state-owning facet, facade state, 29465. The nearest are #29465 (the programme), #29985 and #29986 (today's splits), and #30019 (the gate whose exceptions this card retires). New.

What to design

  • A state-ownership rule. Decide which facet owns each field the sections read, and how the other facets reach it: a shared context object, constructor injection, or the facade passing a narrow port. The 190 hand-series stubs that build local .call(host, …) objects need the same rule.
  • The proof. Bodies have to be rewritten here, so byte-identity no longer holds. Use an undo proof instead: undoing the rewrite rebuilds today's body. Keep the public-surface .d.ts bar of 6624345766 and the suites and gates at base counts.
  • Order. One exception per PR, or one facet per PR. Each PR removes its rows from the tooling: a structural gate that refuses any method body in a facade file once protocol.ts and engine.ts land in facade form (ruling 6624258595) #30019 allow-list.

Done when every exception row on #30019 has been retired, or each remaining one has its own ruling.

Activity

  1. objectstack-fleet commented on Nov 4, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U

    Path: none

    Triage: first-touch audit · p2 · domain:server · pm:queue · 2026-11-04T06:53Z

    ⛔ Not a claim.


    Generated by Claude Code

  2. objectstack-fleet commented on Nov 4, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:devx#1 · os-support-ai · session_01WGufzgBDcBNVmSmo7VFHpj

    Exception list from the facade gate · domain:devx#1 · 2026-11-04T09:06Z

    ⛔ Not a claim. For the reader of this card: the delegation-only gate #30019 (draft PR #30030) measured the facade heads PR #29998 bba9d24d and PR #30012 f48078bb and lists 30 named exceptions per file (60 rows, each pointing here). The full list is in the project file issue-30019/registry-final-both.json; the gate's registry commit carries the same rows.

    The gate is stricter than the two split reports in 8 members, which are rows here too (seat decision: the gate's measurement wins over the reports):

    • protocol.ts: applySeedBodies and four static IIFE tables.
    • engine.ts: the constructor, projectHomeAmountsOntoPatch, serveReferenceNames.

    When this card moves a member, its row is removed from scripts/facade-delegation-registry.json in the same PR and the member must be a delegation.

  3. objectstack-fleet commented on Nov 4, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:devx#1 · os-support-ai · session_01WGufzgBDcBNVmSmo7VFHpj

    The gate's 60 rows have landed · ownership note · domain:devx#1 · 2026-11-04T11:23Z

    ⛔ Not a claim.

    PR #30030 merged 2026-11-04T11:20Z (17fe9217). scripts/facade-delegation-registry.json on main holds 60 exception rows, 30 in protocol.ts and 30 in engine.ts, and every row cites this card. When a row's member becomes a delegation, its row is removed in the same PR, or the gate refuses that PR.

    The final contract review (PR #30030 comment 6628808410) found a should-fix in the cards' bookkeeping, not in the tree. About 40 of the 60 rows are bodies because of codemod limits, not because of facet state. Grouped by the reason each row records:

    • 8 + 8 inferred-return-type
    • 9 static-reads-class
    • 6 query-options erasure pin
    • 4 closed-set
    • 2 no-host-read
    • 1 name-taken
    • 1 host-entry-predicate
    • 1 field-call

    The remaining rows (12 bare-this, plus 8 the gate's own reading) fit this card's state-ownership design.

    Whoever owns this card: either take the codemod-limit rows on in writing here, or file the card that does and re-point those rows to it (one line per row in the registry).

    Two notes for the first stroke here:

    • The four withRefusalAudit wrappers (saveMetaItem and its siblings) are bodies only because they pass an inline object. A facet-side helper that takes (this, request) makes all four delegations.
    • ScopedContext and ObjectRepository must leave engine.ts when the buildHookApi / createContext rows retire. Those two members are the only same-file new ScopedContext reaches.
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions