feat(issues): migration of flat issue files to the state-folder layout (phase 1, part 2) #10

Merged
neerdoc merged 32 commits from feat/phase-1-issue-migration into main 2026-11-17 04:46:27 +00:00
Owner

Part 2 of Phase 1: migration of flat issue files

Adds scripts/issue-migrate.sh, the one-time migration of flat
issues/NNNN.yaml files to issues/<state>/NNNN--<slug>.yaml required by
ADR-WULF-006 ("Migration"). A consuming repository runs it once, by the path
modules/wulf-dev/scripts/issue-migrate.sh. Part 1 (scripts and schema) is
merged; part 3 (pr.sh roadmap check) follows. Roadmap items P1-5 to P1-9 are
ticked in their own commit. The project works at effort level tool.

The script

  • Status open goes to open/, closed to done/. The lines status:,
    closed: and created: are removed, and the rest of each file stays byte for
    byte. The slug is derived from the title as in part 1, and issues/.next is
    written last.
  • Tracked files are moved with git mv, so git log --follow follows them;
    untracked files with mv. The script never commits.
  • All checks complete before the first change: arguments, tools, state table,
    root, a symlinked issues, a mixed tree, and per file the YAML, status, id
    and title. A file whose removal of the three fields would change anything
    else (a value on several lines, a quoted key, a column-0 continuation line)
    is refused, with a message, before any change.
  • A second run says "nothing to migrate" and changes nothing. A failure after
    the first change stops at once, names the file and says the tree is partly
    migrated; git restores it.

Shared code

  • scripts/lib.sh gains the shared YAML loading, the message definitions, the
    counter writing and the creation environment; issue-new.sh,
    comment-new.sh and issue-validate.sh use them. Their messages and exit
    statuses are unchanged; issue_slug now turns a newline in a title into a
    hyphen.
  • README rows for the new script and lib.sh, and the effort level line.

Design and tests

  • docs/design/issue-migration.md (DE-M1 to DE-M6, 142 lines).
  • 1,074 bats tests in total, 125 of them for the migration (issue-migrate.bats),
    with the five real flat issue files as fixtures, and additions to the root,
    symlink and configuration tests. Last run: 1,074 tests, 0 failed, 3 skipped
    (the part 1 rollback-fails-as-well branches, verified by inspection).

Audit and review

  • Scoped audit: no issues; the five real samples migrate correctly and then
    validate, except one sample whose title and body contain a non-ASCII arrow,
    which the validator reports as the ASCII rule requires
    (reports/audit-issue-migration.md).
  • Review 001 (Opus): one Medium (the removal could silently change other
    fields) and four Low, all resolved. Review 002: one Medium (a repeated key
    hides a change from the removal check) deferred as issue 0064, and one Low
    resolved. The records are in docs/reviews/phase-1-issue-migration/review-001
    and docs/reviews/phase-1-issue-migration/review-002.

Not covered

sync-managed.sh and the ci-actions issue sync; Linux; a run on a real
consuming repository.

🤖 Generated with Claude Code

## Part 2 of Phase 1: migration of flat issue files Adds `scripts/issue-migrate.sh`, the one-time migration of flat `issues/NNNN.yaml` files to `issues/<state>/NNNN--<slug>.yaml` required by ADR-WULF-006 ("Migration"). A consuming repository runs it once, by the path `modules/wulf-dev/scripts/issue-migrate.sh`. Part 1 (scripts and schema) is merged; part 3 (`pr.sh` roadmap check) follows. Roadmap items P1-5 to P1-9 are ticked in their own commit. The project works at effort level `tool`. ### The script - Status `open` goes to `open/`, `closed` to `done/`. The lines `status:`, `closed:` and `created:` are removed, and the rest of each file stays byte for byte. The slug is derived from the title as in part 1, and `issues/.next` is written last. - Tracked files are moved with `git mv`, so `git log --follow` follows them; untracked files with `mv`. The script never commits. - All checks complete before the first change: arguments, tools, state table, root, a symlinked `issues`, a mixed tree, and per file the YAML, status, id and title. A file whose removal of the three fields would change anything else (a value on several lines, a quoted key, a column-0 continuation line) is refused, with a message, before any change. - A second run says "nothing to migrate" and changes nothing. A failure after the first change stops at once, names the file and says the tree is partly migrated; git restores it. ### Shared code - `scripts/lib.sh` gains the shared YAML loading, the message definitions, the counter writing and the creation environment; `issue-new.sh`, `comment-new.sh` and `issue-validate.sh` use them. Their messages and exit statuses are unchanged; `issue_slug` now turns a newline in a title into a hyphen. - README rows for the new script and `lib.sh`, and the effort level line. ### Design and tests - `docs/design/issue-migration.md` (DE-M1 to DE-M6, 142 lines). - 1,074 bats tests in total, 125 of them for the migration (`issue-migrate.bats`), with the five real flat issue files as fixtures, and additions to the root, symlink and configuration tests. Last run: 1,074 tests, 0 failed, 3 skipped (the part 1 rollback-fails-as-well branches, verified by inspection). ### Audit and review - Scoped audit: no issues; the five real samples migrate correctly and then validate, except one sample whose title and body contain a non-ASCII arrow, which the validator reports as the ASCII rule requires (`reports/audit-issue-migration.md`). - Review 001 (Opus): one Medium (the removal could silently change other fields) and four Low, all resolved. Review 002: one Medium (a repeated key hides a change from the removal check) deferred as issue 0064, and one Low resolved. The records are in `docs/reviews/phase-1-issue-migration/review-001` and `docs/reviews/phase-1-issue-migration/review-002`. ### Not covered `sync-managed.sh` and the ci-actions issue sync; Linux; a run on a real consuming repository. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves 001 of review 001 of phase-1-issue-migration.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves 002 of review 001 of phase-1-issue-migration.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves 003 of review 001 of phase-1-issue-migration.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves 004 of review 001 of phase-1-issue-migration.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves 005 of review 001 of phase-1-issue-migration.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves 001 of review 002 of phase-1-issue-migration.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Resolves 002 of review 002 of phase-1-issue-migration.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
WulfScience-FOSS/wulf-dev!10
No description provided.