Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.

fix: closed_tokens.py dispatch collisions, dead code, NBSP key, docstring + CLAUDE.md core/ status - #42

Merged
erinepshovel-code merged 4 commits into
mainfrom
claude/fix-closed-tokens
May 13, 2026
Merged

erinepshovel-code merged 4 commits into
mainfrom
claude/fix-closed-tokens

Conversation

@erinepshovel-code

Copy link
Copy Markdown
Collaborator

Summary

Addresses five issues across closed_tokens.py and CLAUDE.md in a single atomic commit.

Changes

  • Fix closed_tokens.py: silent class collisions in DISPATCH — conjunction/determiner senses unreachable #31 — Silent dispatch collisions: _build_dispatch_table's inner add() now calls warnings.warn(f"closed_tokens: dispatch collision on {token!r}; keeping first entry", stacklevel=2) instead of silently returning. Added a docstring note and module-level docstring explaining the collision convention: since/until/as resolve to the preposition sense; that resolves to the determiner sense (by table-ordering).

  • Fix closed_tokens.py: dead code + latent HOST_CARRIER/32 coupling #32 — Dead code + HOST_CARRIER/32 coupling: Removed unused unit_obj and multiply from the ucns_v04 import. Removed the _class_anchor function (never called). Added # reserved but unpopulated annotation to CLASS_PUNCT_QUOTE = 12. Replaced every hardcoded 32 in _wrap_with_class and class_of with 2 * HOST_CARRIER so there is one source of truth.

  • Fix closed_tokens.py: WHITESPACE_TABLE possible ASCII-space / NBSP key collision — needs byte verification #33 — WHITESPACE_TABLE NBSP key: Rewrote the ambiguous literal non-breaking space key as "\xa0" with an explicit # U+00A0 NON-BREAKING SPACE comment.

  • Fix #36A — disk-flip docstring: Replaced "The disk-flip of an open-mark UCNS object equals the close-mark object (verified by test)." with "The disk-flip property (open-mark ↔ close-mark symmetry) is stated as a design invariant; implementation is in ucns_v04.py (TODO: add explicit test)."

  • Fix #36B — CLAUDE.md core/ status drift: Updated the core/ row in the Dual Package Layout table and the "What Does Not Exist Yet" section to reflect that core/parsing/, core/operator/, and core/bridge/ now contain substantive implementations. Status changed from "Scaffolded stubs, 0-byte files" to "Partially implemented refactor-in-progress; see individual module docstrings for what is and isn't complete."

Test plan

  • Import closed_tokens and confirm warnings.warn fires for known collisions (since, until, as, that)
  • Confirm encode("since") returns a CLASS_PREPOSITION object (not conjunction)
  • Confirm encode("that") returns a CLASS_DETERMINER object (not conjunction)
  • Confirm encode("\xa0") (NBSP) encodes correctly as kind=4 whitespace
  • Confirm class_of(encode("the")) round-trips correctly with the new 2 * HOST_CARRIER expression
  • Verify no AttributeError from removed unit_obj/multiply imports
  • Verify _class_anchor removal causes no test failures (it was never called)

https://claude.ai/code/session_01HuvotBawBsg9atLV1ZThvC


Generated by Claude Code

@erinepshovel-code
erinepshovel-code marked this pull request as ready for review May 13, 2026 01:27
Copilot AI review requested due to automatic review settings May 13, 2026 01:27

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38298b33c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread closed_tokens.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the top-level closed-token UCNS encoder and repository documentation to make dispatch collisions explicit (warn instead of silently dropping entries), remove dead code, clarify a NBSP whitespace key, and correct/modernize CLAUDE.md’s description of the core/ refactor status.

Changes:

  • Add warnings.warn on dispatch collisions and document the collision tie-break convention in closed_tokens.py.
  • Remove unused imports/dead helper code, and de-couple class encoding/decoding from a hardcoded 32 by using 2 * HOST_CARRIER.
  • Update WHITESPACE_TABLE’s NBSP key to "\xa0" and refresh CLAUDE.md to reflect current core/ implementation status.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
closed_tokens.py Adds collision warnings + collision convention docs; removes dead code; clarifies NBSP; replaces hardcoded lattice constants with 2 * HOST_CARRIER.
CLAUDE.md Updates repo structure/status text to reflect that core/ has substantive implementations in some subpackages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread closed_tokens.py Outdated
Comment thread closed_tokens.py
Comment thread closed_tokens.py Outdated
erinepshovel-code and others added 2 commits May 12, 2026 18:38
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0573490c42

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread closed_tokens.py Outdated
…sion tests

- Remove warnings.warn() from _build_dispatch_table: the known collisions
  (since/until/as/that) are intentional and documented in the module
  docstring; firing a warning unconditionally at import time breaks any
  -W error CI environment merely by importing the module
- Remove 'import warnings' (now unused)
- Add blank line after 'from __future__ import annotations' (PEP 8)
- Module docstring: disk-flip sentence now says 'design invariant with no
  implementation yet' instead of 'implementation is in ucns_v04.py'
  (there is no disk-flip op in ucns_v04.py)
- Tests/test_backend.py: add TestClosedTokens covering collision
  resolution convention for since/until/as/that
@erinepshovel-code
erinepshovel-code merged commit 8a16f93 into main May 13, 2026
3 of 4 checks passed
@erinepshovel-code
erinepshovel-code deleted the claude/fix-closed-tokens branch May 13, 2026 01:48
Copilot stopped work on behalf of erinepshovel-code due to an error May 13, 2026 01:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

3 participants