feat(config,cli): add assets-layout tooling and gridpool enterprise ownership - #130
Open
cwasicki wants to merge 11 commits into
Open
feat(config,cli): add assets-layout tooling and gridpool enterprise ownership#130cwasicki wants to merge 11 commits into
cwasicki wants to merge 11 commits into
Conversation
cwasicki
requested review from
Linus404 and
daniel-zullo-frequenz
and removed request for
a team
August 27, 2026 14:21
cwasicki
requested review from
Mohammad-Tayyab-Frequenz and
phillip-wenig-frequenz
August 27, 2026 14:22
Reuse the platform-wide Frequenz API credentials when the Assets-specific `ASSETS_API_AUTH_KEY` and `ASSETS_API_SIGN_SECRET` are unset. Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
Validate config files offline via `AssetsConfig.load_from_files`, exiting non-zero on the first error so a config repo can gate PRs. Each file is checked on its own first, so a partial record that only completes after a merge is rejected: every committed file must name its own key and required fields. The merged pass then adds the cross-record checks. Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
Emit `assets.microgrids.<id>` entries and stamp `assets.version` so the generated file loads back without a migration. Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
In-place patching overwrites the managed leaves by default; pass `--fill-missing` to only add the ones the file lacks. Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
In-place patching navigates the current `assets.microgrids` layout, so a top-level or `meta`-nested file would be duplicated rather than edited. Refuse it with a clear message pointing at a full rebuild. Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
A gridpool always belongs to one enterprise, so `assets.gridpools.<id>` names its `enterprise_id`. `AssetsConfig.enterprise_of` looks the owner up. Each entry must name its enterprise and be filed under its own `gridpool_id`. Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
`gridpool-cli find-enterprise <gridpool_id> <files>` prints the enterprise that owns the gridpool, read from the merged config. Exits non-zero when no `gridpools` entry names it. Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
`get_microgrid` already carries the owning enterprise, so a config built from the API now fills `MicrogridConfig.enterprise_id` instead of leaving it unset. Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
A gridpool shares its enterprise with the microgrids its relations name, so `enterprise_of` falls back to that when no `gridpools` entry is declared. A declared entry still wins; disagreeing microgrids raise. Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
`check` now enforces the one-enterprise-per-gridpool invariant: a gridpool's microgrids may not disagree on the enterprise, and a declared `gridpools` enterprise must match the one its microgrids imply. Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
Signed-off-by: cwasicki <126617870+cwasicki@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rounds out
gridpool-clifor theassetsconfig layout and adds gridpool enterprise ownership to the config model. The CLI can now generate, validate, patch, and query merged config files.Enterprise ownership: adds
GridpoolConfigentries underassets.gridpools.AssetsConfig.find_enterprise()returns the declared owner or infers it from related microgrids. Whole-document validation rejects conflicting enterprise assignments.Assets API enterprise metadata: configs derived from the Assets API now include each microgrid's
enterprise_id.find-enterprisecommand:gridpool-cli find-enterprise <gridpool_id> <files>prints the enterprise owning a gridpool from a merged config stack and exits non-zero when it cannot be determined.Credential fallbacks: accepts
FREQUENZ_API_KEY/FREQUENZ_API_SECRETwhen the Assets-specific credentials are unset. Credential pairs are never mixed between sources.validatecommand: validates each config file independently and then validates the merged stack, enabling config-repository CI checks.Current config output:
generate-configwrites theassets.microgridslayout and stampsassets.version.Safe in-place updates:
generate-config --inplacerefreshes managed values while preserving formatting.--fill-missingonly adds absent values, generated patches are validated before writing, and legacy layouts are rejected.