Skip to content

test(runtimelib): pin the module identity of persisted built-in archetypes - #8968

Closed
SupulHeshan wants to merge 1 commit into
jaseci-labs:mainfrom
SupulHeshan:test/8747-builtin-identity-manifest
Closed

test(runtimelib): pin the module identity of persisted built-in archetypes#8968
SupulHeshan wants to merge 1 commit into
jaseci-labs:mainfrom
SupulHeshan:test/8747-builtin-identity-manifest

Conversation

@SupulHeshan

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #8956 (fixes #8747). That PR aliased Root/GenericEdge to their pre-#8682 module path, but nothing stops the next package move from repeating the same silent failure: forgetting to add an alias produces no warning at review time, only a data-loss report from a user later. #8681 has more of these moves queued.

This adds a small guardrail instead of relying on someone remembering:

  • _PERSISTED_BUILTIN_IDENTITIES pins the current fully-qualified name of every jaclang built-in that is actually persisted with a concrete __type__ (today: Root, GenericEdge). Base archetypes (NodeArchetype, EdgeArchetype, WalkerArchetype, ObjectArchetype) are deliberately excluded — they're never instantiated as themselves, so no stored row ever carries their name.
  • A test asserts each entry still resolves to that exact module/class. Moving one of these classes without touching this file fails the build; the assertion message points directly at data/serializer.jac's _BUILTIN_MOVED_FROM (the mechanism register_alias/schema_was built for exactly this) instead of leaving the next contributor to rediscover Renaming jac0core.archetype to runtime.archetype drops Root from existing databases: no serializer alias registered #8747 from scratch.

Verified the guardrail actually fires, not just that it compiles: temporarily pointed the manifest at the wrong module and confirmed the exact intended failure message, then reverted before committing.

This intentionally does not attempt to fix the other gap identified during #8956's review — the destructive self-heal in ExecutionContext._resolve_roots, which can silently overwrite the system root anchor if it fails to materialize for any reason (not just this one). That's a materially different, riskier change to root-bootstrap semantics and belongs in its own issue/PR.

Test plan

  • JAC_TEST_JOBS=1 jac test jac/tests/runtimelib/test_layer3_coercion_alias.jac — 22 passed.
  • Confirmed the new test fails with the intended message when the manifest is deliberately made stale (temporary local edit, reverted before commit).
  • jac precommit passes clean. No release-notes fragment needed (test-only change under jac/tests/).

…types

Root and GenericEdge are jaclang's own concrete archetypes, and their
fully-qualified name is part of the on-disk wire format (see
Serializer._get_class). jaseci-labs#8747 showed what happens when one of them
moves without a corresponding alias: existing databases lose the
anchor silently, and nothing at review time would have caught it.

This pins their current identity in a manifest a future rename has to
touch directly, with a failure message that points straight at
data/serializer.jac's _BUILTIN_MOVED_FROM instead of just tripping an
opaque assertion. Verified the guardrail actually fires: temporarily
pointing the manifest at the wrong module reproduces the exact
message, reverted before committing.
SupulHeshan added a commit to SupulHeshan/jaseci that referenced this pull request Sep 7, 2026
…types

Folded in from the separate jaseci-labs#8968 PR: keep the fix and its regression
guardrail in one place.

The two tests above this one cover Root and GenericEdge's specific
pre-move aliases. This manifest test is the guardrail for the *next*
move: it pins the current module identity of every jaclang built-in
that is actually persisted with a concrete `__type__`, so a future
package reorganization (more are queued per jaseci-labs#8681) can't repeat this
same silent-drop failure by accident. The failure message points
straight at data/serializer.jac's _BUILTIN_MOVED_FROM instead of
leaving the next contributor to rediscover jaseci-labs#8747 from scratch.

Verified the guardrail actually fires: temporarily pointed the
manifest at the wrong module, confirmed the exact intended failure
message, reverted before committing.
@SupulHeshan

Copy link
Copy Markdown
Collaborator Author

Folded into #8956 — this test now lives in that PR alongside the fix itself, so there's one PR to review instead of two for the same issue. Closing this one.

@SupulHeshan SupulHeshan closed this Sep 7, 2026
@SupulHeshan
SupulHeshan deleted the test/8747-builtin-identity-manifest branch September 7, 2026 11:30
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.

Renaming jac0core.archetype to runtime.archetype drops Root from existing databases: no serializer alias registered

1 participant