Skip to content

Tracking #1383: S1 version token (A1) - BigInt-safe file versioning #1388

Description

@easonLiangWorldedtech

Tracking issue for upstream PR #1383 (branch feat/version-token-s1).

Part of the file-write safety series — plan: easonLiangWorldedtech/Zoo-Code#33, epic: #1375. Item: S1 / A1 — Version token.

Scope

  • New src/utils/versionToken.ts:
    • computeVersionToken(filePath): Promise<string> — one fs.stat(path, { bigint: true }); rejects with the underlying ENOENT for absent files.
    • versionTokenOfStat(stats: BigIntStats): string — pure, zero I/O; token format dev:ino:size:mtimeNs:ctimeNs, all five fields exact BigInt values rendered as decimal strings (no float anywhere).
  • A1 infrastructure only: no production callers — behavior change is zero. S2 (observation registry) and S4 (guarded write) build on it.

Acceptance

  • Same disk state → same token, deterministic across processes; any size/identity/mtime/ctime change → different token
  • Regression test pins a size > Number.MAX_SAFE_INTEGER; sub-ms test asserts an exact 1_000 ns delta
  • CI green (ubuntu unit-test gate), 100% codecov patch coverage

Status

  • PR: OPEN, MERGEABLE — CI green (platform-unit-test ubuntu SUCCESS, codecov/patch SUCCESS)
  • CodeRabbit finding (numeric stat precision) fixed via the { bigint: true } route (commit 2c1582bd9), inline comment replied

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions