[WRONG BRANCH] fix(grok): don't treat nested [model.x.y] sub-tables as alias collisions - #240
[WRONG BRANCH] fix(grok): don't treat nested [model.x.y] sub-tables as alias collisions#240luvs01 wants to merge 1 commit into
Conversation
|
✅ Deterministic PR hygiene checks passed. |
📝 WalkthroughWalkthroughThe change narrows model alias collision detection to plain and array-of-table headers. Tests confirm that nested model sub-tables remain valid without forcing a suffix on the generated parent alias. ChangesModel alias detection
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e85ab4bc4
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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.
Inline comments:
In `@src/grok/inject.ts`:
- Around line 79-80: Make MODEL_TABLE_HEADER matching TOML-aware by ensuring
header-like lines inside multiline string values are ignored, either by tracking
multiline-string state while scanning or by parsing TOML before identifying
table headers. Preserve alias reservation only for actual model table headers,
and add a regression case in tests/grok-config-inject.test.ts containing a
complete header-looking line inside a multiline string.
- Around line 79-80: Update MODEL_TABLE_HEADER and ANY_TABLE_HEADER to require
matching single- or double-bracket table delimiters, preventing mismatched forms
such as [model.foo]] and [[model.foo]. Ensure capture groups remain aligned with
the match[1]/match[2] consumers or update those consumers accordingly. Adjust
the raw gm scan to ignore header-like text inside multiline TOML strings by
masking or structurally parsing those strings before applying the header
regexes.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: a92b7b4b-a968-4505-9f02-6a6f0069b561
📒 Files selected for processing (2)
src/grok/inject.tstests/grok-config-inject.test.ts
Motivation
[model.<alias>.<...>]sub-table headers, causing harmless user sub-tables like[model.ocx-mine.extra]to force generated aliases to be suffixed (e.g.ocx-mine-2).Description
[model.<alias>]headers (and[[model.<alias]]arrays) by removing the optional sub-table tail fromMODEL_TABLE_HEADERinsrc/grok/inject.ts.[model.x.extra]) do not collide with an explicitly emitted parent table under TOML semantics.tests/grok-config-inject.test.tsthat ensures a user-owned sub-table does not reserve the alias and that the stable[model.ocx-mine]is emitted without a-2suffix.Testing
bun run typecheckand it completed successfully.npx --yes bun@1.3.14 test tests/grok-config-inject.test.tsand all tests in that file passed (43 tests, 0 failures).bun test tests/grok-config-inject.test.tswith the preinstalled Bun (v1.2.14) failed due to a missingnode:zlibexport in that runtime; re-running with the repository CI Bun (1.3.14) produced the green focused test run above.npx --yes bun@1.3.14 run test; the full suite exercised many unrelated environment-sensitive tests and was interrupted after unrelated failures, while the focused regression and typecheck succeeded.Codex Task
Summary by CodeRabbit
Bug Fixes
Tests