Skip to content

feat: affixiate Python source into character-first gonols - #38

Merged
erinepshovel-code merged 10 commits into
mainfrom
feat/python-gonol-affixiation
Sep 12, 2026
Merged

erinepshovel-code merged 10 commits into
mainfrom
feat/python-gonol-affixiation

Conversation

@erinepshovel-code

Copy link
Copy Markdown
Contributor

Summary

  • add stack-local Python Gonol Construction for Python 3.12 file input
  • admit exact source occurrences as character gonols, then close non-exclusive character-definition gonols before lexical construction
  • preserve the original tokenizer/AST engine only as private _recognition witness logic
  • recursively affixiate lexical, delimiter, grammar, and module constructions from already-closed gonols
  • preserve invalid/unfinished source under hmmm
  • reject deprecated public letter-floor receipts on replay
  • add stack-consistency + Python construction CI gates

Evidence

  • exact source bytes/encoding and per-occurrence identity preserved
  • lexical forms remain an exact partition of closed source characters
  • broad Python 3.12 surface fixture retained
  • CPython tokenizer/AST objects remain witnesses, never gonol identities

hmmm

  • exact UCNS affixiation geometry
  • exhaustive parity replay against CPython's complete 3.12 grammar/test corpus
  • post-3.12 language profiles

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-13T00:03:47.956898Z e46d927 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@erinepshovel-code
erinepshovel-code merged commit f0376a8 into main Sep 12, 2026
8 checks passed

@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: e46d9273c5

ℹ️ 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".

raw_tokens: list[tuple[int, int, str, str, str]] = []
zero_width: list[str] = []
unresolved: list[str] = []
stream = tokenize.generate_tokens(io.StringIO(source).readline)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve standalone carriage-return line boundaries

When a valid Python file uses classic-Mac \r line endings, passing the unnormalized source directly to generate_tokens bypasses universal-newline handling. For example, CPython executes b"x=1\ry=2\r", but affixiate_python_bytes raises tokenizer position outside source: (1, 9) instead of producing a receipt. Normalize the tokenizer witness while mapping its positions back to the exact original source so valid \r files remain admissible.

Useful? React with 👍 / 👎.

or root is not receipt.gonols[-1]
or root.span.start != 0
or root.span.end != len(source)
or root.scale not in {"module", "source"}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject success standing for hmmm roots

When an existing invalid-source receipt is reserialized with standing="implemented-candidate" and a regenerated receipt digest, this check accepts its scale="source" / python.source.hmmm root. The verification CLI consequently reports the receipt as verified with success standing even though its graph records a grammar or tokenizer failure; replay should require implemented candidates to have module roots and hmmm receipts to have source-hmmm roots.

Useful? React with 👍 / 👎.

Comment on lines +867 to +870
if sys.version_info[:2] != (3, 12):
raise PythonGonolConstructionError(
f"{LANGUAGE_PROFILE} requires a Python 3.12 recognition witness; got {sys.version_info.major}.{sys.version_info.minor}"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Enforce the pinned CPython recognition witness

On any CPython 3.12 patch—or even PyPy reporting 3.12—this major/minor-only check passes, although BASE.json pins python/cpython v3.12.14 at a specific commit and the workspace describes CPython as the pinned witness. Different tokenizer/parser implementations can therefore emit receipts under the same constructor and language-profile identity; validate the implementation and exact patch, and pin the workflow accordingly.

AGENTS.md reference: AGENTS.md:L11-L12

Useful? React with 👍 / 👎.

Comment on lines +685 to +687
for child in ast.iter_child_nodes(node):
child_span = node_span(child)
if child_span is not None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid recursive span traversal for valid deep ASTs

For a syntactically valid expression containing roughly 1,000 left-associative terms such as x+x+..., CPython compiles the source successfully, but this recursive node_span() call exceeds the default recursion limit and affixiate_python_source raises a raw RecursionError instead of producing a receipt. Such generated files can be only a few kilobytes, so traverse the AST iteratively or otherwise handle deep valid trees without aborting construction.

Useful? React with 👍 / 👎.

Comment on lines +653 to +657
tree = ast.parse(
source,
filename=source_id,
mode="exec",
type_comments=True,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Validate compiler-level file-input constraints

ast.parse accepts trees that CPython subsequently rejects during compilation, so inputs such as module-level return 1, await x, or a misplaced from __future__ import are emitted with standing="implemented-candidate" and a module root instead of being retained as hmmm. These are not valid Python 3.12 file inputs; perform non-executing compiler validation before assigning successful standing.

AGENTS.md reference: AGENTS.md:L16-L19

Useful? React with 👍 / 👎.

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.

1 participant