Files
ocas/.changeset/93-gc-collectrefs-oneof.md
T
xiaoju 4659258693
CI / check (pull_request) Successful in 3m46s
fix: gc must traverse oneOf and preserve template content
collectRefs silently skipped oneOf even though it is in the meta-schema's
allowed keys. uwf step nodes use the standard JSON-Schema idiom
oneOf: [{type:"null"}, {type:"string", format:"ocas_ref"}] for nullable
prev/detail/start refs, so walk() never reached the chain and gc swept
the intermediate steps as false orphans. Mirror the anyOf branch in
collectRefs so every oneOf variant contributes refs.

Also align gc with closure.ts Phase 3: walk @ocas/template/text/<schema>
content for every reachable schema so rendered template nodes survive
when their schema is reachable, and are still collected when the schema
itself is unreachable.

Fixes #93
2026-06-07 13:06:59 +00:00

708 B

@ocas/core
@ocas/core
patch

Fix gc false-orphan deletion of oneOf-linked CAS chains and template content nodes.

collectRefs now traverses oneOf sub-schemas (previously skipped even though the meta-schema accepted the keyword), so walk/refs correctly follow ocas_ref fields nested inside oneOf combinators (e.g. nullable prev / detail / workflow refs in uwf step chains).

gc no longer treats @ocas/template/text/* variables as roots; instead it walks template content only when its referenced schema is itself reachable from non-template roots, mirroring computeClosure Phase 3. This prevents orphan template nodes from surviving GC when their schema is unreachable.

Fixes #93