Repository navigation
Description
ns:name keys collapse back to ns.name in --verdict, bypassing #1216
Current main 675381e75d2d84be685a1f4a0c88fbfdbec9eb12 accepts two distinct source declarations keyed lib:M and lib.M, as intended by f370026f. safe.ts then calls name_tt(B.name_key(k)); name_key maps the colon back to a dot, so their recursive-group labels collide. Imported lib:C and root constructor lib.C collide the same way.
The following two-file reproducer passes both public gates unchanged:
$ bend 00_exact_namespace_collision_control.bend --check-only
ALL PROOFS CHECK
$ bend 00_exact_namespace_collision_control.bend --verdict
ALL PROOFS CHECK
Create both files in one directory.
lib.bend:
import Base
type One is Data:
O{}
type N is Data:
Z{}
S{p: N}
type Fuel is Data:
FZ{}
FS{p: Fuel}
def keep(-proof: N, value: N) -> N:
value
law L:
for -a: One -> One -> N
for -b: One -> One -> N
for x: N
for fuel: Fuel
N
def M(
-a: One -> One -> N,
-b: One -> One -> N,
x: N,
fuel: Fuel,
) -> N:
keep(L(a, b, x, fuel), x)
type Good is Data:
C{u: Unit}main.bend:
import Base
import ./lib.bend as L
type Key is Data:
K{}
def lib.M(
~a: L.One -> L.One -> L.N,
~b: L.One -> L.One -> L.N,
x: L.N,
fuel: L.Fuel,
) -> L.N:
match fuel:
case L.FZ{}:
a(L.O{})(L.O{})
case L.FS{p}:
L.keep(L.L(a, b, x, fuel), lib.M(~b, ~a, x, p))
def start(~key: Key, x: L.N, fuel: L.Fuel) -> L.N:
lib.M(
~(x => {\{L.O: L.Z{}; x} : L.One -> L.N}),
~(((h: L.N) => (x => {\{L.O: L.Z{}; h} : L.One -> L.N}))(x)),
x,
fuel,
)
def closed() -> L.N:
start(~K{}, L.S{L.Z{}}, L.FS{L.FS{L.FZ{}}})
def Field(n: L.N) -> Type:
match n:
case L.Z{}: Empty
case L.S{p}: Unit
type Bad is Type:
lib.C{x: Field(closed())}
def Out(n: L.N) -> Type:
match n:
case L.Z{}: L.Good
case L.S{p}: Bad
def packed() -> Out(closed()):
L.C{Unit{}}
def L.L(a, b, x, fuel):
match fuel:
case L.FZ{}:
L.Z{}
case L.FS{p}:
L.M(b, a, x, p)
def main() -> L.N:
closed()Its source-checked book computes closed = lib.Z, types packed as lib:Good, and normalizes the live field of local Bad to Empty. The unmodified emitted BendTT computes closed = lib.S(lib.Z), types packed as Bad, and normalizes that field to Unit. Direct kernel oracles for the certificate's value and cert_bad : Bad = packed both pass.
The regression begins exactly at f370026f: its parent rejects the local lib.M as a duplicate, while f370026f and current main are PASS/PASS. The one-line escaping change proposed by PR #1216 does not close it. It makes the older encoded-name controls fail verdict, but this exact namespace collision stays PASS/PASS, because the colon/dot distinction is lost before the new escaping regex runs.
This report does not claim a closed source Empty. Reversing the fork is rejected by source checking at expected Empty; observed Unit; removing the constructor collision is PASS/FAIL; and the false source equality is FAIL/FAIL. The demonstrated bug is that both public gates accept a certificate with a different live value and datatype face than the checked source.
Likely fix direction: encode the internal namespace separator injectively in name_tt and use display conversion only for diagnostics. In particular, do not call name_key before generating BendTT identifiers and labels.
This is the newly accepted same-printed-name case documented in merged PR #1156, but it is not semantically harmless for --verdict: the output name is used as a BendTT constructor/group label. I found no existing issue or PR comment reporting this post-#1156 :/. collision. Issue #1131 and PR #1216 cover the older _hex_ escaping collision; this reproducer remains PASS/PASS after applying #1216's exact escaping change to current main.
Version
main at 675381e75d2d84be685a1f4a0c88fbfdbec9eb12 (v2.0.34-17-g675381e7; the regression is not in a release tag).
System
Darwin arm64
Clang
Apple clang version 21.0.0 (clang-2100.0.123.102)
Activity
oxura commentedon Oct 7, 2026
The canonical-key fix is included in existing PR #1216 (no separate competing PR). Its previous description omitted this issue; I updated the description and refreshed the branch to main
f76c251a. The constructor and recursive-group namespace collision regression passes the current real BendTT kernel, alongside the punctuation and literal-escape regressions.fix(verdict): BendTT labels spell the canonical key injectively (bend…
fix(verdict): BendTT labels spell the canonical key injectively (#1131,