Changelog System Refactoring โ
Date: 2025-01-22
Status: โ
Complete (Structure & Documentation)
Related Documentation: docs/engineering/guides/CHANGELOG_WORKFLOW.md
Overview โ
The changelog system has been refactored from a single monolithic docs/CHANGELOG.md file to a modular, date-based structure with separate dev and prod directories. This eliminates merge conflicts and makes maintenance easier.
What Changed โ
Old System โ
- Single file:
docs/CHANGELOG.md - Daily sections:
## [DEV] - YYYY-MM-DD - Grew to 780+ lines
- Difficult to manage in production promotion workflows
- All changes in one file = merge conflicts
New System โ
- Three directories:
docs/changelogs/dev/โ Active development changesdocs/changelogs/prod/โ Production releasesdocs/changelogs/archived/โ Historical releases
- Individual dated files per version:
dev-01.22.2025-v0.1.0.md - Immutable dev files (never deleted, only marked when merged)
- Clear audit trail for what was promoted to prod
File Structure โ
docs/changelogs/
โโโ dev/
โ โโโ dev-01.22.2025-v0.1.0.md # Today's dev changes
โ โโโ dev-01.21.2025-v0.1.0_merged.md # Marked when promoted to prod
โ โโโ dev-01.20.2025-v0.1.0_merged.md # Marked when promoted to prod
โ โโโ ...
โโโ prod/
โ โโโ prod-01.15.2025-v0.1.0.md # Consolidated v0.1.0 prod release
โ โโโ prod-01.10.2025-v0.0.2.md # Previous prod release
โ โโโ ...
โโโ archived/
โ โโโ archived-2024-v0.0.1-final.md # Old releases
โโโ README.md # This structure & workflow guideWorkflow โ
Daily Development Changes โ
- Developer makes changes to feature branch
- Before committing, creates/updates a file in
docs/changelogs/dev/ - File naming:
dev-MM.DD.YYYY-v{version}.md - Adds entry under appropriate category (
Added,Changed,Fixed, etc.) - Commits the changelog + code changes
Key rule: Dev files are never deleted or renamedโonly marked when merged.
Production Promotion (GitHub Action) โ
When code is merged to main and ready for production:
npm run changelog:consolidateThis command:
- Scans
docs/changelogs/dev/for all files matching the current version - Aggregates content into a single prod changelog entry
- Creates
docs/changelogs/prod/prod-MM.DD.YYYY-v{version}.mdwith consolidated changes - Marks each dev file with
_mergedsuffix (e.g.,dev-01.22.2025-v0.1.0_merged.md) - Archives old prod releases if needed
- Ready for deployment
The "_merged" Marker โ
Purpose: Track which dev changelogs have been promoted to production
Implementation options:
Option A: Filename suffix (simpler) โ
dev-01.22.2025-v0.1.0_merged.md # After consolidation- โ Easy to spot in file browser
- โ Simple for GitHub Actions
- โ Preserves full changelog history
Option B: Metadata file (structured) โ
docs/changelogs/manifest.json{
"merges": [
{
"version": "v0.1.0",
"production_date": "2025-01-15",
"merged_dev_files": [
"dev-01.22.2025-v0.1.0",
"dev-01.21.2025-v0.1.0"
]
}
]
}Recommendation: Use Option A (filename suffix) for simplicity. It's visible, self-documenting, and doesn't require additional metadata files.
GitHub Action to Implement โ
A new workflow should be created: .github/workflows/changelog-consolidate.yml
Triggers:
- Manual dispatch (via
gh workflow run) - Or triggered as part of promotion-to-prod workflow
Steps:
- Validate all dev changelog files for current version
- Aggregate content into a single prod entry
- Rename dev files with
_mergedsuffix - Create/update prod changelog
- Archive old prod releases
- Commit changes to
mainbranch - Create release notes from prod changelog
Pseudocode:
# Find all dev files for version
dev_files=$(find docs/changelogs/dev -name "dev-*-v0.1.0.md" | sort)
# Aggregate content
aggregate_content() { /* merge all sections */ }
# Create prod file
prod_file="docs/changelogs/prod/prod-$(date +%m.%d.%Y)-v0.1.0.md"
echo "$aggregated_content" > "$prod_file"
# Mark dev files as merged
for file in $dev_files; do
mv "$file" "${file%.md}_merged.md"
done
# Commit
git add docs/changelogs/
git commit -m "Release v0.1.0: Consolidate changelogs"Migration from Old System โ
The old docs/CHANGELOG.md still exists and can be:
- Archived to
docs/changelogs/archived/for historical reference - Or gradually replaced as new dev entries are added
Recommendation: Move docs/CHANGELOG.md to docs/changelogs/archived/CHANGELOG-historical.md once the new system is fully adopted.
Documentation Updated โ
โ
New: docs/engineering/guides/CHANGELOG_WORKFLOW.md
โ
Updated: .github/copilot-instructions.md โ Changelog Rules section
References โ
- Keep a Changelog: https://keepachangelog.com/en/1.1.0/
- Semantic Versioning: https://semver.org/spec/v2.0.0.html
Next Steps โ
- โ Create directory structure
- โ Create README and documentation
- โ Update copilot instructions
- โณ Implement GitHub Action for
changelog:consolidate - โณ Test locally with dev files
- โณ Archive old
docs/CHANGELOG.md