Skip to content

Conversation

@EspenAlbert
Copy link
Owner

@EspenAlbert EspenAlbert commented Feb 12, 2026

Summary

  • Guard against ValueError in _handle_sync for files with extensions not in EXTENSION_COMMENT_MAP or FILENAME_COMMENT_MAP
  • Files without a known comment config (e.g., .json, .cfg) caused a hard crash during sync because get_comment_config() raises on unknown extensions
  • Files with unknown extensions are now skipped in sync mode with a warning log, since headers and sections require comment syntax to function

Details

_handle_sync calls sections.has_sections(), sections.wrap_in_synced_section(), and header.add_header(), all of which call get_comment_config(path) internally. For file extensions not in the known maps, this raises a ValueError and crashes the entire copy command.

The fix adds an early return at the top of _handle_sync using header.has_known_comment_prefix(dest_path). This is consistent with _find_files_with_config which already had the same guard for orphan cleanup.

SCAFFOLD and REPLACE sync modes are unaffected -- they don't need comment configs.

@EspenAlbert EspenAlbert changed the title todo update me with the PR title for branch file-extension-avoid-hard-errors fix(copy): skip sync for files with unknown comment extensions instead of crashing Feb 12, 2026
@EspenAlbert EspenAlbert marked this pull request as ready for review February 12, 2026 18:18
@EspenAlbert EspenAlbert merged commit bd81c2e into main Feb 12, 2026
14 checks passed
@EspenAlbert EspenAlbert deleted the file-extension-avoid-hard-errors branch February 12, 2026 18:21
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