Repository navigation
chore(codegen): adopt MetaObjects 1.2.0 shipped generators and move model/max_tokens into metadata - #52
Merged
Conversation
…model and max_tokens from metadata - Bump the six @metaobjectsdev packages 1.1.4 -> 1.2.0 and refresh the agent context. - Import entityFile and barrel from @metaobjectsdev/codegen-ts/generators and delete the ejected copies, which carried no edits of their own (generated diff is header-only). - Replace the ejected queries copy with a small composition-loaders generator built on the engine primitives: it emits the only generated read the app uses (findCouncilWithTurns); stock queries would emit unused CRUD and has no composition loader. - Declare @model and @maxtokens on each template.toolcall (@model registered by the project provider); the structured-completion generator passes both, the HTTP client keeps no defaults, the MODEL var and the test-only complete() are removed. - Each custom generator's header says why no shipped generator covers it; generated headers use the current edit note.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Wizards of Odd is being fixed as the MetaObjects reference implementation (maintainer-approved). This is audit bundle 3 from the MetaObjects adoption audit report, covering findings 9, 11, 13 and 14. Bundles 1 and 2 landed in #51. Maintainer direction (2026-11-11): no raw SQL with drifting field names; at minimum use the generated field, table and enum constants, ideally an ORM.
The four findings, in substance:
What Changed
entityandbarrelgenerator copies with the shippedentityFileandbarrelfrom@metaobjectsdev/codegen-ts/generators, and deletes the stale copies. Replaces the ownedqueriesgenerator with a new ownedcodegen/generators/composition-loaders.ts, which emits only the composition loaders the app reads.modelandmaxTokensonto eachtemplate.toolcall(metaobjects/toolcalls/*.yaml, new@modelattr in the project provider).structured-completionnow emits them into the generated wrappers.completeStructuredno longer defaults either value, and theMODELWorker var and its fallback are removed fromsrc/index.ts,src/llm/anthropic.tsandwrangler.jsonc. The request body is unchanged.@metaobjectsdev/*packages from 1.1.4 to 1.2.0, regenerates the generated code and agent docs, and refreshes the.claude/skillsand.metaobjectscontext files.Risk Assessment
✅ Low: The changes match all four audit findings. The request body is unchanged: model and max_tokens are the same values, now sourced from metadata via the generated wrappers. The generated diff is limited to headers. The only issue found is a misplaced docs section.
Testing
Baseline checks all pass: drift gate, portrait verify, tsc, and the full 233-test vitest suite. Against a disposable local wrangler dev with local D1 and a fake Anthropic key, I drove the health route, both request-validation guards, the council SSE happy path (which hit real Anthropic and got a 401, so no spend), persistence to D1, and the share page render. The request-body capture confirms the metadata-driven model and max_tokens match the pre-change literals. Not driven: a successful real-LLM council, which would spend metered money and needs the maintainer's approval. Local server and state were torn down and .dev.vars removed; the worktree is clean.
Evidence: Council SSE stream (health/guard/happy-path transcript)
Evidence: Generated wrapper request body capture
Evidence: Share page SSR render of persisted council
Evidence: wrangler dev log
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
docs/how-metaobjects-is-used.md:159- The new "## Owned generators: why each one exists" section is inserted in the middle of the friction-log bullet list. The last bullet ("A nested-value-object FQN codegen bug…") now sits after the section's closing paragraph and reads as a stray bullet under the wrong heading. Move the new section after that bullet, or move the bullet above the heading.codegen/generators/composition-loaders.ts:1- Finding 13 asked to shrink the six custom generators toward shipped ones where one now covers the output. The only shrink is queries.ts (291 lines) replaced by composition-loaders.ts (172 lines). The other generators got only "Why custom" comments, which the intent permits ("keep … only where it emits something no shipped generator does, recording why"). The rationale is recorded in the generator headers and in docs/how-metaobjects-is-used.md. Not a contradiction; noted for the record.✅ **Test** - passed
✅ No issues found.
npm ci (dependencies from lockfile)npm run demo:drift (meta verify --templates --codegen --prompts data/templates): exit 0, codegen no driftnpm run verify (verify-portraits): exit 0npx tsc -b: exit 0npx vitest run: 37 files, 233 tests passednpx wrangler d1 migrations apply wizardsofodd --local (0001-0007 applied)npx meta verify --dialect d1 --d1 DB: schema in sync with local D1wrangler dev --port 8787 with disposable .dev.vars (TEST_BYPASS_TURNSTILE, fake ANTHROPIC_API_KEY): GET /api/healthPOST /api/council empty question -> 400POST /api/council without Turnstile token -> 429POST /api/council happy path (wizardIds [lorekeeper], fake key) -> SSE council/error/verdict/done stream; Anthropic reachable, returned 401 to fake key (zero spend)local D1 query: councils row tjuBcVks persisted with status complete; council_turns count 1GET /c/tjuBcVks share page SSR -> 200 with persisted question and verdicttsx request-body-capture.mts: generated callEmitWizardTake/callEmitVerdict request bodies via injected fetch -> model claude-sonnet-4-6, max_tokens 1024, tool_choice names emit_wizard_take / emit_verdict🔧 **Document** - 1 issue found → no changes applied ✅
.claude/skills/metaobjects-codegen/references/typescript.md- Generated MetaObjects skill docs under .claude/skills/ and .metaobjects/ still show queriesFile()/entityFile/barrel in example configs and mention 1.0-era scaffold-and-own. They are refreshed bymeta init --refresh-docs, not hand-edited, so left as is. Follow-up: refresh them with the tool and merge the .new copies.🔧 No changes applied.
✅ Re-checked - no issues remain.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.