Skip to content

Render mighost 0.5 ghost classification and add RBW_FORCE#2

Merged
amberpixels merged 2 commits into
mainfrom
ghost-classification
Jul 23, 2026
Merged

Render mighost 0.5 ghost classification and add RBW_FORCE#2
amberpixels merged 2 commits into
mainfrom
ghost-classification

Conversation

@amberpixels

Copy link
Copy Markdown
Owner

What

Teaches db:migrate:status to read the ghost classification mighost 0.5 provides, fixes a branch-badge leak that classification made reachable, and adds an RBW_FORCE escape hatch for formatting auto-detection.

Ghost classification

Ghost data now comes from Mighost::API.orphaned_migrations (one call, indexed by version) instead of per-version find_or_recover_snapshot. Each ghost row carries the most informative badge available, by precedence:

  1. ≡ <version> - the migration was re-timestamped and lives on under another applied version. The row also gets a calmer 🪦 status instead of 👻, since it's stale bookkeeping rather than a lost migration.
  2. ⌥ <branch> / ⌥ₜ<branch> - unchanged branch attribution.
  3. ✂ deleted in:<sha> - the commit that removed the file, when no branch still holds it.

Because detection goes through mighost's orphan detector, db:migrate:status now honors dismissals and hide_superseded for the first time: a suppressed ghost renders as plain NO FILE. Versions the detector lists without a stored snapshot still fall back to live git/worktree recovery, so fresh clones keep working with zero setup.

Branch badge leak fix

The ghost branch tag was assigned inside a conditional and never reset per row, so a branchless ghost inherited the previous ghost's badge. Unreachable while mighost always guessed a branch; mighost 0.5 makes nil branches the normal case. The tag is now built fresh per row, and a regression spec renders two ghost rows to prove the second stays clean.

RBW_FORCE

Railbow.plain? returns true under CLAUDECODE, NO_COLOR, CI, or non-tty output, with no way back in (RBW_PLAIN=0 is just falsy). RBW_FORCE=1 now overrides all auto-detection - useful for capturing formatted output to a file or letting an agent inspect the real rendering. An explicit RBW_PLAIN=1 still wins. Documented in RBW_HELP and the README env table.

Testing

  • Railbow.plain? truth table across RBW_PLAIN / RBW_FORCE / NO_COLOR / CLAUDECODE / CI / tty.
  • Tag precedence unit specs (superseded > branch > deleted > none).
  • Leak regression: two ghost rows rendered in order, second (branchless) carries no badge - fails on main.
  • Fallback path: version listed without a filename triggers live recovery; version absent from detection does not and renders plain NO FILE.

just lint and bundle exec rspec (323 examples) pass.

Ghost rows in db:migrate:status now come from
Mighost::API.orphaned_migrations instead of per-version snapshot
recovery: a superseded (re-timestamped) ghost renders with a calmer
🪦 status and a "≡ <version>" badge pointing at its successor, a
branchless deleted ghost shows "✂ deleted in:<sha>", and ghosts
dismissed or hidden via hide_superseded render as plain NO FILE.
Live git/worktree recovery still covers versions without a stored
snapshot, so fresh clones keep working with zero setup.

Also fixes a stale branch badge leaking from one ghost row onto the
next branchless one - the tag local was never reset per iteration,
which was unreachable while mighost always guessed a branch.

RBW_FORCE=1 forces formatting past NO_COLOR, CI, non-tty, and LLM
agent detection; an explicit RBW_PLAIN=1 still wins.
@amberpixels
amberpixels force-pushed the ghost-classification branch from 971e8e8 to b16a73a Compare July 23, 2026 10:38
@amberpixels
amberpixels merged commit 7ed3091 into main Jul 23, 2026
4 checks passed
@amberpixels
amberpixels deleted the ghost-classification branch July 23, 2026 10:38
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