G-035: update goal detail to reflect resolved mechanism investigation
The avoid-mixing rule is no longer folklore: both co-causes are now
identified and pinned. Co-cause 1 is stock Tcl's $satisfied early return
suppressing the library scan (silent older-version selection under
prefer latest, order-dependent indexing). Co-cause 2 is the libunknown
0.2.2 namespace-context bug (fixed 0.2.3, pinned by
pkgindex_relative_namespace_is_global). The rule is substantiated for
stock Tcl and neutralised under the punkshell chain.
Updates:
- Goal: replaced open-ended 'substantiate or retire' framing with the
resolved finding; remaining work is the crossform characterization
suite and AGENTS.md guidance
- Context: removed 'folklore' characterization; presented the mechanism
as established knowledge with both co-causes
- Restructured Questions into Resolved (identified-mechanism findings
with reproduction table) and Still Open (same-version collisions,
package forget crossing forms, packagepreference interaction)
- Approach: references the new crossform suite complementing existing
shadowing/ and discovery/ suites; guidance deliverables named
- Notes: promoted the 0.2.3 bug fix from baseline note to co-cause
alongside the $satisfied mechanism; both explain the original folklore
- Identified mechanism section: restructured as two co-causes with
explicit consequences replacing the either/or framing
- Acceptance: tightened to enumerate the five characterization cases and
name the specific guidance deliverables
- Fixed typo: lllength -> llength in quoted stock Tcl source
Assisted-by: harness=pi; primary-model=anthropic/claude-sonnet-4-20250514; api-location=anthropic.com
Scope: src/tests/modules/punk/libunknown/testsuites/ (characterization suite); src/modules/punk/libunknown-*.tm and src/modules/punk/packagepreference-999999.0a1.0.tm (as characterised, fixed only if outright bugs surface); src/modules/AGENTS.md + src/lib/AGENTS.md (resulting guidance)
Goal: the behaviour when the same package is provided both as a .tm module and as a pkgIndex.tcl-based library - same or differing versions, under the standard package unknown, punk::libunknown and punk::packagepreference - is characterised by committed tests, and the currently informal working rule ("avoid mixing provision forms for one package - unexpected behaviour even with libunknown's improvements") is either substantiated with the specific failure modes named in AGENTS.md guidance, or retired if the characterisation shows the machinery now handles mixing predictably.
Acceptance: a committed test suite (extending src/tests/modules/punk/libunknown/testsuites/) characterises at least: same name+version provided via .tm and via pkgIndex.tcl (which registration wins, and whether it is deterministic across scan-trigger orderings) under the standard scanner, under punk::libunknown, and with punk::packagepreference active; differing versions across the two forms (version selection integrity including package prefer latest, and whether the losing form's registration lingers); re-registration effects (package forget then re-require crossing forms); surprising-but-accepted behaviours are pinned with GAP/known-quirk comments (the fossilmove characterization pattern), outright bugs fixed or filed as goals; the resulting do/don't guidance lands in src/modules/AGENTS.md and src/lib/AGENTS.md naming the characterised failure modes (or explicitly lifting the avoid-mixing rule if unwarranted).
Goal: the per-chain behaviour when the same package is provided both as a .tm module and as a pkgIndex.tcl-based library is characterised by committed crossform tests. The avoid-mixing rule is already substantiated for stock Tcl (named mechanism: `$satisfied`-suppressed chain fallthrough producing silent older-version selection and order-dependent indexing; see the Identified Mechanism section) and neutralised under the punkshell chain (libunknown always falls through; the 0.2.3 namespace-context bug is fixed). The remaining work is the crossform characterization suite covering the still-open cases (same-version collisions, `package forget` crossing forms, packagepreference interaction) and AGENTS.md guidance naming the failure mode for stock Tcl and the safe condition for the punkshell chain.
Acceptance: a committed crossform test suite under src/tests/modules/punk/libunknown/testsuites/ (new suite, complementing the existing shadowing/ and discovery/ suites which cover .tm-vs-.tm tie-breaking and pkgIndex.tcl sourcing scope respectively) characterises the identified-mechanism cases and the still-open cases: (1) the identified mechanism (tm `$satisfied` suppressing the library scan) reproduced under the standard scanner and confirmed absent under the punkshell chain - a .tm providing an older version silently winning over a newer pkgIndex.tcl version under `prefer latest`; (2) same name+version via both forms (which registration wins and whether it is deterministic across trigger orderings) under each chain; (3) differing versions with the newer in pkgIndex.tcl (version selection integrity under `prefer latest`, and whether the losing form's ifneeded registration lingers and can resurface after `package forget then re-require`); (4) interaction with punk::packagepreference's `package require` overload; (5) the pkgIndex.tcl side-effect and sibling-registration consequences of suppressed vs unsuppressed library scans; all three chains (standard scanner, libunknown, packagepreference) are covered by the same fixture matrix; surprising-but-accepted behaviours are pinned with GAP/known-quirk comments; outright bugs are fixed or filed; the resulting guidance lands in src/modules/AGENTS.md and src/lib/AGENTS.md naming the stock-Tcl failure mode (silent older-version selection + order-dependent indexing suppression) and the punkshell safe condition (libunknown chain always falls through; uninit'd child interps and plain tclsh still see stock behaviour).
## Context
@ -19,45 +19,72 @@ Tcl packages arrive by two registration routes with different machinery:
semantics, `auto_path` ordering rather than tm-list ordering.
When the SAME package is provided by both routes - same version or different
versions - the interaction is not well characterised. The user's standing
informal rule (recalled 2026-07-07): **avoid mixing .tm and pkgIndex.tcl
provision for one package** - unexpected behaviour was observed even after
punk::libunknown's improvements to the unknown-handler chain. That rule is
currently folklore: undocumented, unproven, and untested. Meanwhile the punk
ecosystem genuinely straddles both forms (src/modules .tm trees vs src/lib