Skip to content

Explicit membership duplicated across folders resolves arbitrarily per surface #62

Description

@chodeus

Problem

One container can appear in two folders' explicit containers[] lists. The folder editor can't create this state (it prunes other folders' members from the picker), but two legitimate paths can:

When it happens, the owner is decided by processing order and differs per surface: the server's syncContainerOrder() is first-wins in JSON key order ($assignedContainers filter), while the rendered tabs claim rows as each folder is processed in display order — so the Docker tab, Dashboard, and autostart file can each pick a different owner. This is the same defect class #55 closed for explicit-vs-label, left open for explicit-vs-explicit.

Proposed fix

Enforce single ownership at the write sinks instead of tie-breaking at every read site:

  • updateFolder() (serves both create.php and update.php): after inserting the saved folder, strip its members from every other folder's containers[] — the folder being saved wins, since that's the user's latest deliberate action.
  • importAll(): dedupe the imported folder map before writing — first folder in bundle key order wins, deterministic for a given file.

Read sites then never see a contested explicit claim, and no per-page resolution logic is needed.

Acceptance

  • Saving a folder that lists container X removes X from any other folder's containers[] in the same atomic write
  • Importing a bundle with X in two folders lands X in exactly one (first in bundle order), identically on every surface
  • Normal saves and imports without duplicates are byte-identical to today's output

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