docs(agent-context): make schema-apply doctrine per-stack (#192) - #263
Merged
Conversation
…ta-migrate-only The always-on scaffold doctrine asserted 'apply schema only through meta migrate' universally. On a JVM/Flyway stack there is no such command (ADR-0015 removed the meta:migrate mojo and the Flyway output adapter was never built), so the generated .metaobjects/AGENTS.md misdirected adopters to tooling that isn't shipped for their stack. Reword the doctrine to attribute the apply mechanism per stack: meta migrate on the Node/TS-owned migrate stack; on Flyway/Liquibase stacks the migration is authored to MATCH the generated schema and enforced by the boot-time meta verify --db drift gate. The core principle (schema is codegen-derived; never ad-hoc hand-apply to the live DB; always drift-gate) is unchanged. Building the ADR-0015 Flyway-prefix output adapter on the shared migrate engine remains a separate follow-up (the other half of #192). Regenerated the four agent-context conformance fixtures (emitter is TS-owned). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HLoJkFSyoticveo5ehMUAr
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
Branch fix/192-flyway-scaffold-doctrine fixes the actionable-now half of issue #192 (npm-side; the agent-context emitter is TS-owned).
THE PROBLEM: the shared agent-context always-on scaffold doctrine (agent-context/templates/always-on.md.mustache, which generates .metaobjects/AGENTS.md + CLAUDE.md for every port) asserted 'apply schema only through meta migrate' UNIVERSALLY. ADR-0015 removed the Java meta:migrate mojo and the Flyway output adapter was never built, so a JVM/Flyway consumer has no such command — the generated scaffold misdirected adopters (human + agent) to tooling not shipped for their stack.
THE FIX (scope = the scaffold-text correction only; building the Flyway output adapter is the separate, explicitly-deferred other half of #192): reword the doctrine to attribute the schema-apply mechanism PER STACK — meta migrate on the Node/TS-owned migrate stack (ADR-0015); on Flyway/Liquibase stacks the migration is authored to MATCH the generated schema and enforced by the boot-time meta verify --db drift gate. The core principle is unchanged (schema is codegen-derived; never ad-hoc hand-apply to the live DB; always drift-gate). Regenerated the four agent-context conformance fixtures (java-react, java-kotlin-react-tanstack, python, ts-react-tanstack — AGENTS.md + CLAUDE.md) via the repo's regen script; the repo-root agent-context/ is the tracked source, the sdk copy is a gitignored build artifact.
Verified: agent-context-conformance 4/4 pass, full sdk agent-context suite 37/37 pass. This is a documentation/scaffold-content change only — no code logic. INTENT: do not treat the reworded doctrine or the regenerated fixtures as a defect; the fixtures are the expected regen output of the template change.
What Changed
agent-context/templates/always-on.md.mustachescaffold doctrine to attribute the schema-apply mechanism per stack instead of asserting "apply schema only throughmeta migrate" universally —meta migrateon the Node/TS-owned migrate stack (ADR-0015), and on Flyway/Liquibase stacks the migration is authored to match the generated schema and drift-gated viameta verify --db.AGENTS.md+CLAUDE.mdfor java-react, java-kotlin-react-tanstack, python, ts-react-tanstack) from the updated template via the repo's regen script.meta verify --dbgate, matching the sibling verify skill and ADR-0015.Risk Assessment
✅ Low: Docs-only change is now well-bounded and consistent — the over-claimed boot-time-gate wording is removed, the accurate Node
meta verify --dbdrift gate remains, all 8 fixtures are byte-identical and match the template, and nothing outside the template + fixtures was touched.Testing
Installed deps once at the bun workspace root, then ran the targeted validation: the agent-context-conformance suite (4/4 pass — live assemble() output equals the committed goldens byte-for-byte), the full sdk agent-context suite (42/42 pass, 0 fail), and the repo's own regen script (reproduced all four fixtures with a clean working tree, proving the goldens are exactly the template's regen output). For product-level evidence I rendered the scaffold through the live pipeline for a Java/Flyway and a TS stack and confirmed the corrected per-stack doctrine is present and the old universal "Apply schema only through meta migrate" misdirection is gone — and that the Java output explicitly names Flyway. This is a docs/scaffold-content change with no code logic; the reworded doctrine and regenerated fixtures are the intended output. Working tree left clean; all evidence written to the evidence directory.
Evidence: Doctrine presence check (live assemble output, Java/Flyway + TS)
[OK] java-react AGENTS.md: corrected-per-stack=true old-universal-present=false Flyway mentioned (JVM migration tooling) = true [OK] java-react CLAUDE.md: corrected-per-stack=true old-universal-present=false [OK] ts-react-tanstack AGENTS.md: corrected-per-stack=true old-universal-present=false [OK] ts-react-tanstack CLAUDE.md: corrected-per-stack=true old-universal-present=false OLD universal phrasing (must be ABSENT everywhere): "Apply schema only throughmeta migrate" failures=0Evidence: Rendered .metaobjects/AGENTS.md a Java/Flyway consumer actually receives (live assemble output)
Corrected principle bullets now ship to the JVM consumer: - Pattern-derivable from metadata = codegen, never hand-write — ... The schema is a disposable, generated artifact: change the metadata and regenerate. Don't hand-write divergent SQL; where a stack owns its own migration files (Flyway/Liquibase), they must match the generated schema, not invent it. - The live database is a derived artifact too — ... Drive every schema change from the metadata, never ad-hoc: on the Node/TS-owned migrate stack that ismeta migrate(metadata → DDL, ADR-0015); on a JVM stack whose migration toolmeta migratedoes not emit for (e.g. Flyway/Liquibase) author the migration to match the generated schema (the source of truth). ... Runmeta verify --dbafter any DB-touching work to catch that drift early.Evidence: Live render evidence producer (calls assemble() for java-react + ts-react-tanstack)
Evidence: Rendered TS consumer AGENTS.md (live assemble output, for comparison)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
agent-context/templates/always-on.md.mustache:14- The reworded doctrine (and its 8 regenerated fixtures, same text) tells a JVM/Flyway consumer to author the migration to match the generated schema "and let the boot-time drift gate hold it honest." That framing is not stack-accurate — the change's own stated goal (commit: "stack-accurate, not meta-migrate-only"). The only shipped "boot-time drift gate" is the Kotlin MetadataStartupValidator (server/java/codegen-kotlin/.../KotlinValidatorGenerator.kt): ExposedTableValidator.check compares obj.metaFields vs the in-process Exposed Table.columns — it never introspects the live DB, so it cannot catch the hand-applied ad-hoc ALTER / divergent Flyway migration that THIS bullet's own failure mode ("column already exists") describes. The Java (non-Kotlin) port (codegen-spring) emits no startup validator at all, so a pure-Java consumer has no boot-time gate. The authoritative sibling guidance already says it correctly: metaobjects-verify/SKILL.md:98-103 and references/migration.md:13-14,102 + ADR-0015:229 establish that the live-DB drift gate on EVERY stack is the Nodemeta verify --dbCLI (TS-owned shared engine), not a boot-time gate. The bullet's own closing line ("Runmeta verify --db...") agrees and is the real gate, so an adopter following the whole bullet is still pointed at the right tool — but the inserted "boot-time drift gate" phrase overstates/non-exists for live-DB drift on the JVM path and contradicts the sibling verify skill. Concrete reachable path: a JVM/Flyway adopter relies on the stated boot-time gate, hand-applies or mis-authors a Flyway migration, and nothing catches the live-DB drift. Flagged ask-user because the intent explicitly says "do not treat the reworded doctrine as a defect" — the author should decide whether to reconcile the wording (e.g., attribute enforcement to Nodemeta verify --db, matching the verify skill, rather than "boot-time drift gate").🔧 Fix: fix(#192): drop overclaimed boot-time drift-gate wording
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
git diff 88d8d73..25149a6d -- agent-context/templates/always-on.md.mustache— confirmed template reword to per-stack attribution (Flyway/Liquibase marker + ADR-0015 reference), core drift-gate principle unchangedbun test packages/sdk/test/agent-context-conformance.test.ts(from server/typescript) — 4/4 pass, 74 expect() calls: assemble() output == committed expected/ goldens byte-for-byte for java-react, java-kotlin-react-tanstack, python, ts-react-tanstackbun test packages/sdk/test/agent-context-conformance.test.ts packages/sdk/test/agent-context-capability-grounding.test.ts packages/sdk/test/agent-context/— 42/42 pass, 156 expect() calls, 0 fail (the full sdk agent-context suite; 37 in the intent grew to 42 with added tests, all green)bun packages/sdk/scripts/regen-agent-context-conformance.tsthengit status --porcelain— regen reproduced all 4 fixtures (14/15/20/16 files) with ZERO diff; working tree clean. Directly confirms the fixtures are the expected regen output of the template changebun /tmp/no-mistakes-evidence/01KZ1QWMA07Z4RDJASY9WRDC89/render-scaffold.ts— live assemble() render of AGENTS.md+CLAUDE.md for java-react and ts-react-tanstack stacks: corrected per-stack doctrine present in all 4 outputs, old universal 'Apply schema only throughmeta migrate' phrasing ABSENT in all 4, Flyway named in the JVM output (failures=0, exit 0)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.