Skip to content

Don't invent stacks from name prefixes by default (#12)#13

Merged
DonsWayo merged 1 commit into
mainfrom
fix/stack-inference-opt-in
Jun 17, 2026
Merged

Don't invent stacks from name prefixes by default (#12)#13
DonsWayo merged 1 commit into
mainfrom
fix/stack-inference-opt-in

Conversation

@DonsWayo

Copy link
Copy Markdown
Owner

Found in persona QA (live daemon)

Two unrelated containers, qa-web (nginx) and qa-cache (redis), were grouped into a fake "qa" stack just because they share a qa- prefix.

Root cause

container-compose sets no labels (container inspectlabels: {}), so the only grouping signal is the <project>-<service> name prefix — which can't distinguish a real compose project from unrelated containers that share a prefix (risk R2).

Fix

  • ProjectRegistry.assemble(containers:inferStacks:) — inference now opt-in, default off. Only Consai-launched (registry-known) stacks group reliably; everything else is standalone.
  • AppState reads @AppStorage("groupByNamePrefix") (default off) and passes it through.
  • Settings → Stacks toggle "Group external containers by name prefix" with an explanation of the trade-off.

Verification

Re-captured the live panel: the fake "qa" stack is gone; all containers list flat with real IP · cpu% · mem. 24 ConsaiCore tests pass (added opt-in + default-off cases).

Closes #12

Found in persona QA on a live daemon: qa-web + qa-cache (unrelated) were grouped into a
fake 'qa' stack purely from the shared prefix. Root cause: container-compose sets no labels,
so name-prefix is the only signal and it inevitably over-groups.

- ProjectRegistry.assemble gains inferStacks (default false): only Consai-launched (known)
  stacks group reliably; everything else is standalone unless the user opts in.
- AppState reads @AppStorage groupByNamePrefix (default off) and passes it through.
- Settings: 'Group external containers by name prefix' toggle + explanation.
- Tests: opt-in inference + default-off behavior (24 tests pass).

Closes #12
@DonsWayo DonsWayo merged commit 16ffef4 into main Jun 17, 2026
1 check passed
@DonsWayo DonsWayo deleted the fix/stack-inference-opt-in branch June 17, 2026 10:23
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.

Inferred stacks over-group unrelated containers (false 'qa' stack from qa-web + qa-cache)

1 participant