block / block/proto-fleet

Multi-site — Foreman importer sitemap → site/building/rack

Open
#201 1 comment 0 reactions 0 assignees View on GitHub
enhancement multi-site server
Dominant language
Go
Stars
55
Forks
16
Avg merge
1d 17h
Merged PRs (30d)
84

Description

**Parent**: #193
**Plan**: [\`docs/plans/2026-05-05-multi-site-support-plan.md\`](https://github.com/block/proto-fleet/blob/main/docs/plans/2026-05-05-multi-site-support-plan.md)

Today's Foreman import flattens a tree of `SiteMapGroup` rows + leaf `SiteMapRack` rows into fleet groups + racks. Multi-site requires the importer to produce sites + buildings + racks instead. See plan J7.

## Scope

- `server/internal/domain/foremanimport/mapper.go` rewrite:
- Each root Foreman group (parent_id IS NULL) → fleet **site**.
- Every non-root group → fleet **building** under the corresponding site (multiple parent levels collapse to one building).
- Each rack → fleet rack under the matching building.
- Miner `site_id` set from rack's building's site at import time.
- Service-layer wiring.
- Tests covering tree-collapse, idempotency-on-rename, parentless-rack fallback to Unassigned.
- Post-import summary ("imported N sites, M buildings, K racks, X miners").

## Acceptance

Re-running an import after a site rename in fleet logs a warning and skips the rename. A Foreman tree with mid-level groups collapses correctly to single buildings.

## Estimated size

~6–10 files. Can ship in parallel with #198, #199, #200.

## Depends on

- #196

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.