Skip to content

[bug] import --auto-collection-routing: Archived/ADR routed outside the import's top collection; multi-parent collections shown under the broadest parent #3812

Closed

Description

@mstomar125

Follow-up to #1703 / #1705 (both closed). Found in a Sync small-load run: nodespace import dir <parent> --auto-collection-routing (core 0.3.6) on a 36-file docs sample, base directory <parent> containing docs-sync-smoke/{architecture,components,development,strategy,decisions,archived}/.

Reproduced on a freshly built CLI/daemon with an isolated home (the per-file collection routing is identical to the report). Core-only result, collection member_of edges:

Architecture / Components / Development / Strategy -> Docs Sync Smoke
Alternatives, Research -> Strategy ; Market Validation -> Research
Archived  -> (no parent)      <- should be Docs Sync Smoke:Archived
ADR       -> (no parent)      <- should be Docs Sync Smoke:ADR
person memberships: 0

The code involved is the same on v0.3.6 and on main.

Findings

  1. Routing is inconsistent with a prefixed base directory (bug, core). derive_collection_metadata (daemon import_service.rs) maps any path containing archived/, decisions/ or adr/, lessons/ to a fixed TOP-LEVEL name (Archived, ADR, Lessons), dropping the leading directories, while every other directory is joined from all its segments (Docs Sync Smoke:Architecture). One import therefore produces two trees. The decisions/ match is also a substring test on the relative path, so a top-level decisions/x.md is not matched (it goes to Decisions), while a/decisions/x.md goes to ADR.
  2. Sidebar shows a single "Default Collection" (UI, and Sync). collections.svelte.ts shows each collection under its FIRST parent only. In a Sync workspace every pushed node, collections included, is also filed member_of the default collection c0000000-0000-0000-0000-000000000001, so a collection has parents [Default, real parent] in an unspecified order, and the tree can show it under Default instead of its real parent. The designed way to hide the default container is the Sync extension's collectionTreeRoots contribution (ADR-082); core has no root of its own (ADR-083). Contributing that root is a Sync-app follow-up, not core.
  3. Importer not a member of imported collections: by design, no core change. Core has no membership or access semantics (ADR-081/083: member_of person edges carry no meaning in core) and get_all_collections has no membership filter. In Sync, a person member_of a collection makes it RESTRICTED (the first authorized member restricts it, ADR-037/083), so stamping the importer on imported collections would silently make a team's imported docs private to the importer. Not doing that. See [bug] Imported/nested collections have no person member_of edge → invisible in the sidebar #1705 for the reachability analysis.

Plan

  • Make the special-folder routing prefix-aware and segment-based (Docs Sync Smoke:Archived, Docs Sync Smoke:ADR), with unit tests.
  • Sidebar: when a collection has several parents, nest it under the most specific one (a parent that is itself below another candidate), so the real tree shows even when a workspace-wide container is also a parent.

Metadata

Metadata

Assignees

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