Skip to content

pcgv3: manifest v2 for non co-located seg and meshes - #551

Draft
akhileshh wants to merge 9 commits into
pcgv3from
meshing-v2-pcgv3
Draft

akhileshh wants to merge 9 commits into
pcgv3from
meshing-v2-pcgv3

Conversation

@akhileshh

@akhileshh akhileshh commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Why

A table's watershed can live in a different location from its meshes, and that location holds no meshes.
PCG looked for every mesh under <watershed>/<mesh dir>, so such a table lost its meshes in the manifest, stitching, remeshing and find-path.
A copy of a table also lost its source's edited meshes, and under the default layout its initial meshes as well.

What changes

  • Mesh locations come from the table's mesh block. MeshMeta reads dir, initial_mesh_dir and dynamic_mesh_dir from custom_data["mesh"]; the last two may be absolute cloud URLs.
  • Setup writes only the mesh block and the shard spec. It merges its keys over an existing block, so a re-run keeps the keys it cannot set, and writes the spec beside the initial meshes. The watershed's info is no longer written, and dataset_info no longer takes mesh keys from it.
  • The graphene info publishes the table's mesh keys. mesh_dir, dynamic_mesh_dir, and mesh_metadata with the absolute initial and dynamic paths. dynamic_mesh_dir and mesh_metadata.unsharded_mesh_dir name the dynamic dir relative to <watershed>/<mesh dir> whenever it lies there, so a table repointed onto its own watershed, or away and back, stays readable by v1 clients.
  • Readers and writers use the table's own dirs. Stitching, remeshing, find-path's precise mode and the manifest read initial meshes from initial_path and dynamic meshes from dynamic_path; both manifest modes and the remesh worker read the shard spec beside the initial meshes.
  • A v2 manifest, negotiated by Accept: application/x.cave;manifest_version=2. Fragments are grouped by their absolute bucket, and every row carries exactly one seg id.
  • v1 clients are refused where they cannot reach the meshes. A v1 request for a table whose meshes sit outside <watershed>/<mesh dir> gets 406, naming the v2 header; "outside" compares whole path segments, so a sibling such as <mesh dir>_v2 counts as outside.
  • A table's watershed can be repointed. ChunkedGraphMeta.repoint_watershed pins the mesh block first, so the meshes stay where they are; save the meta with ChunkedGraph.update_meta. ws_cv, the watershed info and the OCDBT settings read the watershed directly, with no Redis cache.

Table copies

  • A copy keeps its source's initial meshes and writes its own dynamic dir, dynamic_<copy id>.
  • Its first open rewrites its meta once, listing the source's dynamic dir under inherited_dynamic.
  • A new node's creation time picks the dir checked first; a miss then checks the copy's own dir and only the inherited dirs newer than that pick.
  • An older dir is never checked: a restored copy reuses its source's node ids, so an older dir can hold another node's mesh under the same name.
  • The v2 manifest names each dynamic dir as its own bucket, so a copy needs a client that reads every bucket: feat(graphene): decode v2 mesh manifest seung-lab/neuroglancer#634.

Compatibility

  • A co-located table's v1 response is unchanged, and a table without inherited_dynamic reads exactly as before.
  • Manifest responses carry Vary: Accept and X-Manifest-Version.
  • meshgen.remeshing() no longer takes cv_sharded_mesh_dir.
  • A copy no longer gets a private <dir>_<copy id> or a shared-initial layout on its first open; it reads its source's meshes as above.

🤖 Generated with Claude Code

@akhileshh
akhileshh added this pull request to stack #553 November 5, 2026 23:55
@akhileshh akhileshh changed the title meshing v2 pcgv3 pcgv3: manifest v2 for non co-located seg and meshes Nov 6, 2026
akhileshh and others added 2 commits November 11, 2026 03:36
- `MeshMeta` resolves `dir`, `initial_mesh_dir` and `dynamic_mesh_dir`
  from `custom_data["mesh"]`; either mesh dir may be a cloud URL.
- Setup writes the shard spec and the mesh block, never the
  watershed's info.
- `dataset_info` and the graphene info take mesh keys from the mesh
  block alone.

Co-Authored-By: Claude <noreply@anthropic.com>
- Stitching, remeshing and find-path read node meshes through
  `NodeMeshReader`, from `initial_path` and `dynamic_path`.
- The manifest's shard readers resolve `initial_path` through
  `shard_mesh_source`, a cloud-URL dir included.
- `remeshing()` drops `cv_sharded_mesh_dir`; its callers pass
  `MeshMeta`'s values.

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##            pcgv3     #551      +/-   ##
==========================================
+ Coverage   67.51%   67.64%   +0.13%     
==========================================
  Files          89       89              
  Lines        8643     8629      -14     
  Branches     1149     1148       -1     
==========================================
+ Hits         5835     5837       +2     
+ Misses       2619     2604      -15     
+ Partials      189      188       -1     
Files with missing lines Coverage Δ
pychunkedgraph/graph/exceptions.py 100.00% <100.00%> (ø)
pychunkedgraph/graph/meta.py 98.15% <100.00%> (+7.16%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

akhileshh and others added 7 commits November 19, 2026 15:53
- `Accept: application/x.cave;manifest_version=2` gets fragments
  grouped by absolute bucket, with one seg id per row.
- A v1 request for a table that `needs_v2` gets `406`, naming the v2
  header; responses carry `Vary: Accept` and `X-Manifest-Version`.
- Manifest flags merge the query string and the body through `_flag`.

Co-Authored-By: Claude <noreply@anthropic.com>
- `MeshMeta.spec_dir` names the spec's dir, the parent of
  `initial_path`; `reader_anchor` derives from it.
- `verify=0` builds its shard readers through `shard_mesh_source`.
- The remesh worker looks for the spec in `spec_dir`, so a table
  whose watershed lives elsewhere still remeshes.

Co-Authored-By: Claude <noreply@anthropic.com>
- `setup_mesh_meta` merges its seven keys over the existing block,
  so `initial_mesh_dir` and other keys survive a re-run.
- The shard spec is written in `MeshMeta.spec_dir`, beside the
  initial meshes, never under a watershed that holds none.

Co-Authored-By: Claude <noreply@anthropic.com>
- ChunkedGraphMeta.repoint_watershed pins the mesh block first
- it rebuilds the meta, so nothing read at the old watershed survives
- it persists nothing; ChunkedGraph.update_meta saves it
- ws_cv, the watershed info and the OCDBT settings drop the Redis cache

Co-Authored-By: Claude <noreply@anthropic.com>
- A copy keeps its source's initial meshes, writes its own dynamic dir and inherits the source's.
- A new node's creation time hints at its dir; a miss searches the own dir, then inherited ones.
- This replaces the rewrite that gave a copy private or graph-suffixed mesh dirs.

Co-Authored-By: Claude <noreply@anthropic.com>
- A copy's restored id counters reuse its source's ids, so an older dir may hold another node's mesh.
- A miss now searches the own dir and the inherited dirs newer than the hint.
- The copy's block is built beside its layer record, and its dir name has one home.

Co-Authored-By: Claude <noreply@anthropic.com>
- Publish the dynamic dir relative to the mesh root when it lies there.
- Share one whole-segment test of the mesh root with `needs_v2`.
- Refuse v1 for a sibling dir that only shares the root's prefix.

Co-Authored-By: Claude <noreply@anthropic.com>
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