Canonicalize closed prompt schema data #159

Closed
lost-rob0t wants to merge 7 commits from fix/158-prompt-compiler-closed-dicts into fix/156-registry-destroy-hooks
lost-rob0t commented 2026-08-21 22:47:04 +00:00 (Migrated from github.com)

Closes #158 after #152/#155/#157 land.

Stacked on fix/156-registry-destroy-hooks so this patch is evaluated with the real aggregate PlUnit runner and the preceding anonymous-dict/runtime cleanup repairs.

Failure

The restored deterministic suite shows most prompt-compiler tests fail before their intended assertions. Ordinary closed tool schemas use SWI anonymous dicts (_{...}); raw ground/1 treats their representation-only tag variable as nonground, so catalog registration rejects valid declarative schema data.

Fix

  • add a small reusable rlm_closed_data canonicalizer for declarative closed data;
  • normalize anonymous dict tags to the stable rlm_anonymous_dict sentinel;
  • preserve named dict tags;
  • recursively reject genuine variable values and cyclic structures;
  • canonicalize prompt tool arguments, result, and limits before storage/fingerprinting;
  • keep capability/effect fields on their existing closed-value checks;
  • add regressions proving anonymous-dict normalization is deterministic while true variables/cycles fail closed.

No capability widening, no executable callback acceptance, and no test weakening.

Keep draft until exact-head CI shows the prompt compiler tests reach their intended behavior under the restored full suite. Remaining red clusters are separate and stay red.

Closes #158 after #152/#155/#157 land. Stacked on `fix/156-registry-destroy-hooks` so this patch is evaluated with the real aggregate PlUnit runner and the preceding anonymous-dict/runtime cleanup repairs. ## Failure The restored deterministic suite shows most prompt-compiler tests fail before their intended assertions. Ordinary closed tool schemas use SWI anonymous dicts (`_{...}`); raw `ground/1` treats their representation-only tag variable as nonground, so catalog registration rejects valid declarative schema data. ## Fix - add a small reusable `rlm_closed_data` canonicalizer for declarative closed data; - normalize anonymous dict tags to the stable `rlm_anonymous_dict` sentinel; - preserve named dict tags; - recursively reject genuine variable values and cyclic structures; - canonicalize prompt tool `arguments`, `result`, and `limits` before storage/fingerprinting; - keep capability/effect fields on their existing closed-value checks; - add regressions proving anonymous-dict normalization is deterministic while true variables/cycles fail closed. No capability widening, no executable callback acceptance, and no test weakening. Keep draft until exact-head CI shows the prompt compiler tests reach their intended behavior under the restored full suite. Remaining red clusters are separate and stay red.
lost-rob0t commented 2026-08-24 08:08:00 +00:00 (Migrated from github.com)

Superseded by the shared closed-data and prompt-compiler integration now on main via #177. Exact current main 7c3561bcc3 passed 26/26 focused closed-data/compiler tests, covering ordinary anonymous-dict schemas, activation/dependencies/conflicts, capability separation, token ledgering, mandatory overflow, deterministic fingerprints, genuine-variable/cycle rejection, and later active-schema projection. The stale branch should not overwrite newer compiler behavior.

Superseded by the shared closed-data and prompt-compiler integration now on main via #177. Exact current main 7c3561bcc34de55fba875dfd18b773211a3d3420 passed 26/26 focused closed-data/compiler tests, covering ordinary anonymous-dict schemas, activation/dependencies/conflicts, capability separation, token ledgering, mandatory overflow, deterministic fingerprints, genuine-variable/cycle rejection, and later active-schema projection. The stale branch should not overwrite newer compiler behavior.
nsaspy changed title from WIP: Canonicalize closed prompt schema data to Canonicalize closed prompt schema data 2026-08-27 20:02:12 +00:00
Some checks failed
CI / Deterministic unit and load checks (push) Has been cancelled
CI / REAL OpenRouter integration (push) Has been cancelled
Nix flake / Flake package and clean runtime load (push) Has been cancelled
Clean SWI pack install / Install and load copied pack (push) Has been cancelled
Runner integrity / runner-integrity (push) Has been cancelled
Tree-sitter FFI / Direct SWI-Prolog Tree-sitter FFI (push) Has been cancelled

Pull request closed

Sign in to join this conversation.
No description provided.