Skip to content

Conversation

@dividedmind
Copy link
Contributor

@dividedmind dividedmind commented Jan 26, 2026

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 an OSError when attempting to save process recordings on Windows machines (issue #377).

Solution

This PR updates the filename generation logic in _appmap/recording.py to replace colons with hyphens in the timestamp string (e.g., 2023-10-27T10-00-00Z).

Changes

  • _appmap/recording.py: Added .replace(":", "-") to the appmap_name generation.
  • _appmap/test/test_recording.py: Added a regression test test_process_recording_filename_is_sanitized to ensure generated filenames are valid and free of colons.

Validation

  • Verified that new tests pass locally.
  • Confirmed the fix addresses the Windows path compatibility issue.

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.
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.

Fixes #377
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.py to 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-arguments for 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.

iso_time = now.isoformat(timespec="seconds").replace("+00:00", "Z")
process_id = os.getpid()
appmap_name = f"{iso_time}_{process_id}"
appmap_name = f"{iso_time}-{process_id}".replace(":","-")
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

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

This line makes two changes that should be documented separately:

  1. Replaces colons in the timestamp with hyphens (to fix Windows compatibility)
  2. Changes the separator between timestamp and process_id from underscore to hyphen

The PR description only mentions the first change. While both changes work correctly, the separator change appears to be unintentional or at least undocumented.

Additionally, the suggested fix in issue #377 was to remove colons entirely using .replace(':', ''), but this implementation replaces them with hyphens instead. Both approaches are valid for Windows compatibility, but this deviation from the suggested fix should be acknowledged.

Consider either:

  • Reverting the separator to underscore: f"{iso_time.replace(':', '-')}_{process_id}"
  • Or documenting why the hyphen separator is preferred over underscore

Copilot uses AI. Check for mistakes.
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.

2 participants