Revert "MTMacroAtom and two-phase finalized (#265)" - #267
Conversation
This reverts commit 8d43971. PR #265 added MTMacroAtom, the kMTMathAtomMacro type, a two-phase -finalized (expandMacros, then the existing reclassifying pass), and -transferScriptsToExpansion:, so that \pmod{n} would serialize back to \pmod{n} rather than to its expansion. Nothing else uses any of it, and \pmod/\mod/\pod themselves had not landed yet — so on master today this is ~460 lines of model-layer machinery with no caller. Preserving the command name through serialization is not an acceptance criterion for the feature (PRD §10 lists eight; none concern serialization). It appears only as an open question for the LLD (§9.5), and PRD §11's own reference table already describes \pmod's atom head as "Space + Open + Ord …" — an atom sequence, i.e. the expansion. iosMath already declines the same fidelity elsewhere: \implies serializes as \Longrightarrow. \pmod, \mod and \pod land in #266 instead as a parse-time expansion, the way TeX defines them. That also turns out to be the more faithful of the two: with no macro atom to carry them, \pmod{n}^2 attaches ^2 to the ")" exactly as LaTeX does, rather than transferring it onto the last scriptable atom of the expansion. MTMathList.h and MTMathList.m return to their state at e278be3. The \bmod tests from #264 are unaffected. 446 tests, 0 failures. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ts3f5UtUywaqimvE4U1rkw
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
📝 WalkthroughWalkthroughThe PR removes macro atom declarations, macro expansion logic, and associated tests. It updates header search paths and Unicode header wiring, removes obsolete internal headers, and replaces the removed test target entry with ChangesMacro removal and project cleanup
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
iosMath.xcodeproj/project.pbxproj (1)
530-542: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winOrphaned test file:
MTModularArithmeticTest.msurvives the revert but is no longer built. The revert stripped every project reference to the file while leaving the trimmed file (and its still-relevant\bmodtests) in the tree, so that coverage silently stops running.
iosMath.xcodeproj/project.pbxproj#L530-L542: either restore theMTModularArithmeticTest.mbuild-file/file-reference/group/sources entries, or drop the file from the tree in this PR.iosMathTests/MTModularArithmeticTest.m#L141-L142: if the file is intentionally retired, relocate the surviving\bmodtests (includingtestDemotedBmodSerializes) into a test file that remains in the target before deleting it.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@iosMath.xcodeproj/project.pbxproj` around lines 530 - 542, Restore MTModularArithmeticTest.m’s file-reference, build-file, group, and PBXSourcesBuildPhase entries in iosMath.xcodeproj/project.pbxproj so the test target builds it, or intentionally remove iosMathTests/MTModularArithmeticTest.m; if removing it, first move its surviving \bmod tests, including testDemotedBmodSerializes, into a test file that remains in the target. The project file site requires the build-reference restoration or deletion decision, and the test-file site requires relocation before deletion.
🧹 Nitpick comments (1)
iosMath/render/internal/MTTypesetter.m (1)
15-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the search-path import here (
iosMath/render/internal/MTTypesetter.m:15).MTUnicode.his already on the target’s header search paths, so#import "MTUnicode.h"is cleaner than../../traversal.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@iosMath/render/internal/MTTypesetter.m` at line 15, Replace the relative traversal import in MTTypesetter.m with the search-path import for MTUnicode.h, using the header name directly while preserving the existing dependency.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@iosMath.xcodeproj/project.pbxproj`:
- Around line 530-542: Restore MTModularArithmeticTest.m’s file-reference,
build-file, group, and PBXSourcesBuildPhase entries in
iosMath.xcodeproj/project.pbxproj so the test target builds it, or intentionally
remove iosMathTests/MTModularArithmeticTest.m; if removing it, first move its
surviving \bmod tests, including testDemotedBmodSerializes, into a test file
that remains in the target. The project file site requires the build-reference
restoration or deletion decision, and the test-file site requires relocation
before deletion.
---
Nitpick comments:
In `@iosMath/render/internal/MTTypesetter.m`:
- Line 15: Replace the relative traversal import in MTTypesetter.m with the
search-path import for MTUnicode.h, using the header name directly while
preserving the existing dependency.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: cda51451-ee31-4573-bc96-be3399db82ab
📒 Files selected for processing (9)
Package.swiftiosMath.xcodeproj/project.pbxprojiosMath/lib/MTMathList.hiosMath/lib/MTMathList.miosMath/lib/MTUnicode.hiosMath/lib/internal/MTMacroParameterAtom.hiosMath/module.modulemapiosMath/render/internal/MTTypesetter.miosMathTests/MTModularArithmeticTest.m
💤 Files with no reviewable changes (3)
- iosMath/lib/internal/MTMacroParameterAtom.h
- Package.swift
- iosMath/lib/MTMathList.h
Reverts #265.
#265 added
MTMacroAtom, thekMTMathAtomMacrotype, a two-phase-finalized(expandMacros, then the existing reclassifying pass), and-transferScriptsToExpansion:, so that\pmod{n}would serialize back to\pmod{n}rather than to its expansion. Nothing else uses any of it, and\pmod/\mod/\podthemselves had not landed yet — so on master today this is ~460 lines of model-layer machinery with no caller.Why the requirement it served isn't one
Preserving the command name through serialization is not an acceptance criterion for the feature. PRD §10 lists eight; none concern serialization. It appears only as an open question for the LLD (§9.5), phrased conditionally. Meanwhile PRD §11's own reference table already describes
\pmod's iosMath atom head asSpace + Open + Ord …— an atom sequence, i.e. the expansion. And iosMath already declines exactly this fidelity elsewhere:\impliesserializes as\Longrightarrow.What replaces it
\pmod,\modand\podland in #266 instead as a parse-time expansion, the way TeX defines them — a three-entry table of prefix/suffix LaTeX strings and one method that reads the argument and splices it between them, entirely insideMTMathListBuilder.That turns out to be the more faithful of the two designs, not a compromise:
\pmod{n}^2^2transferred onto the last scriptable atom of the expansion^2on the), as in LaTeXThe cost is that
mathListToStringemits the expansion rather than the command. It is equivalent LaTeX that re-parses to a structurally identical atom list, which #266 pins with a test.Scope
MTMathList.handMTMathList.mreturn to their state at e278be3. The\bmodwork from #264 is untouched. 446 tests, 0 failures; release build clean.#266 will be rebased onto this.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Ts3f5UtUywaqimvE4U1rkw
Summary by CodeRabbit
Breaking Changes
Improvements