Skip to content

fix: honor target filesystem filename limits - #2118

Closed
Synvoya wants to merge 1 commit into
Graphify-Labs:v8from
Synvoya:agent/filesystem-aware-filename-limits
Closed

Synvoya wants to merge 1 commit into
Graphify-Labs:v8from
Synvoya:agent/filesystem-aware-filename-limits

Conversation

@Synvoya

@Synvoya Synvoya commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2109.

Problem

Export filename capping assumes the conventional 255-byte NAME_MAX. eCryptfs (Ubuntu's "encrypt my home folder") reports PC_NAME_MAX=143 because of its filename-encryption overhead, so a 150–200 byte label still produces a name the filesystem rejects and graphify export obsidian / export wiki abort with ENAMETOOLONG.

Change

Rebased onto current v8 (0.9.92) and reworked on top of stem_filename_budget() from #2656, which every Obsidian, canvas, and wiki stem already goes through. The original version of this PR added a parallel helper; that is gone.

  • stem_filename_budget() now also caps the budget on POSIX at the destination filesystem's PC_NAME_MAX, minus the caller's reserve (collision suffix / _COMMUNITY_ prefix) and .md.
  • When the export directory does not exist yet, it asks the nearest existing ancestor. If pathconf is unavailable or errors, the budget is unchanged.
  • At the conventional 255 the budget is still 200, so output on ordinary filesystems is byte-for-byte unchanged. The Windows MAX_PATH branch is untouched.

Regression coverage

  • Budget math (tests/test_export_path_length.py): shrinks to fit NAME_MAX=143, stays 200 at 255, asks the nearest existing ancestor, and falls back to the limit when pathconf fails.
  • End to end with NAME_MAX=143: every Obsidian note, canvas file ref, and wiki article name is at most 143 bytes, long duplicate labels stay case-insensitively unique, and wiki links still resolve on disk.
  • Negative control: with graphify/paths.py reverted to v8, the 5 new behavioural tests fail.

Validation

Commands run locally (Python 3.12.8, macOS):

  • python -m pytest tests/test_export_path_length.py tests/test_obsidian_filename_cap.py tests/test_wiki.py tests/test_wiki_link_filename_parity.py tests/test_wiki_truncation_indicator.py: 78 passed, 3 skipped
  • python -m pytest tests: 8020 passed, 326 skipped, 10 failed
  • Same full suite on unmodified v8 (86c57be): 8013 passed, 326 skipped, 10 failed. The 10 failing tests are identical with and without this change. They are in files this PR does not touch (test_ext_tagged_id_clash.py, test_install_references.py, test_languages.py::test_markdown_nested_frontmatter_survives, test_skill_no_backtick_substitution.py) and look specific to my local environment.
  • ruff check on changed files: clean. pyright graphify/paths.py: 0 errors.

Limitations

@Synvoya
Synvoya marked this pull request as ready for review July 27, 2026 02:41
@Synvoya

Synvoya commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@safishamsi, when you have review bandwidth, could you please prioritize this small issue-backed set: #2118 fixes target-filesystem filename limits (#2109), #2117 suppresses false warnings for intentionally skipped files (#2107), and #1818 prevents Go type-set constraints from becoming false embeds. All three are ready for review, mergeable, and fully green. Happy to adjust or rebase anything you prefer.

The 200-byte stem cap from Graphify-Labs#1094 assumes the conventional 255-byte
NAME_MAX. eCryptfs (Ubuntu's "encrypt my home folder") reports 143
because of its filename-encryption overhead, so a 150-200 byte label
still produced a name the filesystem rejects and `graphify export
obsidian` / `export wiki` aborted with ENAMETOOLONG.

stem_filename_budget() already sizes every Obsidian, canvas and wiki
stem against the destination (Graphify-Labs#2655), but returned the limit unchanged
on POSIX. It now also caps the budget at the destination filesystem's
PC_NAME_MAX less the caller's reserve and the ".md" extension, asking
the nearest existing ancestor when the export directory does not exist
yet. At the conventional 255 the budget is still 200, so output on
ordinary filesystems is byte-for-byte unchanged.

Closes Graphify-Labs#2109

Co-Authored-By: Claude <[email protected]>
@Synvoya
Synvoya force-pushed the agent/filesystem-aware-filename-limits branch from 4630ff4 to 2325ce3 Compare October 19, 2026 08:03
@Synvoya
Synvoya requested a review from safishamsi as a code owner October 19, 2026 08:03
@Synvoya

Synvoya commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #5315: rebased onto current v8 (340268a), re-verified on Python 3.11 (pytest, ruff, pyright), and the description moved to the current template. Closing this one so there is a single PR to review.

@Synvoya Synvoya closed this Nov 18, 2026
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.

_cap_filename's hardcoded limit=200 assumes NAME_MAX=255; breaks on eCryptfs (real limit can be ~143 bytes)

1 participant