Skip to content

feat: 🎸 add file birthTime support - #1277

Merged
streamich merged 2 commits into
masterfrom
fix-birthtime
Aug 5, 2026
Merged

feat: 🎸 add file birthTime support#1277
streamich merged 2 commits into
masterfrom
fix-birthtime

Conversation

@streamich

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI lite review requested due to automatic review settings August 5, 2026 14:23

Copilot AI left a comment

Copy link
Copy Markdown

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 adds proper birthtime support by introducing a dedicated node creation timestamp (btime) in fs-core and wiring it through to fs-node Stats.birthtime*, with new tests to validate stability across common file operations.

Changes:

  • Added Node.btime (birth/creation time) and included it in Node.toJSON().
  • Updated Stats.build() to report birthtime, birthtimeMs, and birthtimeNs from Node.btime instead of ctime.
  • Added test coverage in both fs-core (node-level invariants) and fs-node (stat-level behavior across operations).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/fs-node/src/Stats.ts Maps Node.btime into Stats.birthtime* (including bigint variants).
packages/fs-node/src/tests/birthtime.test.ts Adds integration tests ensuring birthtime stability across writes/metadata changes and bigint stats.
packages/fs-core/src/Node.ts Introduces btime on nodes and serializes it via toJSON().
packages/fs-core/src/tests/Node.test.ts Adds unit tests asserting btime initialization and immutability across node mutations.
Suppressed comments (1)

packages/fs-core/src/Node.ts:363

  • Node.toJSON() currently reads file contents via getString(), which updates atime (and does so twice because getString() calls getBuffer(), which also updates atime). Serialization shouldn’t have side effects on timestamps; with btime now explicitly modeled, this kind of hidden mutation becomes more surprising for snapshot/restore-style uses.
      btime: this.btime.getTime(),
      perm: this.perm,
      mode: this.mode,
      nlink: this.nlink,
      symlink: this.symlink,

Comment thread packages/fs-node/src/Stats.ts Outdated
Comment on lines +34 to +37
stats.atime = atime;
stats.mtime = mtime;
stats.ctime = ctime;
stats.birthtime = ctime;
stats.birthtime = btime;
@streamich
streamich merged commit 083162d into master Aug 5, 2026
20 of 21 checks passed
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