Skip to content

Deep-record heal 80% threshold blocks ~71 partially-degraded DeepPartial token ghosts — lowering it regresses #177 overload suppression #208

Description

@jagguji

Summary

The #205 fix recovers 350 → 111 of blend 0.0.38-beta.1's record→string token-config
ghosts. The residual ~71 (beta.0's floor is ~40) are partially-degraded records — a mix
of good fields and a few DeepPartial-deepened opaque token-config fields — and they are held back
by the deep-record heal's 80%-degraded threshold (healGhostRecords, src/extract.mjs):

if (!bad || bad < e.fields.length * 0.8) continue   // only heal a MOSTLY-fallback record

Instrumented distribution on blend 0.0.38-beta.1 (recordEntries=3194):

belowThresh(<80%)=406   ← the partial records holding the residual ghosts
attempted: healed=72, noImprove=182 (genuinely unmappable, correctly rejected), unbounded=0

Lowering the threshold to heal any record with ≥1 fallback field recovers all of them
(record ghosts 111 → 0, total loose 843 → 168), the bounded gate still rejects nothing wrongly,
and everything compiles.

Why it's not a one-liner — the threshold is load-bearing

Removing (or lowering) the threshold regresses the #177 overload-ambiguity suppression. Golden
generic-instantiation-distinct asserts that OrderDep.ambiguous (an overloaded slot) keeps a
flagged string for its _format field — suppressed via ctx.noPolyTag — while
unambiguous() gets the exact [#"ordCt"]. Its own comment states the contract:
ambiguous -> flagged, unambiguous -> [#"ordCt"]. With the threshold lowered, the heal re-resolves
the suppressed record at depth 0 without the per-slot suppression context, fakes an exact
[#"ordCt"] polytag in the ambiguous position, and merges the two records — a "flag-don't-fake"
violation.

A targeted attempt to skip records with a suppressed field (f.type.relinkNp) did not restore
the suppression — the suppression marker isn't carried where the heal can see it at the top-level
field, so the interaction needs to be untangled properly.

Fix direction

Recover the partially-degraded token ghosts without re-resolving deliberately-suppressed
(noPolyTag) fields. Options to evaluate:

  1. Preserve suppressed fields across a heal — heal a record below the 80% threshold, but when
    accepting the rebuild, keep any field that was noPolyTag-suppressed in the original at its
    original (flagged) type instead of the rebuilt polytag. Requires the heal's captured _heal.ctx
    (or the field IR) to reliably carry the suppression so the rebuild re-suppresses or is
    field-wise overridden.
  2. Field-level heal — instead of an all-or-nothing record rebuild gated on a global degradation
    ratio, re-resolve only the individual opaque (depth-truncated, non-suppressed) fields, leaving
    suppressed/other fields untouched. Sidesteps the threshold entirely.

Either way, add a golden case that pins BOTH: a partially-degraded DeepPartial token record whose
opaque field recovers, AND an ambiguous-overload record whose suppressed field stays flagged, so the
two mechanisms can't regress each other.

Impact

Cosmetic/fidelity only — the residual are flagged ⚪ loose string (usable, honest), not broken.
Closing this takes blend 0.0.38-beta.1 from 111 to ~40 residual (the genuinely-unmappable floor).
Follow-up to the #205/#206 fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions