Skip to content

ci-assign-id --help says "no file rename"; the command renames files #507

Description

@explosivebit

What is wrong

forgeplan ci-assign-id --help describes the command as rewriting frontmatter only:

Walks .forgeplan/**/*.md in --head, finds candidates with assigned_number: null, computes
next = max(assigned_number)+1 per kind from --base git ref, rewrites frontmatter (no file
rename - Phase 2.1
).

Source of that string: crates/forgeplan-cli/src/main.rs:770-777.

On 0.37.0 the command does rename. A fresh assignment reports action: "renamed_and_assigned" and
the file is moved from <kind>-<slug>.md to <KIND>-<NNN>-<slug>.md (via git mv with a
std::fs::rename fallback). The module header of the implementation documents the later phase -
crates/forgeplan-cli/src/commands/ci_assign_id.rs:33-48 (Phase 2.2) - and apply_plan
(ci_assign_id.rs:758-987) performs the rename. Unit tests assert the action at
ci_assign_id.rs:2493-2522 and 2729-2733.

In other words: the help string is a Phase 2.1 statement that survived into a Phase 2.2 binary.

Evidence

Reproduced on 0.37.0 in a throwaway git workspace:

$ forgeplan ci-assign-id --head HEAD --base HEAD --json
  "assignments": [ { "slug": "prd-widget-auth",
                     "action": "renamed_and_assigned",
                     "assigned_number": 1,
                     "path": ".../PRD-001-widget-auth.md" } ]

$ ls .forgeplan/prds/
PRD-001-widget-auth.md          # was prd-widget-auth.md
  • help string: main.rs:770-777; implementation: ci_assign_id.rs:33-48, 758-987
  • documented behaviour mismatch is also acknowledged in
    website/src/content/docs/docs/cli/ci-assign-id.md, which describes the rename it observes rather
    than the help text it is given

Fix

Drop "no file rename - Phase 2.1" from the description, or state the rename. A caller who scripted
around "frontmatter only" will find their paths rewritten.

Revisit trigger

Act if any release note describes ci-assign-id as frontmatter-only, or if a downstream script
(hooks, other workflows) resolves artifact paths before running it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions