Skip to content

fix(deprecation): emit [[pre-*]] blocks when migrating table form - #2151

Merged
max-sixty merged 2 commits into
mainfrom
deprecation-table
Apr 13, 2026
Merged

max-sixty merged 2 commits into
mainfrom
deprecation-table

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Summary

  • Pre-* table-form migration now emits [[pre-merge]] array-of-tables blocks instead of an inline pre-merge = [{...}, {...}] pipeline, matching the block form taught in docs(aliases): teach [[aliases.NAME]] pipeline blocks #2144 for [[aliases.NAME]].
  • Sections stay where the user wrote them: iterate pre-* keys in document order and replace via get_mut rather than remove + insert (which appended at the end).

Generated diff before/after:

-[pre-merge]
-test = "cargo test"
-lint = "cargo clippy"
+[[pre-merge]]
+test = "cargo test"
+
+[[pre-merge]]
+lint = "cargo clippy"

Test plan

  • cargo test --lib config::deprecation (139 passed)
  • cargo test --test integration config_show (97 passed)
  • Re-accepted two snapshots (snapshot_migrate_pre_hook_table_form, config_show_displays_pre_hook_table_form_deprecation)

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 2 commits April 12, 2026 18:17
The pre-* table form migration produced an inline pipeline
(`pre-merge = [{ test = "..." }, { lint = "..." }]`), which packed every
named step onto one long line. Users reviewing the generated `.new`
file had to eyeball a dense value instead of reading block-structured
TOML that mirrors the source they wrote.

Emit `toml_edit::ArrayOfTables` so each step becomes its own
`[[pre-merge]]` block — the same block form taught for
`[[aliases.NAME]]` in 3f44cb5. Iterate keys in document order and
replace the item in place via `get_mut` so migrated sections stay where
they were instead of being appended after unrelated sections.

Co-Authored-By: Claude <[email protected]>
# Conflicts:
#	tests/snapshots/integration__integration_tests__config_show__config_show_displays_pre_hook_table_form_deprecation.snap
@max-sixty
max-sixty merged commit 82a8d71 into main Apr 13, 2026
24 checks passed
@max-sixty
max-sixty deleted the deprecation-table branch April 13, 2026 01:32
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.

2 participants