Skip to content

UserIndex misses file updates within the two-second lifecycle window #2034

Description

@Referralconsequently

UserIndex misses file updates within the two-second lifecycle window

Upstream revision

  • Commit: ce046f26495c73f007790971869c94d58e0f6a20
  • Upstream user-index.ts SHA-256: a81b58266a6650cbd578c08c0e67f39dc533e150f9d406e29512acdeda7368d5
  • Release-payload user-index.ts SHA-256: c49af24ede618781f9e24185e939e2e6cb26b89413aa52a76799b15e04383397

Expected behavior

After start() completes, rewriting a file below the temporary USER directory should update user-index.json within two seconds.

Observed behavior

The exact upstream source and the pinned release source both miss the update. Their initial scans complete, but the rewritten marker does not appear in user-index.json before the two-second deadline.

The local compatibility implementation retains fs.watch and adds a periodic tree-signature check. That safety poll schedules a rebuild when the watcher misses a change.

Reproducer

Run the non-default reproducer from a LifeOS checkout:

bun LIFEOS/UPSTREAM_REPROS/UserIndexLifecycle.repro.ts \
  --upstream-checkout /path/to/danielmiessler-LifeOS-at-ce046f2

The reproducer:

  1. Verifies the upstream commit and both source hashes.
  2. Creates separate temporary USER directories.
  3. Starts each UserIndex implementation.
  4. Rewrites PROFILE.md after startup.
  5. Waits two seconds for the marker to appear in user-index.json.
  6. Returns success only when both sources reproduce the pinned upstream-defect classification.

Any hash or behavior change returns a nonzero status and requires review.

Proposed fix

Keep the recursive watcher as the fast path. Add a low-frequency tree-signature poll that schedules the existing debounced rebuild when the signature changes. Stop the poll in stop() and expose watcher or poll failures through module health.

Add a lifecycle test that writes after start() and requires the index to contain the new marker within the documented window. The test should use an isolated temporary USER directory and must not copy a private implementation into the installer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions