Conversation
🔐 Codex Security Review
Review SummaryOverall Risk: MEDIUM Findings[MEDIUM] Remove-omitted import can race past hidden-resource checks
NotesReview was limited to Generated by Codex Security Review | |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b9a11e360
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds a Site Map CSV import/export workflow spanning new protobuf RPCs, server-side CSV snapshot/validation/apply logic, and ProtoFleet UI entry points (Fleet header actions + import modal) to let operators reconcile fleet topology and miner placement via a deterministic multi-section CSV.
Changes:
- Introduces
sitemap.v1.SiteMapServicewith export (server-streaming) and token-gated import (dry-run + commit). - Implements server domain logic to export CSV, parse/validate uploaded CSV, compute change summaries, and apply supported updates transactionally.
- Adds ProtoFleet client hook + Fleet header actions + import modal UI to run preview/commit flows.
Reviewed changes
Copilot reviewed 14 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| server/internal/handlers/sitemap/handler.go | New Connect handler enforcing permissions and delegating to sitemap domain service. |
| server/internal/handlers/middleware/rpc_permissions.go | Registers sitemap RPCs in the procedure-permissions catalog. |
| server/internal/handlers/middleware/rpc_permissions_test.go | Extends contract test coverage to include the new sitemap service. |
| server/internal/domain/sitemap/service.go | Core CSV export/import: snapshot loading, parsing, validation, change planning, and transactional apply. |
| server/internal/domain/sitemap/service_test.go | Unit tests for parsing, planning, validation edge cases (omissions, swaps, read-only fields, capacities). |
| server/cmd/fleetd/main.go | Wires the sitemap domain service + handler into the fleet server mux and reflection allowlist. |
| proto/sitemap/v1/sitemap.proto | Defines the sitemap RPC contract, omission modes, validation errors, and change summaries. |
| docs/plans/2026-07-14-745-import-export-site-map-csv-plan.md | Plan doc describing CSV format, workflow, validation layers, and phased scope. |
| client/vite.config.ts | Adjusts Rollup HTML input resolution using an absolute path. |
| client/src/protoFleet/features/fleetManagement/components/SiteMapCsvImportModal.tsx | New UI modal for CSV upload, omission choice, preview errors/warnings/summary, and commit. |
| client/src/protoFleet/features/fleetManagement/components/FleetLayout/FleetLayout.tsx | Adds Fleet header import/export actions and mounts the import modal. |
| client/src/protoFleet/features/fleetManagement/components/FleetLayout/FleetLayout.test.tsx | Updates unit tests to mock sitemap hook/modal and keep FleetLayout tests stable. |
| client/src/protoFleet/api/useSiteMapCsv.ts | New client hook for exporting and importing sitemap CSV via the generated client. |
| client/src/protoFleet/api/clients.ts | Registers a new generated SiteMapService client in the ProtoFleet API client bundle. |
| client/src/protoFleet/api/generated/sitemap/v1/sitemap_pb.ts | Generated TS protobuf/service descriptors for the new sitemap API (generated — skip). |
| server/generated/grpc/sitemap/v1/sitemapv1connect/sitemap.connect.go | Generated Connect-Go bindings for the new sitemap service (generated — skip). |
| server/generated/grpc/sitemap/v1/sitemap.pb.go | Generated Go protobuf types for the new sitemap API (generated — skip). |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38b0150ef6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d455786a78
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 75d3a7c36e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4793f2bf0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c65201c11d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 892844dd43
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39628675cd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 104fa46da1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24a2852274
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f1a9edfd2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a0bf5f4cc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df86a88a86
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20db194fad
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7d18add471
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3308b318d8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fba9268828
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 83d6eed984
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1852edf1f0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94e71bd682
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2962581847
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d860cef0d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Reviewable diff: +3232/-4 across 13 files (excludes generated, test, and story files).
Summary
This PR adds a Site Map CSV import/export workflow for fleet topology: sites, buildings, racks, and miner placement. Operators can export a deterministic multi-section CSV, edit assignments offline, preview validation results and change summaries, then commit the exact dry-run plan through a token-gated import.
The first shipped write path supports updates to existing site/building/rack layout data, miner placement moves, and rack slot swaps. Site-map CSV v1 is explicitly scoped to existing topology and placement updates: new site/building/rack rows, miner name edits, and remove-omitted delete/unassign workflows return validation errors without a commit token until those write paths are implemented.
How it works
The client calls a new
SiteMapService.ExportSiteMapCsvstreaming RPC from the Fleet header. The server builds a snapshot from site, building, rack collection, rack-slot, and miner state sources, then emits a BOM-prefixed CSV withSITE,BUILDING,RACK, andMINERsections.Import starts with a dry run. The server parses the same section format, validates row uniqueness, known miners, read-only miner identity fields, rack/building/site placement consistency, rack slot bounds, rack and building capacity, duplicate desired slots, and conflicts with unchanged current slot occupants. If the CSV omits existing entities, the response asks the user to continue with omitted rows left in place before it returns a commit token. Remove-omitted requests are rejected as unsupported in v1.
Commit replays the exact CSV bytes and omission mode with the dry-run token. The server rejects drift, revalidates, then applies supported changes in one transaction: site/building/rack updates first, miner rack reparenting and site/building cascade, and finally rack slot updates after clearing pending slots so swaps do not trip the unique rack-slot constraint.
Diagrams
Areas of the code involved
proto/sitemap/v1/sitemap.protoSiteMapService, omission modes, validation errors, and change summaries.server/internal/domain/sitemap/server/internal/handlers/sitemap/server/cmd/fleetd/main.goserver/internal/handlers/middleware/rpc_permissions.goclient/src/protoFleet/api/useSiteMapCsv.tsclient/src/protoFleet/features/fleetManagement/components/FleetLayout/FleetLayout.tsxclient/src/protoFleet/features/fleetManagement/components/SiteMapCsvImportModal.tsxclient/vite.config.tsKey technical decisions & trade-offs
device_identifieras the identity key and allow minernameedits.serial_number,mac_address, andip_addressread-only on import.Testing & validation
cd server && ../bin/go test -count=1 ./internal/domain/sitemap ./internal/handlers/middleware ./internal/handlers/sitemap ./cmd/fleetdcd client && ../bin/npx tsc --noEmitcd client && ../bin/npx vitest run src/protoFleet/features/fleetManagement/components/FleetLayout/FleetLayout.test.tsx