Fix OSError on Windows by sanitizing process recording filenames#379
Merged
dividedmind merged 2 commits intomasterfrom Jan 28, 2026
Merged
Fix OSError on Windows by sanitizing process recording filenames#379dividedmind merged 2 commits intomasterfrom
dividedmind merged 2 commits intomasterfrom
Conversation
This commit addresses and resolves several `too-many-positional-arguments` and `unused-argument` linting errors reported by pylint. The changes primarily involve adding `too-many-positional-arguments` to existing `pylint: disable` directives where the function signatures are fixed by external frameworks (Django, SQLAlchemy) or by internal design requirements (e.g., `__new__` methods, `HttpServerRequestEvent` init). Additionally, an `unused-argument` was fixed by renaming a parameter with a leading underscore to indicate its intentional non-use. These modifications ensure that the codebase adheres to the pylint standards without altering the intended functionality or API compatibility.
There was a problem hiding this comment.
Pull request overview
This PR fixes a Windows compatibility issue where process recordings fail with an OSError because the ISO 8601 timestamp format includes colons, which are invalid in Windows filenames. The fix replaces colons in the timestamp with hyphens.
Changes:
- Modified
_appmap/recording.pyto sanitize the timestamp by replacing colons with hyphens - Added a regression test to verify generated filenames don't contain colons
- Updated pylint disable comments across multiple files to include
too-many-positional-argumentsfor compatibility with newer pylint versions
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| _appmap/recording.py | Modified process recording filename generation to replace colons with hyphens in timestamps, fixing Windows compatibility |
| _appmap/test/test_recording.py | Added regression test test_process_recording_filename_is_sanitized to ensure filenames don't contain colons |
| appmap/sqlalchemy.py | Added too-many-positional-arguments to pylint disables for callback functions |
| appmap/pytest.py | Changed unused parameter name from item to _item to follow Python conventions |
| appmap/django.py | Added too-many-positional-arguments to pylint disable for database wrapper callback |
| _appmap/web_framework.py | Added too-many-positional-arguments to pylint disables for web framework functions |
| _appmap/test/test_django.py | Added too-many-positional-arguments to pylint disable for test client adaptor |
| _appmap/test/test_configuration.py | Added too-many-positional-arguments to pylint disable for test class |
| _appmap/importer.py | Added too-many-positional-arguments to pylint disable for FilterableFn.__new__ |
| _appmap/event.py | Added too-many-positional-arguments to pylint disable for HttpServerRequestEvent.__init__ |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replace colons in ISO 8601 timestamps with hyphens when generating filenames for process recordings. This prevents OSErrors on Windows systems where colons are invalid characters in filenames. Includes a regression test to verify that generated filenames do not contain colons. Also changes the format to use a dash to separate the timestamp from the PID for consistency. Fixes #377
6196ab1 to
ed76d19
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Process recordings generate a default filename incorporating a timestamp (e.g., 2023-10-27T10:00:00Z).
Problem
The ISO 8601 timestamp format includes colons (
:), which are reserved characters on Windows file systems. This caused anOSErrorwhen attempting to save process recordings on Windows machines (issue #377).Solution
This PR updates the filename generation logic in
_appmap/recording.pyto replace colons with hyphens in the timestamp string (e.g.,2023-10-27T10-00-00Z). It also changes the format to separate the PID from the timestamp with a dash for consistency, so the filenames are like2023-10-27T10-00-00Z-31337.appmap.json.Changes
_appmap/recording.py: Added.replace(":", "-")to theappmap_namegeneration._appmap/test/test_recording.py: Added a regression testtest_process_recording_filename_is_sanitizedto ensure generated filenames are valid and free of colons.-.Validation