Canonicalize evolution candidates and constraints #166

Closed
lost-rob0t wants to merge 2 commits from fix/165-evolution-closed-data into fix/158-prompt-compiler-closed-dicts
lost-rob0t commented 2026-08-21 23:09:40 +00:00 (Migrated from github.com)

Closes #165 after #159 lands.

Merged #148's own fixtures use anonymous SWI dicts for candidate genes and constraint schemas, while the kernel required raw ground/1 on the enclosing data. The real aggregate suite therefore rejects valid candidates before gene validation.

TDD

The first branch commit strengthens the existing evolution suite before production changes:

  • valid anonymous genes must return a ground canonical candidate;
  • genuine variable values and cyclic candidate data must fail closed;
  • mutation/crossover must return ground canonical genes;
  • semantically identical anonymous-dict inputs with different key order must produce identical child IDs/lineage fingerprints;
  • unknown operators remain inert errors.

Fix

  • reuse #159's rlm_closed_data boundary for candidate and constraint normalization;
  • preserve semantic candidate / constraints tags while canonicalizing nested anonymous dict tags;
  • perform validation, mutation, and crossover against canonical values;
  • start crossover accumulation with an explicitly canonical rlm_anonymous_dict{};
  • canonicalize fingerprint material before SHA-256 serialization;
  • keep Pareto selection and the closed operator vocabulary unchanged.

No scheduler, provider, authority, effect, arbitrary call/1, or product-specific genotype semantics are added.

Keep draft until exact-head CI proves the evolution regressions under the restored aggregate runner.

Closes #165 after #159 lands. Merged #148's own fixtures use anonymous SWI dicts for candidate genes and constraint schemas, while the kernel required raw `ground/1` on the enclosing data. The real aggregate suite therefore rejects valid candidates before gene validation. ## TDD The first branch commit strengthens the existing evolution suite before production changes: - valid anonymous genes must return a ground canonical candidate; - genuine variable values and cyclic candidate data must fail closed; - mutation/crossover must return ground canonical genes; - semantically identical anonymous-dict inputs with different key order must produce identical child IDs/lineage fingerprints; - unknown operators remain inert errors. ## Fix - reuse #159's `rlm_closed_data` boundary for candidate and constraint normalization; - preserve semantic `candidate` / `constraints` tags while canonicalizing nested anonymous dict tags; - perform validation, mutation, and crossover against canonical values; - start crossover accumulation with an explicitly canonical `rlm_anonymous_dict{}`; - canonicalize fingerprint material before SHA-256 serialization; - keep Pareto selection and the closed operator vocabulary unchanged. No scheduler, provider, authority, effect, arbitrary `call/1`, or product-specific genotype semantics are added. Keep draft until exact-head CI proves the evolution regressions under the restored aggregate runner.
lost-rob0t commented 2026-08-24 08:55:12 +00:00 (Migrated from github.com)

Verified against exact current main ab426de54a54101ca3a6d8197db77e4c1f9d009f. The production prolog/rlm_evolution.pl is already identical to this PR head; current main only has a stronger assertion form in the focused test. Focused evolution gate: 11/11 passed, covering anonymous-dict canonicalization, unknown/disallowed rejection, true variable/cycle rejection, ground closed mutation/crossover, stable lineage fingerprints, and Pareto behavior. test/load_all.pl and git diff --check passed. Fresh aggregate on the same SHA: 74 suites, 767/767, 0 failed/timeout/blocked/fixme. Closing as superseded; merging the stale branch would remove newer mainline work.

Verified against exact current main `ab426de54a54101ca3a6d8197db77e4c1f9d009f`. The production `prolog/rlm_evolution.pl` is already identical to this PR head; current main only has a stronger assertion form in the focused test. Focused evolution gate: 11/11 passed, covering anonymous-dict canonicalization, unknown/disallowed rejection, true variable/cycle rejection, ground closed mutation/crossover, stable lineage fingerprints, and Pareto behavior. `test/load_all.pl` and `git diff --check` passed. Fresh aggregate on the same SHA: 74 suites, 767/767, 0 failed/timeout/blocked/fixme. Closing as superseded; merging the stale branch would remove newer mainline work.
nsaspy changed title from WIP: Canonicalize evolution candidates and constraints to Canonicalize evolution candidates and constraints 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.