test: prove case-fold collision preflight

This commit is contained in:
2026-08-15 16:11:01 +09:00
parent 265be3f796
commit 6974bec878
4 changed files with 1037 additions and 13 deletions

View File

@@ -269,8 +269,14 @@ ImportPath = ident { "." ident } .
are ignored. Eligible names are byte-sorted before source validation.
Production excludes selected `*_test.ww`; test variants classify only those
selected test files. An excluded file contributes no declarations, imports,
package edge, action, export, artifact, initialization, test, or persistent
invalidation.
filename collision, package edge, action, export, artifact, initialization,
test, or persistent invalidation. After eligibility, two distinct selected
basenames in one canonical directory that are equal under Go 1.26.5 Unicode
simple folding are rejected after the coordinator's required package-clause
classification and production `@test` validation parses, but before the
delegated graph-import scan or tools. An ordinary build compares production
names only; one test product compares its production, same-package test, and
external-test selections without merging their units.
- `import acme.codec;` loads the canonical package `acme.codec`. If that
package declares `package wire;`, the importing file sees its exported names
as `wire.Name`; `codec.Name` is not an additional binding. An explicit alias
@@ -294,6 +300,12 @@ ImportPath = ident { "." ident } .
edge. Test-only occurrences never enter ordinary production. Self-import is
rejected, except that toolchain-owned external-test self wiring is rebound to
the effective augmented package action after ordinary per-site validation.
- Canonical import identity is exact and case-sensitive. After contextual local
or vendor expansion, two distinct effective identities that are equal under
Go 1.26.5 simple folding are a request-wide structural error. Folding is only
a temporary collision key: it never changes lookup, action identity, `.wwi`
ownership, symbols, artifacts, storage, or diagnostics. Repeated occurrences
of the same exact identity remain valid and deduplicate normally.
- An executable package is one declared `package main` and containing a
`fn main`; path and directory spelling do not classify commands. An ordinary
import of a package declared `main` is rejected, except for the toolchain's
@@ -618,6 +630,13 @@ under test binds to the augmented white-box action when it exists; affected
transitive importers are copied and rewired so ordinary and augmented package
state do not coexist in the linked closure.
Those variants are action distinctions over exact package representatives, not
new ordinary package identities for case-fold comparison. Production,
same-package test, external test, and recompiled copies of one exact canonical
package therefore do not collide with each other. Their selected source units
remain separate, while the directory-owned filename preflight spans the
production/internal/external selections applicable to that test product.
Before a test function runs, the one generated product initializes its exact
effective graph dependency-first and once per canonical action. Imports,
runtime lets, and init declarations found only in `*_test.ww` never enter an