Skip to content

refactor: group client-facing listener flags (M2 part 5) - #1441

Merged
bootjp merged 2 commits into
mainfrom
design/root-package-decomposition-m2e
Nov 12, 2026
Merged

bootjp merged 2 commits into
mainfrom
design/root-package-decomposition-m2e

Conversation

@bootjp

@bootjp bootjp commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Design: docs/design/2026_11_12_partial_root_package_decomposition.md

M2 part 5, following #1440. It moves the client-facing listener flags out of package globals into listenerFlags, which is registered on the FlagSet and passed down from run().

Changes

  • listenerFlags (main_public_servers.go) holds 15 flags:
    • Redis: --redisAddress, --redisLuaMaxIdleStates.
    • DynamoDB: --dynamoAddress.
    • S3: --s3Address, --s3Region, --s3CredentialsFile, --s3PathStyleOnly.
    • SQS: --sqsAddress, --sqsPublicEndpoint, --sqsRegion, --sqsCredentialsFile.
    • Metrics and pprof: --metricsAddress, --metricsToken, --pprofAddress, --pprofToken.
  • resolveNetworkRuntimeInputs → resolveValidatedRuntimeInputs → resolveRuntimeInputs pass it to parseRuntimeConfig.
  • serversInput carries it. The runtimeServerRunner fields it already had are now filled from it.
  • prepareRedisServer takes the Lua pool size as a parameter.
  • prepareAdminFromFlags takes the S3 credentials file (the admin listener reuses it) as a parameter.
  • --address stays a global for now. It is the node's Raft address and belongs with the Raft topology flags in the next part.

Behavior change

None. Flag names, defaults and help text are unchanged: -help output is identical to the base.

Risk

Low. The values are read-only after parsing, so passing them as copies changes nothing.

Test evidence

  • go test -race -count=1 .: ok (225s).
  • golangci-lint: 0 issues.
  • scripts/check-production-imports.sh: ok.
  • -help output: identical to the base binary.
  • Test list: identical apart from the new TestListenerFlagsDefaultsAndParsing.
  • Jepsen: not run. Nothing in replication, MVCC or OCC changed.

Self-review

  1. Data loss: no write, apply or persistence path is touched.
  2. Concurrency: the values are immutable after parsing, and nothing new is shared.
  3. Performance: start-up only. No hot path is involved.
  4. Consistency: each listener, leader map and credentials loader gets the same value it read from the global before.
  5. Test coverage: a new test pins the defaults and the parsing of the S3, SQS and pprof flags. Existing callers of the changed signatures are updated.

Move the Redis, DynamoDB, S3 and SQS listener flags, the Redis Lua pool
size, and the metrics and pprof endpoints into listenerFlags on
serverFlags. Runtime config parsing, the server runner, the Redis server
and the admin listener (which reuses the S3 credentials file) receive
the values instead of reading package globals.

No flag name, default or help text changes.

Signed-off-by: bootjp <contact@bootjp.me>
Signed-off-by: bootjp <contact@bootjp.me>
@coderabbitai

coderabbitai Bot commented Nov 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d8396693-15b4-4f9e-b1e3-46496ebdf77e
Commits

Reviewing files that changed from the base of the PR and between 8a0568f and 4c20345.

Files selected for processing: 11

  • docs/design/2026_11_12_partial_root_package_decomposition.md
  • main.go
  • main_admin.go
  • main_bootstrap_network_redis_e2e_test.go
  • main_bootstrap_network_wiring.go
  • main_commit_ts_fence_test.go
  • main_flags.go
  • main_listener_flags_test.go
  • main_public_servers.go
  • main_runtime_config.go
  • main_server_runner.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T15:09:57.267695Z 4c20345 PR opened
🔒 Security Review ✅ Completed 2026-11-12T15:12:14.089705Z 4c20345 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@bootjp
bootjp merged commit d6e8fbb into main Nov 12, 2026
18 checks passed
@bootjp
bootjp deleted the design/root-package-decomposition-m2e branch November 12, 2026 15:20
bootjp added a commit that referenced this pull request Nov 12, 2026
…t 6) (#1442)

Design: docs/design/2026_11_12_partial_root_package_decomposition.md

M2 part 6. It is stacked on #1441, so retarget it to `main` once #1441
merges. It moves the node identity, cluster topology and consistency
rollout-gate flags out of package globals.

## Changes
- `raftFlags` (`main_runtime_config.go`): `--address`, `--raftId`,
`--raftEngine`, `--raftDataDir`.
- `topologyFlags` (`main_runtime_config.go`): `--raftGroups`,
`--shardRanges`, `--raftRedisMap`, `--raftS3Map`, `--raftDynamoMap`,
`--raftSqsMap`, `--sqsFifoPartitionMap`. The HT-FIFO comment moved onto
the struct.
- `consistencyFlags` (`main_commit_ts_fence.go`): `--commitTSFence`,
`--readWatermarkAdvance`.
- `resolveNetworkRuntimeInputs` and `resolveValidatedRuntimeInputs` now
take `*serverFlags`, so the parameter lists stop growing with each part.
`resolveRuntimeInputs` takes the raft, topology and listener values.
- Each of these now gets the values it needs as parameters:
  - `loadKEKAfterPreNonceStartupGuards`: Raft ID and data dir.
  - `prepareAdminFromFlags`: Raft ID.
  - `startRaftServers`: Raft ID and `readWatermarkAdvance`.
  - The server runner and S3 blob cluster: Raft ID.
  - Snapshot offload, via `distributionStartupInput`: data dir.
  - `serversInput`: node address and consistency flags.
- **Not in this PR:** the bootstrap and join flags (`--raftBootstrap`,
`--raftBootstrapMembers`, `--raftGroupPeers`, `--raftJoinMembers`,
`--raftJoinAsLearner`, `--raftBootstrapPeerConfigDir`). The
protected-bootstrap e2e fixtures read or overwrite them deep inside
group construction, so they get their own part.

## Behavior change
None. Flag names, defaults and help text are unchanged: `-help` output
is identical to the base.

## Risk
Low. The values are read-only after parsing. Every former global read
now gets the same value through a parameter or struct field.

## Test evidence
- `go test -race -count=1 .`: ok (229s).
- `golangci-lint`: 0 issues.
- `scripts/check-production-imports.sh`: ok.
- `-help` output: identical to the base binary.
- Test list: identical apart from the new
`TestRaftTopologyConsistencyFlagsDefaultsAndParsing` and
`TestRuntimeInputsRequireRaftID`.
- `TestRuntimeInputsRejectCommitTSFenceBeforeOpeningStores` no longer
overwrites a global and runs `t.Parallel`.
- Jepsen: not run. Nothing in replication, MVCC or OCC changed.

## Self-review
1. **Data loss**: no write, apply or persistence path changes. The data
dir reaches the KEK guard, shard groups and snapshot offload unchanged.
2. **Concurrency**: the values are immutable after parsing.
3. **Performance**: start-up only. `readWatermarkAdvance` is still
decided once per server build.
4. **Consistency**: the commit-ts fence and read-watermark gates read
the same parsed booleans in the shard store, the coordinator, Internal
RPC options and the public-service start.
5. **Test coverage**: new tests pin the defaults, parsing and the
required `--raftId` check. The commit-ts fence test now builds its flags
explicitly.
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.

1 participant