Skip to content

Extract magic number for user account count to constant#46

Merged
redpanda-f merged 3 commits into
feat/redpanda/external-apifrom
copilot/sub-pr-45
Jan 28, 2026
Merged

Extract magic number for user account count to constant#46
redpanda-f merged 3 commits into
feat/redpanda/external-apifrom
copilot/sub-pr-45

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 28, 2026

Addresses code review feedback to eliminate magic number 3 representing user account count. The coding guidelines require all magic numbers be extracted to constants, similar to how MAX_PDP_SP_COUNT is defined.

Changes

  • Added USER_ACCOUNT_COUNT constant in src/constants.rs set to 3, representing the number of test user accounts (USER_1, USER_2, USER_3)

  • Replaced 4 hardcoded 3 values with the constant across:

    • src/external_api/export.rs: User info export loop
    • src/commands/start/usdfc_funding/usdfc_funding_step.rs: Balance checking, token transfer, and verification loops
// Before
for i in 1..=3 {
    let name = format!("USER_{}", i);
    // ...
}

// After
for i in 1..=USER_ACCOUNT_COUNT {
    let name = format!("USER_{}", i);
    // ...
}

This centralizes the user count configuration and improves maintainability.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 28, 2026 04:08
Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>
Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address external API support updates Extract magic number for user account count to constant Jan 28, 2026
Copilot AI requested a review from redpanda-f January 28, 2026 04:14
@redpanda-f redpanda-f marked this pull request as ready for review January 28, 2026 04:15
@redpanda-f redpanda-f merged commit 14c6f6d into feat/redpanda/external-api Jan 28, 2026
@redpanda-f redpanda-f deleted the copilot/sub-pr-45 branch January 28, 2026 04:15
redpanda-f added a commit that referenced this pull request Jan 30, 2026
…ink issue fix for "latest" (#45)

* add: external api reference implementation

* fix: issues

* fix: CI issues

* makehappy: fmt

* fixes: CI

* stablize: symlinks for /state/latest, simplify CI check

* add: nodejs 20 installation

* Update .github/workflows/ci.yml, use nodejs LTS

Co-authored-by: Rod Vagg <rod@vagg.org>

* Extract magic number for user account count to constant (#46)

* Initial plan

* Extract magic number 3 to USER_ACCOUNT_COUNT constant

Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>

* Improve USER_ACCOUNT_COUNT constant documentation

Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>

* item 1: remove balance fields from export

* item 2: paths as source of truth

* item 3: error handling with Result

* item 5: improve symlink test

* item 6: add zod schema validation

* item 7: remove dead code

* item 9: rename curio_providers to pdp

* fix: remove unnecessary to_string calls

* fixes: schema validation

* makehappy: fmt

* Update examples/read-devnet-info.js

Co-authored-by: Rod Vagg <rod@vagg.org>

* Update examples/read-devnet-info.js

Co-authored-by: Rod Vagg <rod@vagg.org>

* fix: warn message

* fix: use expect() for yugabyte

* add: expect()

* fix: export

* fix: examples README

* remove: eslint

* docs: enhance README with link to examples

Added usage instructions and examples section to README.

* feat: linkify README

* update: examples

---------

Co-authored-by: Rod Vagg <rod@vagg.org>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: redpanda-f <181817029+redpanda-f@users.noreply.github.com>
Co-authored-by: Steve Loeppky <biglep@filoz.org>
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.

2 participants