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