feat: auto-update parent directory mtime on content changes (#186)#198
Open
Koan-Bot wants to merge 2 commits intocpanel:masterfrom
Open
feat: auto-update parent directory mtime on content changes (#186)#198Koan-Bot wants to merge 2 commits intocpanel:masterfrom
Koan-Bot wants to merge 2 commits intocpanel:masterfrom
Conversation
Contributor
|
Failure from CI |
Contributor
|
@Koan-Bot rebase |
Contributor
Author
|
The Branch is up to date with master (7d115e8). The CI failure was from before the fix was pushed — needs a fresh CI run. |
atoomic
approved these changes
Feb 22, 2026
When files or directories are created/removed inside a mocked directory, the parent directory's mtime and ctime are now updated to match real filesystem behavior. Instrumented operations: - file() constructor (with defined contents) - symlink() constructor (with defined target) - unlink() method - __open() when creating a new file (contents was undef) - __sysopen() with O_CREAT on non-existent file - __mkdir() and __rmdir() Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dir() creates a mock placeholder that doesn't "exist" yet (has_content=0, stat returns empty). Tests that stat the parent dir before creating children need new_dir() which calls mkdir() to make the dir exist. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8c996cb to
43e713c
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.
Summary
Fixes #186. When files or directories are created or removed inside a mocked directory, the parent directory's
mtimeandctimeare now automatically updated to match real Linux filesystem behavior.What changed
Added
_update_parent_dir_times($path)helper that finds the mocked parent directory and bumps itsmtime/ctimetotime().Instrumented these operations:
file()constructor — when file has defined contentssymlink()constructor — when symlink has defined targetunlink()method — when file/symlink is removed__open()— when opening for write creates a new file (contents was previouslyundef)__sysopen()— withO_CREATon non-existent file__mkdir()/__rmdir()— directory creation/removalWhat didn't change
undefcontents (nonexistent mocks) don't update parent mtimeTest coverage
New test file
t/dir_mtime.twith 10 subtests covering all instrumented operations, edge cases (no parent mock, existing file writes), andctimeco-update.🤖 Generated with Claude Code