Skip to content

Make the broken-prompt demo reverse a real schema migration - #158

Merged
tonibergholm-codento merged 2 commits into
mainfrom
demo-reverse-migration
Nov 20, 2026
Merged

tonibergholm-codento merged 2 commits into
mainfrom
demo-reverse-migration

Conversation

@tonibergholm-codento

Copy link
Copy Markdown
Collaborator

The broken-prompt demo is supposed to show that agentic rollback restores everything git revert cannot, including a reverse schema migration. In practice it never applied a migration. CI logged schema_version 0.0.0 → (none) at the diff step and "no migrations needed" at the rollback step. Nothing broke it: the demo predates the reverse-migration runner. The diff also compared against HEAD, which is a LangGraph checkpoint commit with no schema dimension.

Now:

  • The bad change applies 001_add_sentiment, which adds a NOT NULL column to episodes, and registers its .down.sql under .agentic/schema/.
  • Step 9 diffs the baseline against the bad commit, so the regression shows the schema change.
  • Step 10's rollback reverses the migration, using the approval token the CLI mints automatically under ADR-0019. The script then checks that the live schema is back to 0.0.0 and the column is gone, and fails otherwise.
  • The demo commands and the README walkthrough match the new output.

Proof: run-demo.sh passes end to end in 1m54s. The diff shows schema_version 0.0.0 → 001_add_sentiment, the rollback shows reverse schema migrations: 001_add_sentiment → 0.0.0, and the post-check prints 0.0.0/0. The daemon log shows the token accepted with reason="reverse_migration". cargo test --workspace passes.

Created with Claude Opus 5.5 and Claude Sonnet 5.5 in Claude Code.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ccfe9016-8143-4f1f-b6ed-9997d5aeaa36
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T12:16:46.115045Z 4eb0bda New commits
🔒 Security Review ✅ Completed 2026-11-20T12:17:51.271051Z 4eb0bda New commits
ℹ️ 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.

The bad change never touched the schema: deploy-bad-change.sh only swapped
the prompt and inserted rows, so every commit recorded schema_version 0.0.0
and the rollback printed "schema already at 0.0.0". The demo has never run a
migration since it landed in 57c66ba, before the reverse migration runner
(97e786b) existed, and nobody went back to wire it in.

The bad change now applies migration 001_add_sentiment (a NOT NULL column,
recorded in agentic_migrations) and registers its .down.sql under
.agentic/schema/. The v0.8 commit records the new version and the step 10
rollback reverses it, consuming one ADR-0019 approval token.

The diff step compared the baseline with HEAD, which by then is a LangGraph
checkpoint commit with no memory or schema dimension, so it printed
"schema_version 0.0.0 -> (none)". It now diffs against the v0.8 commit.

run-demo.sh also checks after the rollback that the live schema is back at
0.0.0 and the sentiment column is gone, so CI fails if the reversal is
skipped. README updated where it described the old output.
Use agentic resolve HEAD instead of parsing status output, assert the
migration is live before rollback so the post-rollback check means
something, and re-record demo.cast with the schema bump and reversal.
@tonibergholm-codento
tonibergholm-codento merged commit 011f29c into main Nov 20, 2026
14 checks passed
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