GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(storage): prevent id collisions and keep ids on vault scan by antonreshetov · Pull Request #981 · massCodeIO/massCode

Conversation

@antonreshetov

@antonreshetov antonreshetov commented Oct 13, 2026

Copy link
Copy Markdown
Member

Fixes duplicate and lost record ids during a full markdown vault scan (code, notes and HTTP spaces).

  • When the index (state.json / .state.yaml) is missing or does not know a file, ids for files without a free frontmatter id are now allocated after the scan, above every id already taken. Previously a file without an id could take an id explicitly written in the frontmatter of a file scanned later, so that record was reassigned (HTTP also rewrote it into the file).
  • Ids of indexed records whose files are still on disk are reserved, so a copy (e.g. Foo copy.md from Finder) never takes the id of its original, regardless of directory order. Notes previously had no such reservation.
  • Ids of index entries whose files disappeared are no longer reserved, so a file renamed outside the app keeps its id. For HTTP this also keeps request history (.history/<id>) attached; it happened even with the app open, since every external HTTP change triggers a full scan.
  • Counter bumps compare with > instead of Math.max, so an index entry without an id cannot turn new ids into NaN.

Ids of existing indexed records are never changed and nothing new is written to user files (HTTP write-back is unchanged). No extra file reads.

Accepted risks:

  • A copy that received a new id keeps the old frontmatter id on disk for code and notes until it is edited in the app (rewriting it would re-serialize user files).
  • If a file is renamed and copied at the same time while the app is closed, the id goes to whichever file is scanned first.

Tests cover a missing index, a valid index with new files, external rename, copies with an explicit directory order, and index entries without an id.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
antonreshetov added 2 commits October 13, 2026 19:03
@antonreshetov
fix(storage): prevent id collisions on full vault scan
0732b82
@antonreshetov
fix(storage): keep ids of files renamed outside the app
ce3414b
@antonreshetov antonreshetov self-assigned this Oct 13, 2026
@antonreshetov
antonreshetov merged commit 63550a9 into main Oct 13, 2026
@antonreshetov
antonreshetov deleted the fix/vault-scan-id-collisions branch October 13, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@antonreshetov antonreshetov

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@antonreshetov
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.