Skip to content

Package EigenRegex for import (closes #13) - #14

Closed
InauguralPhysicist wants to merge 1 commit into
mainfrom
package-import-13
Closed

Package EigenRegex for import (closes #13)#14
InauguralPhysicist wants to merge 1 commit into
mainfrom
package-import-13

Conversation

@InauguralPhysicist

Copy link
Copy Markdown
Contributor

Closes #13.

Problem

EigenRegex was a flat five-file load_file library: its private helpers (_peek, pos, n, branches, …) lived in the global namespace and silently clobbered any consumer using the same names — exactly what eigen-sheet hit wiring regex find & replace (#36): two _peek definitions, last-one-wins, len: null has no length surfacing far from the cause.

Fix

Fold the split into a single importable root regex.eigs + eigs.json (name regex), matching the package-template contract (one root leaf; top-level non-underscore bindings become regex.*; _-names stay private). import regex now namespaces the whole engine, so the caller-globals collision class (#5) and the _peek clash (#13) are structurally gone rather than mitigated by local.

  • Public surface: re_compile / re_match / re_search / re_find_all / re_replace (positional spans) + compat_match / compat_find / compat_replace (builtin-shaped, folded in from the compat shim — namespaced, so no builtin shadowing across the import boundary).
  • Privatised the internal entry points to _rx_parse / _rx_compile_ast / _rx_vm_run; all other helpers were already _-prefixed.
  • Tests converted load_fileimport regex (S1–S8, smoke, bench). S9 flipped from the load_file scope suite to an import-isolation guard (now also survives a consumer _peek collision the old model couldn't). New tests/test_pkg_smoke.sh stages the package into eigs_modules/regex/ and imports it the way --pkg add would, asserting public surface + internal privacy.
  • Docs (README / CLAUDE.md) moved to the import model; fixed EIGS_REF drift (CLAUDE.md said v0.26.0; actual pin is v0.30.0).

Verification

359 checks + package smoke, all green against the CI-pinned v0.30.0 (built from the tag). --lint regex.eigs: no issues.

Side finding (logged in GAPS.md, not fixed here)

Running the S8 differential against a v0.32.0 runtime surfaced a builtin regex_match shape change: non-participating capture groups went from truncated (regex_match of ["b","(a)|(b)"]["b"] on v0.30.0) to null-filled (["b", null, "b"] on v0.32.0). Not an EigenRegex bug, but it will break the S8 differential on an EIGS_REF bump and is a breaking builtin-shape change worth an upstream decision.

🤖 Generated with Claude Code

The engine shipped as a flat five-file `load_file` library, so its
private helpers (`_peek`, `pos`, `n`, `branches`, …) lived in the global
namespace and silently clobbered any consumer using the same names —
exactly what eigen-sheet hit wiring regex-powered find & replace (#36):
two `_peek` definitions, last one wins, `len: null has no length` far
from the cause.

Fold the split into a single importable root `regex.eigs` + `eigs.json`
(name `regex`), matching the package-template contract (one root leaf,
top-level non-underscore bindings become `regex.*`, `_`-names stay
private). `import regex` now namespaces the whole engine, so the
caller-globals collision class (#5) and the `_peek` clash (#13) are
structurally gone rather than mitigated by `local`.

- Public surface: `re_compile`/`re_match`/`re_search`/`re_find_all`/
  `re_replace` (spans) + `compat_match`/`compat_find`/`compat_replace`
  (builtin-shaped, folded in from the compat shim — namespaced, so no
  builtin shadowing across the import boundary).
- Internal entry points privatised to `_rx_parse`/`_rx_compile_ast`/
  `_rx_vm_run`; all helpers already `_`-prefixed.
- Tests converted from `load_file` to `import regex` (S1–S8, smoke,
  bench). S9 flipped from the load_file scope suite to an
  import-isolation guard (adds a `_peek` collision the old model
  couldn't survive). New `tests/test_pkg_smoke.sh` stages the package
  into `eigs_modules/regex/` and imports it the way `--pkg add` would,
  asserting public surface + internal privacy.
- Docs (README/CLAUDE.md) updated to the import model; `EIGS_REF` drift
  fixed (v0.26.0 → the actual v0.30.0 pin).
- GAPS.md: logged a builtin `regex_match` non-participating-group shape
  change (v0.30.0 `["b"]` → v0.32.0 `["b", null, "b"]`) surfaced by the
  S8 differential — will bite an EIGS_REF bump.

359 checks + package smoke, green against the CI-pinned v0.30.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@InauguralPhysicist

Copy link
Copy Markdown
Contributor Author

Closing as already-landed, not as rejected — and the reason is a mistake on my side worth recording.

During the ecosystem-wide v0.30.0 → v0.32.0 pin sweep, this repo's working tree was checked out on package-import-13. My sweep script cut its bump branch from ambient HEAD rather than from a freshly fetched origin/main, so this branch's entire contents rode along inside PR #15 and were squash-merged into main under the message "Bump EigenScript pin v0.30.0 -> v0.32.0". GitHub's squash body inherited the closes #13 trailer, which is why #13 auto-closed.

So the packaging work IS on main (41cc66e) and is green — tests/run.sh passes 359 checks plus the package smoke, and CI passed on #15. What went wrong is the record, not the code: a feature landed unreviewed under a pin-bump label.

This PR must not be merged now. Its branch predates the pin bump, so the only remaining delta against main is EIGS_REF/CLAUDE.md going v0.32.0 → v0.30.0 — merging it would silently revert the pin.

Fix applied going forward: sweep loops now branch from a fetched origin/HEAD explicitly and assert the staged diff contains only the intended files, and every merged sweep commit gets verified with git show --stat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

packaging: make EigenRegex importable (namespaced), not just load_file

1 participant