Skip to content

fix(atlas): honour a project pin only when its dedupe key matches#112

Merged
Aayam Bansal (aayambansal) merged 1 commit into
mainfrom
fix/atlas-pin-dedupe-key
Jul 6, 2026
Merged

fix(atlas): honour a project pin only when its dedupe key matches#112
Aayam Bansal (aayambansal) merged 1 commit into
mainfrom
fix/atlas-pin-dedupe-key

Conversation

@aayambansal

Copy link
Copy Markdown
Member

One of the reasons "Atlas doesn't create/load the right graph."

Bug

resolveProjectId honoured the local .openscience/project.json pin unconditionallyreadProjectPin returned only project_id and threw away the dedupe_key that writeProjectPin stored next to it. So when the pin is stale or belongs to a different repo identity (the git remote was re-pointed to a fork, a .openscience/ dir was copied into another repo, or the pinned project was deleted server-side), find-or-create returned the wrong/dead project id and never created the correct graph — which reads as "the graph won't load / shows the wrong project / stays empty."

Fix

  • readProjectPin now returns the stored dedupe_key too (ProjectPin).
  • resolveProjectId computes the repo's key first and trusts the pin only when pinMatchesKey(pin, key) holds: a pin with no key is legacy and kept for back-compat; otherwise its key must equal the repo's freshly-computed key. A mismatched pin falls through to resolve-or-create, which rewrites the pin with the current key. The offline/fast path is preserved (the git calls that compute the key are local).

Tests

pinMatchesKey coverage added to test/server/atlas-bridge.test.ts: legacy pin (no key) trusted; matching key trusted; a key from a different repo identity rejected; a local-folder pin that no longer matches rejected. Existing dedupe-key / failure-classification / init tests unchanged (18 pass).

resolveProjectId returned the local .openscience/project.json pin
unconditionally, ignoring the dedupe_key that writeProjectPin had stored
alongside it. When the pin is stale or belongs to a different identity —
the remote was re-pointed to a fork, a .openscience/ dir was copied in,
or the project was deleted — find-or-create returned the wrong/dead id
and never created the correct graph, surfacing as 'the graph won't load
/ shows the wrong project / stays empty'.

readProjectPin now returns the stored dedupe_key, and resolveProjectId
trusts the pin only when pinMatchesKey() holds (no key = legacy pin, kept
for back-compat; otherwise the key must equal the repo's freshly-computed
key). A mismatched pin falls through to resolve-or-create, which
overwrites it with the current key.
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openscience Ready Ready Preview, Comment Jul 6, 2026 3:54pm

Request Review

@aayambansal Aayam Bansal (aayambansal) merged commit 8014fa7 into main Jul 6, 2026
12 checks passed
@aayambansal Aayam Bansal (aayambansal) deleted the fix/atlas-pin-dedupe-key branch July 6, 2026 15:57
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.

1 participant