Skip to content

introduce prodtest error codes#6829

Draft
TychoVrahe wants to merge 2 commits intomainfrom
tychovrahe/prodtest/error_codes
Draft

introduce prodtest error codes#6829
TychoVrahe wants to merge 2 commits intomainfrom
tychovrahe/prodtest/error_codes

Conversation

@TychoVrahe
Copy link
Copy Markdown
Contributor

Summary

  • Replaces prodtest CLI's string-based error codes with a stable integer system
  • Each cli_error() call site gets a unique code that survives refactoring, command addition/removal, and message edits
  • Wire format change: ERROR error "message" -> ERROR <int> "message"

Changes to cli.h / cli.c

  • cli_error() signature: const char* code -> int code
  • Framework codes (CLI_ERROR_INVALID_CMD etc.) converted from strings to integers 1?8
  • Generic CLI_ERROR "error" macro removed

Rules (encoded as comments in the header)

  • Codes are never reused - retired codes stay in the enum marked DEPRECATED
  • New errors are appended to the relevant block; gaps are never filled
  • 1000-code blocks allow 3-digit offsets per module (current largest: tropic at 100)

Breaking change

Host-side test scripts must be updated - the ERROR line now carries an integer instead of a string.

New file: prodtest_error_codes.h

Central prodtest_error_t enum with 326 unique codes across 24 module blocks of 1000:

Module Range
backup-ram 1000-1999
ble 2000-2999
bootloader 3000-3999
button 4000-4999
haptic 5000-5999
manufacturing-lock 6000-6999
nfc 7000-7999
nrf 8000-8999
optiga 9000-9999
otp 10000-10999
otp-variant 11000-11999
power-manager 12000-12999
rtc 13000-13999
sdcard 14000-14999
secrets 15000-15999
secure-channel 16000-16999
tamper 17000-17999
telemetry 18000-18999
touch 19000-19999
tropic 20000-20999
unit-test 21000-21999
wpc 22000-22999
common 23000-23999
prodtest 24000-24999

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7e913b31-e2d7-46c6-9566-92fafa847629

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tychovrahe/prodtest/error_codes

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

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

@trezor-bot trezor-bot Bot added this to Firmware Apr 24, 2026
@github-project-automation github-project-automation Bot moved this to 🔎 Needs review in Firmware Apr 24, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 24, 2026

en main(all)

model device_test click_test persistence_test
T2T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all) test(all) main(all)

Latest CI run: 24887348255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔎 Needs review

Development

Successfully merging this pull request may close these issues.

1 participant