Skip to content

Commit a96adb3

Browse files
ovaistariqclaude
andcommitted
fix: Update directory mtime when re-listing already-sealed directories
When a directory is re-listed after being sealed (e.g., after external file additions), its mtime needs to be updated to reflect the latest child modification time. This fix ensures that for the `inode != parent` path in `listObjectsSlurp`, when `alreadySealed && hasItems`, we call `updateDirectoryMtime()` to update the directory's mtime from its children. This resolves the TestDirMTime failure where dir2's mtime was not being updated after newfile was added externally, because the update logic only existed in the `inode == parent` path. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 641e380 commit a96adb3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

core/dir.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,11 @@ func (parent *Inode) listObjectsSlurp(inode *Inode, startAfter string, sealEnd b
392392
inode.mu.Lock()
393393
sealSucceeded = inode.sealDirWithValidation()
394394
alreadySealed = !sealSucceeded && inode.dir.listDone
395+
396+
// Special case: if already sealed but got items, update mtime
397+
if alreadySealed && hasItems {
398+
inode.updateDirectoryMtime()
399+
}
395400
inode.mu.Unlock()
396401

397402
// Reacquire parent lock and validate generation
@@ -410,6 +415,11 @@ func (parent *Inode) listObjectsSlurp(inode *Inode, startAfter string, sealEnd b
410415
inode.mu.Lock()
411416
sealSucceeded = inode.sealDirWithValidation()
412417
alreadySealed = !sealSucceeded && inode.dir.listDone
418+
419+
// Special case: if already sealed but got items, update mtime
420+
if alreadySealed && hasItems {
421+
inode.updateDirectoryMtime()
422+
}
413423
inode.mu.Unlock()
414424

415425
// Validate parent generation before marking gap

0 commit comments

Comments
 (0)