Skip to content

fix(devtools,world-model): resolve atomic fingerprint to artifact version in store and inspector - #10

Open
Adityakk9031 wants to merge 1 commit into
openprose:mainfrom
Adityakk9031:fix/devtools-world-model-atomic-version-lookup
Open

fix(devtools,world-model): resolve atomic fingerprint to artifact version in store and inspector#10
Adityakk9031 wants to merge 1 commit into
openprose:mainfrom
Adityakk9031:fix/devtools-world-model-atomic-version-lookup

Conversation

@Adityakk9031

Copy link
Copy Markdown

Summary

Fixes a critical disconnect in the DevTools S4 inspector where clicking through DAG / timeline frames fails with 404 Not Found whenever a node's @atomic fingerprint differs from the store's serialized artifact version.

Root Cause

  1. In the DevTools frontend and replay session, each timeline frame records atomicVersion: receipt.fingerprints["@atomic"].
  2. When an operator clicks a node in the inspector (S4 click-through), DevTools issues a GET request to /api/node/:id?version=<atomicVersion>.
  3. In FileSystemWorldModelStore and InMemoryWorldModelStore, commits were persisted and keyed strictly by raw artifact content address version = contentAddressOf(serializeArtifact(files)) (stored under versions/<contentAddress>.bin).
  4. Whenever a node defines a canonicalizer where the @atomic fingerprint differs from the whole-artifact byte hash (such as subset facet indexing, projection normalization, or custom canonicalizers), store.readVersion(node, atomicVersion) returned null.
  5. DevTools server caught this and returned 404 Not Found ({"error": "no world-model for node@version"}), completely breaking the S4 click-through inspector for those nodes.

Changes

  1. packages/reactor/src/world-model/fs-store.ts:
    • In commitPublished: When fingerprints[ATOMIC_FACET] differs from version, an alias pointer file is written atomically at versions/<atomicFp>.alias containing the canonical artifact version address.
    • In readVersion: If versions/<version>.bin is not found, check versions/<version>.alias and dereference to the artifact version. Also checks published.json pointer if it matches the current published atomic facet.
  2. packages/reactor/src/world-model/store.ts:
    • Documented that readVersion accepts either artifact content address or atomic facet fingerprint.
    • Added #aliases map to InMemoryWorldModelStore and fallback alias resolution to match filesystem store semantics.
  3. packages/reactor-devtools/src/data/index.ts:
    • readNodeWorldModel: Added defensive fallback against published pointer.
    • openWorldModels: Added support for both world-models/ and world-model/ directories.
  4. packages/reactor-devtools/src/server/index.ts:
    • Updated parameter documentation and 400 error messaging for ?version=.
  5. Tests:
    • Added packages/reactor/src/world-model/__tests__/fs-store-alias.test.ts testing alias resolution across both FileSystemWorldModelStore and InMemoryWorldModelStore.
    • Added integration test in packages/reactor-devtools/src/server/server.test.ts ensuring GET /api/node/:id?version=<atomicVersion> returns 200 and loads the node's world-model when the atomic fingerprint differs from the artifact version.

Verification

  • node --test packages/reactor/dist/world-model/__tests__/fs-store-alias.test.js (2/2 passing)
  • node --test packages/reactor-devtools/dist/server/server.test.js (8/8 passing)
  • node --test packages/reactor-devtools/dist/data/*.test.js (33/33 passing)
  • node --test tools/eval-harness/eval-harness.test.mjs (10/10 passing)
  • Synthetic reproduction scenario verifying transition from 404 to 200 with artifact files loaded.

@Adityakk9031

Copy link
Copy Markdown
Author

@josemontesdeoca have a look

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