Skip to content

feat(nodedeployment): add --genesis-override flag#184

Merged
bdchatham merged 2 commits into
mainfrom
feat/genesis-override-flag
May 18, 2026
Merged

feat(nodedeployment): add --genesis-override flag#184
bdchatham merged 2 commits into
mainfrom
feat/genesis-override-flag

Conversation

@bdchatham
Copy link
Copy Markdown
Contributor

Summary

Closes #183. Adds a dedicated seictl nd apply --genesis-override <key>=<value> flag that writes flat dotted-key entries into spec.genesis.overrides on the rendered SeiNodeDeployment. Mirrors the existing --override flag (which targets spec.template.spec.overrides).

Why

spec.genesis.overrides (shipped this morning via #181 + sei-k8s-controller#270) requires a flat map[string]<JSON> with dotted cosmos-module keys ("staking.params.unbonding_time": "600s"). The sidecar's applyGenesisOverrides enforces this: keys must be module.field[.field...], first segment must be a cosmos module in app_state.

seictl --set spec.genesis.overrides.<path>=<value> cannot emit that shape — --set's path parser splits unconditionally on . and builds a nested map. Today's first attempt at the field (sei-protocol/harbor-engineering-workspace#14) shipped the nested-map shape and the sidecar rejected it on every retry with key "app_state" must be of the form module.field[.field...]. Required a manual yq-patching workaround (sei-protocol/harbor-engineering-workspace#16).

What this PR does

seictl nd apply <name> --preset genesis-chain \
  --chain-id <id> --image <ref> \
  --genesis-override staking.params.unbonding_time=600s \
  --genesis-override bank.params.default_send_enabled=true \
  --genesis-override gov.params.voting_period_seconds=120 \
  --genesis-override mint.params.inflation='{"min":0.05,"max":0.2}' \
  -n eng-<alias>

Renders:

spec:
  genesis:
    overrides:
      "staking.params.unbonding_time": "600s"
      "bank.params.default_send_enabled": true
      "gov.params.voting_period_seconds": 120
      "mint.params.inflation":
        min: 0.05
        max: 0.2
  • Keys are stored as literal map-key strings — no path splitting
  • Values parse as JSON when they parse (numbers, bools, objects, arrays); otherwise as raw strings
  • Local key-shape validation (module.field[.field...]) fails fast at apply time rather than after the SND has stalled
  • Rejected when --preset != genesis-chain (rpc preset has no spec.genesis)
  • Repeatable, distinct from --override

Tests

  • TestRender_GenesisOverrideFlag — string / bool / number / object values all round-trip correctly through the renderer
  • TestRender_GenesisOverrideRejectsNonGenesisPreset
  • TestApplyGenesisOverride_Errors — missing =, empty key, single-segment key, empty path segment
  • TestApplyGenesisOverride_PreservesExistingKeys — multiple flag uses accumulate into one map

make test passes.

Follow-ups

After this releases (v0.0.51?), the harbor-dev skill docs in sei-protocol/Tide get a follow-up PR that replaces the manual-yq workaround with the canonical --genesis-override invocation. Will land separately.

🤖 Generated with Claude Code

Adds a dedicated `seictl nd apply --genesis-override <key>=<value>`
flag that writes flat dotted-key entries into `spec.genesis.overrides`
on the rendered SeiNodeDeployment. Mirrors the existing `--override`
flag for `spec.template.spec.overrides`.

Closes the gap surfaced by #183: `--set` builds
nested maps from dotted paths, but the sidecar's
applyGenesisOverrides requires the dots to live INSIDE the key. The
new flag treats the key as a literal map-key string (no path
splitting) and validates the cosmos-module shape (module.field
[.field...]) locally, so single-segment keys fail at apply time
rather than after the SND has stalled retrying assemble-genesis.

Values parse as JSON if they parse (numbers, bools, objects,
arrays); otherwise as raw strings. Matches the controller's
`map[string]apiextensionsv1.JSON` type for genesis.overrides.

Only valid with `--preset genesis-chain` (rpc preset has no
`spec.genesis`). Repeatable. Distinct from `--override` which
targets per-node config.toml overrides at config-apply time.

Test coverage:
- TestRender_GenesisOverrideFlag — string, bool, number, object
  values all round-trip correctly via the renderer
- TestRender_GenesisOverrideRejectsNonGenesisPreset
- TestApplyGenesisOverride_Errors — missing '=', empty key,
  single-segment key, empty path segment
- TestApplyGenesisOverride_PreservesExistingKeys
@cursor
Copy link
Copy Markdown

cursor Bot commented May 18, 2026

You have used all Bugbot PR reviews included in your free trial for your GitHub account on this workspace.

To continue using Bugbot reviews, enable Bugbot for your team in the Cursor dashboard.

Platform reviewer + k8s reviewer cross-review on the initial commit
caught two:

- Reject `--genesis-override key=` (empty value) explicitly in
  applyGenesisOverride. Mirrors the sidecar's applyGenesisOverrides
  rejection of empty json.RawMessage at assemble-genesis time, so
  the failure surfaces at apply time instead of after the SND has
  stalled.
- Document the JSON-quoted-string escape in the --genesis-override
  usage string so users have a deterministic path to force a
  numeric-looking value into a string at the YAML level (e.g.
  --genesis-override foo.bar='"42"' renders foo.bar: "42").

Added TestApplyGenesisOverride_JSONStringEscape covering the escape
contract. The empty-value case is added to TestApplyGenesisOverride_Errors.

The k8s reviewer's non-finite-float concern (NaN/Inf) is deferred —
json.Unmarshal of a textual input never yields NaN/Inf (spec-illegal),
and 1e400 → +Inf surfaces a confusing error at SSA time. Acceptable
in v1; can be tightened later if it bites.
@cursor
Copy link
Copy Markdown

cursor Bot commented May 18, 2026

You have used all Bugbot PR reviews included in your free trial for your GitHub account on this workspace.

To continue using Bugbot reviews, enable Bugbot for your team in the Cursor dashboard.

@bdchatham bdchatham merged commit 04b9815 into main May 18, 2026
2 checks passed
@bdchatham bdchatham deleted the feat/genesis-override-flag branch May 18, 2026 23:30
bdchatham added a commit that referenced this pull request May 18, 2026
Picks up #184 (--genesis-override flag) so the harbor-dev skill can
land its follow-up that replaces the yq-patching workaround with
the canonical CLI invocation.
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.

feat(nodedeployment): support flat-key rendering for spec.genesis.overrides

1 participant