Skip to content

Conversation

@troian
Copy link
Member

@troian troian commented Nov 10, 2025

Description

Closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow-up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

@troian troian requested a review from a team as a code owner November 10, 2025 19:30
@coderabbitai
Copy link

coderabbitai bot commented Nov 10, 2025

Walkthrough

Change: switch TestnetConfig from value to pointer in InitAkashAppForTestnet and its caller; add nil check. Shell script: change process cleanup to per-PID loop and replace init with genesis init.

Changes

Cohort / File(s) Summary
Testnet config & init (Go)
app/testnet.go, cmd/akash/cmd/app_creator.go
InitAkashAppForTestnet signature changed to accept *TestnetConfig and now performs a nil-safety check. Call site in app_creator.go updated to assert/pass *akash.TestnetConfig. No other logic altered.
Script: upgrades
script/upgrades.sh
Replaced aggregated PID kill with an iterative while IFS= read -r pid; do kill ...; done < <(jobs -p) loop. Replaced "$AKASH init --home ..." with "$AKASH genesis init --home ...".

Sequence Diagram(s)

(omitted — changes are type/signature adjustments and script edits; no new runtime control flow to visualize)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify nil-safety behavior in InitAkashAppForTestnet and that callers handle a possible nil (or never pass nil).
  • Audit all callers across the repo to ensure *TestnetConfig is passed everywhere InitAkashAppForTestnet is used.
  • Confirm script/upgrades.sh process-cleanup loop behaves correctly in varied shells/environments and that genesis init is the intended command.

Possibly related PRs

Poem

🐇 I nibble at pointers, light on my feet,

Values once heavy now tiny and neat.
Cleanup I loop through, one pid at a time,
Genesis reborn with a clearer chime.
Hop, hop — code refined in a small rhyme ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The description uses the repository template but provides only placeholders without actual details about the changes, objectives, or critical files to review. Add a meaningful description explaining the rationale for passing config by pointer, what problems it solves, and which files require critical review.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: converting the TestnetConfig parameter to a pointer in the InitAkashAppForTestnet function and updating related code.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch testnetify1

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
script/upgrades.sh (1)

172-176: Remove unnecessary shellcheck disable directive.

The shellcheck disable comment on line 173 is no longer needed since $pid is now properly quoted by the read command and not subject to word splitting. The refactored loop correctly handles PIDs without unquoted expansion.

Apply this diff to remove the obsolete directive:

 function cleanup() {
 	while IFS= read -r pid; do
-		# shellcheck disable=SC2086
 		kill $pid
 	done < <(jobs -p)
 }

Alternatively, you could explicitly quote $pid for consistency:

 function cleanup() {
 	while IFS= read -r pid; do
-		# shellcheck disable=SC2086
-		kill $pid
+		kill "$pid"
 	done < <(jobs -p)
 }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eba5456 and 4926784.

📒 Files selected for processing (3)
  • app/testnet.go (1 hunks)
  • cmd/akash/cmd/app_creator.go (1 hunks)
  • script/upgrades.sh (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
app/testnet.go (1)
cmd/akash/cmd/testnetify/config.go (1)
  • TestnetConfig (61-67)
cmd/akash/cmd/app_creator.go (2)
app/testnet.go (1)
  • TestnetConfig (59-64)
cmd/akash/cmd/testnetify/config.go (1)
  • TestnetConfig (61-67)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: network-upgrade
  • GitHub Check: lint-go
  • GitHub Check: coverage
  • GitHub Check: release-dry-run
  • GitHub Check: build-bins
  • GitHub Check: build-macos
  • GitHub Check: sims
  • GitHub Check: tests
🔇 Additional comments (1)
script/upgrades.sh (1)

366-366: Clarify unrelated CLI change and resolve codebase inconsistency.

The command changed from $AKASH init to $AKASH genesis init, which appears unrelated to the PR objective ("pass config by pointer"). Additionally, this change creates an inconsistency: _build/single-node.sh:18 still uses the old akash init pattern and was not modified.

Confirm:

  1. Is this a required Akash CLI version change?
  2. Should _build/single-node.sh also be updated for consistency?
  3. If CLI-related, this should be documented or handled in a separate PR aligned with the actual scope of "passing config by pointer."

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
script/upgrades.sh (1)

172-175: Consider adding error handling for process cleanup.

The per-PID loop approach is valid, but the cleanup could be more robust. Currently, if kill fails on a PID (e.g., process already terminated), the script continues without feedback.

Consider this enhanced version with error handling and explicit signal:

 function cleanup() {
-	while IFS= read -r pid; do
-		# shellcheck disable=SC2086
-		kill $pid
-	done < <(jobs -p)
+	while IFS= read -r pid; do
+		if kill -0 "$pid" 2>/dev/null; then
+			kill -TERM "$pid" 2>/dev/null || true
+		fi
+	done < <(jobs -p)
 }

This checks if the PID exists before attempting to kill it and explicitly uses SIGTERM.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4926784 and 3813a34.

📒 Files selected for processing (3)
  • app/testnet.go (1 hunks)
  • cmd/akash/cmd/app_creator.go (1 hunks)
  • script/upgrades.sh (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/akash/cmd/app_creator.go
🧰 Additional context used
🧬 Code graph analysis (1)
app/testnet.go (2)
cmd/akash/cmd/testnetify/config.go (1)
  • TestnetConfig (61-67)
app/app.go (1)
  • AkashApp (92-102)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: tests
  • GitHub Check: sims
  • GitHub Check: lint-go
  • GitHub Check: release-dry-run
  • GitHub Check: build-bins
  • GitHub Check: coverage
  • GitHub Check: build-macos
🔇 Additional comments (2)
script/upgrades.sh (1)

366-366: Command structure update looks correct.

The change from $AKASH init to $AKASH genesis init aligns with a command restructuring where init became a subcommand under genesis. This is consistent with the PR objectives.

app/testnet.go (1)

72-80: LGTM! Nil check properly implemented.

The parameter type change to *TestnetConfig and the nil safety check address the concern raised in the previous review. The use of tmos.Exit is consistent with the existing error handling pattern in this function (line 86), and all subsequent dereferences of tcfg (lines 135, 146, 259, 260, 271, 290, 292) are safe.

@troian troian merged commit 141d74d into main Nov 10, 2025
18 checks passed
@troian troian deleted the testnetify1 branch November 10, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants