Commit c8cec49
refactor(compile): replace versioned migrations with detection-based codemods
Aligns with gh-aw's codemod model. The previous design (versioned
chain + `schema-version` field on user front matter) leaked an
internal compiler concern into user files. gh-aw — the project we
explicitly say we're inspired by in AGENTS.md — uses 41 codemods
with no version stamping; users never see a `schema-version` field.
This refactor brings ado-aw to the same model while keeping our
ergonomic compile-time autorewrite UX (gh-aw uses a separate
`gh aw fix --write` command, we don't).
Changes:
- Drop FrontMatter.schema_version field, default_schema_version fn,
and the SCHEMA_VERSION_KEY const.
- Rename src/compile/migrations/ to src/compile/codemods/. Rename
src/compile/migration_integration_test.rs to
src/compile/codemod_integration_test.rs. Rename
tests/migration_tests.rs to tests/codemod_tests.rs. Rename
docs/migrations.md to docs/codemods.md (rewritten from scratch).
- Replace Migration / MigrationContext / MigrationReport /
AppliedMigration / MIGRATIONS with Codemod / CodemodContext /
CodemodReport / AppliedCodemod / CODEMODS.
- Codemod.apply signature changes from `fn(&mut Mapping, &Ctx) ->
Result<()>` to `fn(&mut Mapping, &Ctx) -> Result<bool>` so each
codemod reports whether it actually modified the mapping.
- Simplify the runner: flat per-codemod loop, no version arithmetic,
no contiguity checks, no overflow guards, no future-version
rejection.
- Drop hoist_schema_version from reconstruct_source — no
schema-version field to hoist.
- Update parse_markdown_detailed, compile_pipeline_inner,
perform_source_rewrite_if_needed, check_pipeline, run_execute,
and compile_all_pipelines to use the codemod types and reword
their messages.
- Helpers (take_key, insert_no_overwrite, rename_key,
ConflictPolicy) are unchanged — they're as useful for codemods as
they were for migrations. rename_key already returned
Result<bool>, matching the new codemod contract.
- Drop ~13 schema-version-specific tests (registry contiguity,
future version, non-integer, etc.). Add 7 codemod-runner tests
(empty registry, all-no-op, mixed, error context, idempotency).
Black-box CLI tests reduced from 10 to 3 (deleted tests asserted
on schema-version-specific behavior that no longer exists).
PR #476 has not merged; this lands as a follow-up commit on the
same branch so users never see the schema-version concept ship.
All 1349 tests pass. PR title and body to be updated separately.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent b3bdae6 commit c8cec49
15 files changed
Lines changed: 1021 additions & 1717 deletions
File tree
- docs
- src
- compile
- codemods
- migrations
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
200 | | - | |
201 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
202 | 203 | | |
203 | 204 | | |
204 | 205 | | |
| |||
0 commit comments