Skip to content

fix(app): shorten export filenames for long session titles - #60347

Merged
Tarquinen merged 2 commits into
anomalyco:devfrom
craigalbrecht:export-filename-cap
Nov 4, 2026
Merged

Tarquinen merged 2 commits into
anomalyco:devfrom
craigalbrecht:export-filename-cap

Conversation

@craigalbrecht

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #54721

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Caps the cleaned export filename at 250 characters before trimming trailing dashes, leaving room for .json within the 255-byte filesystem component limit. This prevents long session titles from producing unsavable export filenames.

The added regression uses a 300-character title and checks the final byte length and extension.

How did you verify your code works?

  • The new regression failed without the cap and passed with it.
  • cd packages/app && bun test src/session/commands/export.test.ts: 7 passed, 0 failed.
  • App typecheck: 0 errors across 1,733 files.
  • Root bun run typecheck with Node 22: 35/35 tasks passed.

Visual

N/A — no visual change.

Screenshots / recordings

N/A — filename generation correctness.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to merge. On the base, I reproduced the problem with the new test: a 300-character title produced a 305-byte filename. With this change the name is capped at 255 bytes and still ends in .json. I also checked a few edge cases: a dash right at the cut point is trimmed, and titles with only non-ASCII characters or symbols still fall back to the session id. Since the cleaned name is plain ASCII, the 250-character cap is also a 250-byte cap. The export tests pass (7/7) and tsc -b passes for packages/app.

Public API is unchanged: this only affects the suggested export filename on your machine.

No concerns.

@Tarquinen Tarquinen changed the title fix(app): cap export filenames within filesystem limit fix(app): shorten export filenames for long session titles Nov 4, 2026
@Tarquinen
Tarquinen enabled auto-merge (squash) November 4, 2026 21:50

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commits drop the code comment and make the test check the exact filename. The fix itself is unchanged and still works: the updated test fails on the base and passes here (7/7), and tsc -b passes for packages/app.

The public API is unchanged.

No concerns.

@Tarquinen
Tarquinen merged commit ded4c29 into anomalyco:dev Nov 4, 2026
22 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.

Long session titles produce unsavable export filenames

2 participants