Skip to content

fix(v0.44): make claim-vs-fresh activation mode a Kernel-owned truth (#1213) - #1254

Merged
SisyphusZheng merged 2 commits into
devfrom
v044/a10.5-activation-truth
Sep 2, 2026
Merged

fix(v0.44): make claim-vs-fresh activation mode a Kernel-owned truth (#1213)#1254
SisyphusZheng merged 2 commits into
devfrom
v044/a10.5-activation-truth

Conversation

@SisyphusZheng

Copy link
Copy Markdown
Member

Problem

Issue #1213 (umbrella #1155, Alpha.10, audit H3 + M1). The facade guessed willClaim before the kernel resolved its root: for closed ShadowRoots the guess always read an empty root, so a closed-root DSD claim was misreported as onCsrRendered() and pre-upgrade replay was skipped. Separately, the pre-upgrade capture (8 capture-phase document listeners + a strong Map retaining event targets incl. detached DOM) was never torn down — the only stop() lived behind the deleted engine-B's unreachable option.

Owner

The Kernel (the executor that performs claim/fresh) owns which mode happened: connect() returns { mode: 'claim' | 'fresh', root }. The facade derives lifecycle hooks from that result — the pre-connect guess (#rootContent) is deleted. This PR REMOVES a second mode-decision authority.

Before

Facade guesses mode pre-connect; closed-root DSD claim mislabeled; capture leaks for page lifetime.

After

Mode computed once from the resolved root's real content by the executor; hooks/replay tied to actual claim success; capture released in finally on every activation decision. Closed-root DSD claim now works for real via ElementInternals.shadowRoot discovery (browsers wipe declarative content on attachShadow, so that could never serve the claim).

Evidence

  • RED at base SHA: new facade-activation tests — closed-shadow DSD claim fired no onDsdHydrated (H3); capture-teardown tests failed (M1); kernel returned void.
  • GREEN: 9 new facade-activation + 2 kernel activation-truth tests (light/open/closed × DSD/CSR, reconnect without relabeling, replay exactly-once-then-released, failed claim fires neither hook yet still tears down); element suite 231 passed; full deno task test exit 0; all static gates green; interface snapshot unchanged (internal plumbing only).
  • Fresh kimi-code/k3-256k HIGH implementer session; orchestrator re-ran the new tests and verified the diff (including the single listed tooling edit: stale arch-gate allowlist entry removal).

Scope / non-goals

No new lifecycle callbacks; no public API expansion; no second claim path.

Risk

Per the issue's mandated contract, the first activation decision tears down the shared document-level capture — islands upgrading much later (idle/visible) get no pre-upgrade replay (flagged by the implementer; accepted: no listener may survive the decision). Non-form closed-root CSR elements gain a benign ElementInternals attachment during discovery. Rollback: revert.

…1213)

Alpha.10 truth closure (H3 + M1): the facade guessed willClaim before
the kernel resolved its root — closed-shadow DSD claims were
misreported as CSR and pre-upgrade replay was skipped — and the
pre-upgrade capture (8 document listeners + a strong Map retaining
event targets) was never torn down.

- kernel.connect() now returns the activation truth
  ({ mode: 'claim' | 'fresh', root }); the executor that performs
  claim/fresh owns which mode happened; a thrown connect produces no
  mode, so failure can never mislabel
- closed-root DSD discovery works for real: the kernel reaches a
  declaratively attached closed root through ElementInternals.shadowRoot
  (attachShadow would wipe declarative content); form-associated hosts
  reuse the form controller's internals
- facade derives onDsdHydrated/onCsrRendered and pre-upgrade replay from
  the kernel result; capture is released (listeners stopped, records
  cleared) with every activation decision, success or failure
- removes the stale type-escape allowlist entry for the deleted
  pre-connect probe (tools/check-architecture-contract.ts)

Implemented by fresh kimi-code/k3-256k HIGH session
(.agents/v044-kimi-implementer.md), packet A10.5. Public interface
snapshot unchanged. No publish, no tag.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 2, 2026

Copy link
Copy Markdown

Deploying openelement with  Cloudflare Pages  Cloudflare Pages

Latest commit: 92be264
Status: ✅  Deploy successful!
Preview URL: https://f496c441.lessjs.pages.dev
Branch Preview URL: https://v044-a10-5-activation-truth.lessjs.pages.dev

View logs

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

APIError: Insufficient Balance

opencode session  |  github run

Repair per CI e2e evidence (light-mode-activation.spec.ts:48 failing on
chromium/firefox/webkit): the first activation's blanket teardown of the
shared document-level capture broke the standing delayed-upgrade replay
contract (#1170).

- per-element record release at each activation decision (success or
  failure) via releasePreUpgradeEvents(kernel.root, ...) — retained
  event-target records (the actual M1 leak) die with the decision
- the fixed page-level capture listener set stays installed for
  pending elements; outside-root records are neither released nor
  consumed by another element's replay
- exactly-once replay preserved (consumed WeakSets + record release)
- new unit proof: a late upgrader still replays its pre-upgrade click
  after another activation; failed claim releases only its own records
- e2e contract spec verified green locally on chromium against a fresh
  www build

Repair by the same kimi-code/k3-256k HIGH session (packet A10.5-repair)
on top of the orchestrator-reviewed base.
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

APIError: Insufficient Balance

opencode session  |  github run

@SisyphusZheng
SisyphusZheng merged commit ec0ef89 into dev Sep 2, 2026
9 checks passed
@SisyphusZheng
SisyphusZheng deleted the v044/a10.5-activation-truth branch September 3, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant