Skip to content

fix: Consolidate-Tasks preserves dates and chronological order - #175

Open
MarkMichaelis wants to merge 1 commit into
mainfrom
fix/174-consolidate-date-prefix
Open

fix: Consolidate-Tasks preserves dates and chronological order#175
MarkMichaelis wants to merge 1 commit into
mainfrom
fix/174-consolidate-date-prefix

Conversation

@MarkMichaelis

Copy link
Copy Markdown
Contributor

Summary

Consolidate-Tasks.ps1 stripped the leading YYYY-MM-DD- prefix from every
imported artifact via Get-FeatureSlug, discarding the only chronological
ordering signal that legacy design notes / PRDs carried. The date was recorded
nowhere -- a real run collapsed seven dated design notes into undated slugs.

Changes

  • Preserve an embedded YYYY-MM-DD- prefix on the destination name so the
    tasks/ listing sorts chronologically.
  • Synthesize a date for undated sources via new -InsertDatePrefix switch
    (default on): most-recent git commit date, falling back to the file's
    last-write time. Pass -InsertDatePrefix:$false to opt out.
  • Add a Source Date column to tasks/MIGRATION.md and sort rows
    chronologically.
  • New helpers Get-DatePrefix, Get-GitDate, Get-SourceDate with unit
    • integration tests (43 passing). Updated comment-based help and
      tasks/README.md.

Scope decision (needs sign-off)

New @prd / @plan artifacts intentionally keep the bare <feature> slug
(no date, no issue number in the filename) so the agents can resolve them by
exact path. Their ordering/identity lives in the branch (feat/<issue#>-...),
issue, and git history -- not the filename. Date-prefixing new files would
require switching the agents to glob lookups, a cross-cutting change to the
upstream naming convention affecting all consumers. Deliberately not done
here. See the open question below.

Open question

Should newly created PRDs/plans also carry a sortable prefix (date or issue
number) in the filename, accepting the agent-lookup change? Flagging for a human
decision rather than guessing.

Test

Invoke-Pester -Path .\Consolidate-Tasks.Tests.ps1

Closes #174

Get-FeatureSlug stripped the leading YYYY-MM-DD- prefix from every
imported artifact, discarding the only ordering signal legacy design
notes and PRDs carried. The date was recorded nowhere.

- Preserve an embedded YYYY-MM-DD- prefix on the destination name.
- Add -InsertDatePrefix (default on): for sources lacking an embedded
  date, synthesize a prefix from the most recent git commit date,
  falling back to the file's last-write time.
- Add a Source Date column to tasks/MIGRATION.md; sort rows
  chronologically.
- New helpers Get-DatePrefix, Get-GitDate, Get-SourceDate; tests for
  each plus integration coverage; update help and tasks/README.md.

New agent-created PRDs/plans intentionally keep the bare <feature>
slug so the @prd/@plan agents can resolve them by exact path.

Closes #174

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MarkMichaelis

Copy link
Copy Markdown
Contributor Author

Decision: revive, but expect rework rather than a rebase.

The bug is still live. Consolidate-Specs.ps1 strips the date prefix today:

$stem = $stem -replace "^\d{4}-\d{2}-\d{2}-", ""

Nothing else records it, so the ordering signal is still being destroyed — the PR body's "seven dated design notes collapsed into undated slugs" remains reproducible.

The friction is that the script was renamed (Consolidate-Tasks.ps1Consolidate-Specs.ps1) since this branch was cut, so this will not apply cleanly. Three files, one regex plus tests: porting the fix is cheaper than rebasing the branch.

Assessed alongside #250 (revive) and #161 (closed). Recorded here because the decision was made in a session that ended before acting on it.

@MarkMichaelis

Copy link
Copy Markdown
Contributor Author

Flagging for closure — this PR cannot be rebased, because all three files it edits no longer exist:

File Status
Consolidate-Tasks.ps1 renamed to Consolidate-Specs.ps1 (#184)
Consolidate-Tasks.Tests.ps1 same rename
tasks/README.md tasks/ retired for docs/specs + docs/designs (#182)

Opened 2026-05-31; both structural changes landed after it. There is nothing to rebase onto.

The issue it fixes, #174, may still be valid — Consolidate-Specs.ps1:103 does a bare Sort-Object with no key, which would sort lexically and is consistent with the reported "discards chronological order" symptom. But that is a suspicion, not a verified finding: #174 was written against the pre-rename script and nobody has confirmed the defect survived.

Suggested: close this PR as superseded by the rename, leave #174 open, and re-confirm the bug reproduces against Consolidate-Specs.ps1 before writing a fix. Not closing it here — that is the owner's call.

Tracked in #465.

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.

fix: Consolidate-Tasks discards date prefix and chronological order

1 participant