Skip to content

feat: expand message ref format from 4-digit to 5-digit (9999→99999)#1

Merged
ranxianglei merged 4 commits into
masterfrom
feat/msgid-expansion
May 19, 2026
Merged

feat: expand message ref format from 4-digit to 5-digit (9999→99999)#1
ranxianglei merged 4 commits into
masterfrom
feat/msgid-expansion

Conversation

@ranxianglei
Copy link
Copy Markdown
Owner

Summary

  • Expand message ref format from m0001 (4-digit, max 9,999) to m00001 (5-digit, max 99,999)
  • Backward compatible: regex /^m(\d{4,5})$/ accepts both old 4-digit and new 5-digit refs
  • All 13 test files updated, 3 new boundary tests added

Changes

  • lib/message-ids.ts: MESSAGE_REF_WIDTH 4→5, MESSAGE_REF_MAX_INDEX 9999→99999, regex accepts 4-5 digits
  • 13 test files: all m0001m00001 format references
  • AGENTS.md: added mandatory dual-agent review for code + tests, PR workflow

Test Results

346/346 tests pass, typecheck clean

Review Checklist

  • Backward compatible (old 4-digit refs still parse correctly)
  • No as any or type suppression
  • All tests pass
  • Typecheck passes

- MESSAGE_REF_WIDTH: 4 → 5
- MESSAGE_REF_MAX_INDEX: 9999 → 99999
- MESSAGE_REF_REGEX: /^m(\d{4})$/ → /^m(\d{4,5})$/ (backward compat)
- All test files updated to 5-digit format (m00001, m00002, etc.)
- Added boundary tests for 99999 and 100000
- Kept 4-digit backward compat parse tests (m0001 still resolves)
Critical fixes:
- state.ts: migrate 4-digit refs (m0001) to 5-digit (m00001) during state loading
  Fixes lookup failure when parseBoundaryId normalizes old refs
- compress-message.ts: restore XML tag template (accidentally destroyed in prior edit)
- prompts/tool descriptions: mNNNN → mNNNNN in all LLM-visible text
- Error messages: mNNNN → mNNNNN in search.ts and message-utils.ts
- message-ids.ts: error message range 0-99999 → 1-99999
- AGENTS.md: fix duplicate section 5.3 numbering, mNNNN → mNNNNN

Tests: +4 backward compat tests (350 total, 0 failures)
@ranxianglei ranxianglei force-pushed the feat/msgid-expansion branch from 33bc110 to 5e54496 Compare May 19, 2026 00:52
@ranxianglei ranxianglei merged commit 6cbd352 into master May 19, 2026
3 checks passed
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.

1 participant