@@ -80,9 +80,10 @@ function runTests() {
8080 assert . strictEqual ( result . shortId , 'abcdef12345678' ) ;
8181 } ) ) passed ++ ; else failed ++ ;
8282
83- if ( test ( 'rejects short IDs less than 8 chars' , ( ) => {
83+ if ( test ( 'accepts short IDs under 8 chars' , ( ) => {
8484 const result = sessionManager . parseSessionFilename ( '2026-02-01-abc-session.tmp' ) ;
85- assert . strictEqual ( result , null ) ;
85+ assert . ok ( result ) ;
86+ assert . strictEqual ( result . shortId , 'abc' ) ;
8687 } ) ) passed ++ ; else failed ++ ;
8788
8889 // parseSessionMetadata tests
@@ -584,9 +585,16 @@ src/main.ts
584585 // parseSessionFilename edge cases
585586 console . log ( '\nparseSessionFilename (additional edge cases):' ) ;
586587
587- if ( test ( 'rejects uppercase letters in short ID' , ( ) => {
588+ if ( test ( 'accepts uppercase letters in short ID' , ( ) => {
588589 const result = sessionManager . parseSessionFilename ( '2026-02-01-ABCD1234-session.tmp' ) ;
589- assert . strictEqual ( result , null , 'Uppercase letters should be rejected' ) ;
590+ assert . ok ( result , 'Uppercase letters should be accepted' ) ;
591+ assert . strictEqual ( result . shortId , 'ABCD1234' ) ;
592+ } ) ) passed ++ ; else failed ++ ;
593+
594+ if ( test ( 'accepts underscores in short ID' , ( ) => {
595+ const result = sessionManager . parseSessionFilename ( '2026-02-01-ChezMoi_2-session.tmp' ) ;
596+ assert . ok ( result , 'Underscores should be accepted' ) ;
597+ assert . strictEqual ( result . shortId , 'ChezMoi_2' ) ;
590598 } ) ) passed ++ ; else failed ++ ;
591599
592600 if ( test ( 'accepts hyphenated short IDs (extra segments)' , ( ) => {
@@ -1916,20 +1924,22 @@ file.ts
19161924 'Year 100+ is not affected by the 0-99 → 1900-1999 mapping' ) ;
19171925 } ) ) passed ++ ; else failed ++ ;
19181926
1919- // ── Round 110: parseSessionFilename rejects uppercase IDs (regex is [a-z0-9]) ──
1920- console . log ( '\nRound 110: parseSessionFilename (uppercase ID — regex [a-z0-9]{8,} rejects [A-Z]):' ) ;
1921- if ( test ( 'parseSessionFilename rejects filenames with uppercase characters in short ID' , ( ) => {
1922- // SESSION_FILENAME_REGEX uses [a-z0-9]{8,} — strictly lowercase
1927+ // ── Round 110: parseSessionFilename accepts mixed-case IDs ──
1928+ console . log ( '\nRound 110: parseSessionFilename (mixed-case IDs are accepted):' ) ;
1929+ if ( test ( 'parseSessionFilename accepts filenames with uppercase characters in short ID' , ( ) => {
19231930 const upperResult = sessionManager . parseSessionFilename ( '2026-01-15-ABCD1234-session.tmp' ) ;
1924- assert . strictEqual ( upperResult , null ,
1925- 'All-uppercase ID should be rejected by [a-z0-9]{8,}' ) ;
1931+ assert . notStrictEqual ( upperResult , null ,
1932+ 'All-uppercase ID should be accepted' ) ;
1933+ assert . strictEqual ( upperResult . shortId , 'ABCD1234' ) ;
1934+
19261935 const mixedResult = sessionManager . parseSessionFilename ( '2026-01-15-AbCd1234-session.tmp' ) ;
1927- assert . strictEqual ( mixedResult , null ,
1928- 'Mixed-case ID should be rejected by [a-z0-9]{8,}' ) ;
1929- // Confirm lowercase is accepted
1936+ assert . notStrictEqual ( mixedResult , null ,
1937+ 'Mixed-case ID should be accepted' ) ;
1938+ assert . strictEqual ( mixedResult . shortId , 'AbCd1234' ) ;
1939+
19301940 const lowerResult = sessionManager . parseSessionFilename ( '2026-01-15-abcd1234-session.tmp' ) ;
19311941 assert . notStrictEqual ( lowerResult , null ,
1932- 'All-lowercase ID should be accepted' ) ;
1942+ 'All-lowercase ID should still be accepted' ) ;
19331943 assert . strictEqual ( lowerResult . shortId , 'abcd1234' ) ;
19341944 } ) ) passed ++ ; else failed ++ ;
19351945
@@ -2196,36 +2206,34 @@ file.ts
21962206 }
21972207 } ) ) passed ++ ; else failed ++ ;
21982208
2199- // ── Round 117: parseSessionFilename with uppercase short ID — regex rejects [A-Z] ──
2200- console . log ( '\nRound 117: parseSessionFilename (uppercase short ID — regex [a-z0-9] rejects uppercase):' ) ;
2201- if ( test ( 'parseSessionFilename rejects uppercase short IDs because regex uses [a-z0-9] not [a-zA-Z0-9]' , ( ) => {
2202- // The regex: /^(\d{4}-\d{2}-\d{2})(?:-([a-z0-9]{8,}))?-session\.tmp$/
2203- // Note: [a-z0-9] — lowercase only
2204-
2205- // All uppercase — rejected
2209+ // ── Round 117: parseSessionFilename accepts uppercase, underscores, and short IDs ──
2210+ console . log ( '\nRound 117: parseSessionFilename (uppercase, underscores, and short IDs are accepted):' ) ;
2211+ if ( test ( 'parseSessionFilename accepts uppercase short IDs, underscores, and 7-char names' , ( ) => {
22062212 const upper = sessionManager . parseSessionFilename ( '2026-01-15-ABCDEFGH-session.tmp' ) ;
2207- assert . strictEqual ( upper , null ,
2208- 'All-uppercase ID should be rejected (regex uses [a-z0-9])' ) ;
2213+ assert . notStrictEqual ( upper , null ,
2214+ 'All-uppercase ID should be accepted' ) ;
2215+ assert . strictEqual ( upper . shortId , 'ABCDEFGH' ) ;
22092216
2210- // Mixed case — rejected
22112217 const mixed = sessionManager . parseSessionFilename ( '2026-01-15-AbCdEfGh-session.tmp' ) ;
2212- assert . strictEqual ( mixed , null ,
2213- 'Mixed-case ID should be rejected (uppercase chars not in [a-z0-9])' ) ;
2218+ assert . notStrictEqual ( mixed , null ,
2219+ 'Mixed-case ID should be accepted' ) ;
2220+ assert . strictEqual ( mixed . shortId , 'AbCdEfGh' ) ;
22142221
2215- // All lowercase — accepted
22162222 const lower = sessionManager . parseSessionFilename ( '2026-01-15-abcdefgh-session.tmp' ) ;
22172223 assert . notStrictEqual ( lower , null , 'All-lowercase ID should be accepted' ) ;
22182224 assert . strictEqual ( lower . shortId , 'abcdefgh' ) ;
22192225
2220- // Uppercase hex-like (common in UUIDs) — rejected
22212226 const hexUpper = sessionManager . parseSessionFilename ( '2026-01-15-A1B2C3D4-session.tmp' ) ;
2222- assert . strictEqual ( hexUpper , null ,
2223- 'Uppercase hex ID should be rejected' ) ;
2227+ assert . notStrictEqual ( hexUpper , null , 'Uppercase hex ID should be accepted' ) ;
2228+ assert . strictEqual ( hexUpper . shortId , 'A1B2C3D4' ) ;
2229+
2230+ const underscored = sessionManager . parseSessionFilename ( '2026-01-15-ChezMoi_2-session.tmp' ) ;
2231+ assert . notStrictEqual ( underscored , null , 'IDs with underscores should be accepted' ) ;
2232+ assert . strictEqual ( underscored . shortId , 'ChezMoi_2' ) ;
22242233
2225- // Lowercase hex — accepted
2226- const hexLower = sessionManager . parseSessionFilename ( '2026-01-15-a1b2c3d4-session.tmp' ) ;
2227- assert . notStrictEqual ( hexLower , null , 'Lowercase hex ID should be accepted' ) ;
2228- assert . strictEqual ( hexLower . shortId , 'a1b2c3d4' ) ;
2234+ const shortName = sessionManager . parseSessionFilename ( '2026-01-15-homelab-session.tmp' ) ;
2235+ assert . notStrictEqual ( shortName , null , '7-character names should be accepted' ) ;
2236+ assert . strictEqual ( shortName . shortId , 'homelab' ) ;
22292237 } ) ) passed ++ ; else failed ++ ;
22302238
22312239 // ── Round 119: parseSessionMetadata "Context to Load" code block extraction ──
0 commit comments