From e6e67660641d4340cab7f7fb454a180ad839f9f1 Mon Sep 17 00:00:00 2001 From: Chris Oo Date: Mon, 23 Nov 2026 15:34:54 -0800 Subject: [PATCH] copilot: instructions for apis to not use multile bools --- .github/copilot-instructions.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 669e5587b0c..375bc0fa684 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -17,6 +17,20 @@ For cross-compilation from WSL2 to Windows, see `Guide/src/dev_guide/getting_started/cross_compile.md` and source `. ./build_support/setup_windows_cross.sh`. +## API Design + +- Avoid multiple positional `bool` parameters in functions and constructors. + Call sites should show what each choice means without requiring the reader + to inspect the signature. +- Prefer small, named constructors for distinct creation modes, such as + `new_primary(...)` and `new_secondary(...)`, rather than one constructor + controlled by flags. Each constructor should take only the inputs its mode + needs. Share implementation internally where useful. +- Use a descriptive enum when a value selects a mode at runtime. Keep booleans + for independent on/off properties, not for encoding modes. +- Do not replace flag lists with a general-purpose builder or configuration + framework when a few named constructors suffice. + ## Protocol Buffers Enums For `.proto` changes (including gRPC/ttrpc), read and follow the