-
Notifications
You must be signed in to change notification settings - Fork 350
add AI settings for roo #985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Rexarrior
wants to merge
232
commits into
userver-framework:develop
Choose a base branch
from
Rexarrior:ai-setup
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
232 commits
Select commit
Hold shift + click to select a range
c25c7dc
add AI settings for roo
Rexarrior 28cd652
update development settings
Rexarrior b95ee61
Merge branch 'userver-framework:develop' into ai-setup
Rexarrior c5319c9
cc userver: rename kIsDetected to IsDetected
TTPO100AJIEX 4d72584
feat grpc: upd functional_tests/middleware_client, add retry count check
kpavlov00 7d45eb0
feat redis: add logs for CLUSTER SLOT parsing errors
apolukhin ae6f448
extreme config
Rexarrior cbdb7f4
feat grpc: add empty proto structs generation
ArkadyRudenko aa7a6de
cc core: better HttpRequest docs
ArkadyRudenko 3b6ef19
feat proto-struct: add child directory
ArkadyRudenko feb7e51
feat universal: work with multiple string_views in crypto
apolukhin 8a0e54d
feat core: add the core of the transaction tracker
d0f603d
fix grpc: fix test DeadlineStatsTests.ClientDeadlineUpdated
kpavlov00 9e183a2
bug websocket: properly mask received frames
703b5fc
feat grpc: introduce UnaryCall with retries
kpavlov00 deb7c48
cc core: rm static_cast
ArkadyRudenko 4554533
feat proto-structs: generate enums and basic fields
Anton3 20a8651
bug docs: fix building dynamic config pages
apolukhin 6ed2dc2
fix build: bump macos python
fdr400 e1b4eaf
feat kafka: support SSL authentication
670c736
feat core: non blocking receive for TLS wrapper
b59618a
fix grpc: fix UnaryCall::GetContext::GetSpan race
kpavlov00 879a38f
feat grpc: support UnaryCall TryCancel
kpavlov00 d79efdf
fix grpc: fix CallContext::GetClientContext safety
kpavlov00 2417833
feat redis: log cluster topology changes
apolukhin d3b50d1
feat ci: update ci-conan.yml to test on pure environment without addi…
apolukhin bc47547
update
Rexarrior 63a12ab
move out extreme config
Rexarrior b0bb433
fix grpc: correct CallContext::GetClientContext invariants
kpavlov00 7dda7ed
refactor grpc: add ResponseFuture::Cancel
kpavlov00 a90e3bb
feat core: introduce USERVER_ENABLE_STACK_USAGE_MONITOR
segoon 6672841
feat chaotic: x-taxi-handler-codegen
segoon 731a201
feat chaotic: support $ref to $ref in oneOf
segoon 726d0ae
feat chaotic: honour operationId
segoon e64447c
feat chaotic: compile schemaless files too
segoon 3d4eaaf
feat chaotic: support x-taxi-middleware in swagger
segoon 65ed9d2
feat grpc: append RpcType to StaticServiceMetadata
kpavlov00 2e1a9b5
feat userver: support in uPg parse cpp enum to pg text
d1ee9fb
feat proto-structs: add include bundles
Anton3 de82315
feat chaotic: support x-taxi-cpp-type: storages::postgres::*
segoon 449b385
feat chaotic: ignore x-taxi-py3
segoon b678723
feat chaotic: ignore x-taxi-go-*
segoon 9e7e67c
feat chaotic: support in: body from swagger 2.0
segoon 1df11a0
feat chaotic: ignore x-taxi-handler-tag for client
segoon d599f12
feat chaotic: implement title
segoon 2c46cee
feat chaotic: std::intXX_t
segoon 61b320e
feat proto-structs: settle directory hierarchy for tests
a16f2fd
feat chaotic: use full path in generated files
segoon 544977d
feat chaotic: implement x-taxi-cpp-name in parameters
segoon 67ef6f3
feat clients: allow overriding Plugin list in codegen clients
2c6a8cc
feat cmake: drop unsupported python versions < 3.9
segoon 96cb7fb
feat userver: add trx tracker global disabler
73c19da
feat chaotic: better error msg in translator
segoon 427376b
cc chaotic: eliminate dead code
segoon 965216a
feat chaotic: implement PEP 585
segoon cb8c14d
feat docs: add SlugKit logo and fix minor issues with links
apolukhin 38bda28
feat proto-structs: add basic support for oneof fields
Anton3 656aca5
feat chaotic: handle non-string headers in responses
segoon c92828c
feat chaotic: support "x-usrv-" tags
segoon 3d3b346
feat chaotic: x-taxi-middlewares.eats: v1
segoon d516714
feat userver/ydb: make ydb transaction name a literal string
67ed832
feat userver: add CheckNoTransactions to codegen http handles
c73c5f3
feat chaotic: use Ref class for $ref parsing
segoon 9bee08e
feat chaotic: support nullable oneOf
segoon b0be345
feat userver/configs: add prepared_statements_enabled field to comman…
b5c8297
fix client: pass location in Request::perform
35eb829
feat userver/proto-structs: implement the library part of proto structs
d92a737
feat grpc: support Streaming method retries
kpavlov00 05c2ded
cc uservices: enable templates & namespaces readability-identifier-na…
TTPO100AJIEX e5c62d3
fix grpc: drop excessive info log
kpavlov00 79b9598
cc grpc: fix tracing_metadata test
ArkadyRudenko 56e971e
bug chaotic: do not fail with -DUSERVER_CHAOTIC_FORMAT:BOOL=OFF
segoon 7ed85ff
bug crypto: const-time signature check
segoon 36294df
feat chaotic: implement 'x-taxi-query-log-mode: hide'
segoon 3604203
cc uservices: enable Class, Struct, Enum & Union readability-identifi…
TTPO100AJIEX f35657f
cc userver: remove default_ns namespace
TTPO100AJIEX 99f4235
feat cmake: by-components cpack install
segoon 0844ed3
feat chaotic: implement x-taxi-cpp-type: userver::utils::StrongTypedef<>
segoon 6ce912f
feat chaotic: implement type: file
segoon 5f34973
cc chaotic: deduplicate tests code
segoon 936e091
feat core: speed up periodic_task.hpp
segoon 034c468
bug chaotic: fix boost::uuid inside std::unordered_set
segoon c9e6769
fix proto-structs: minor fixes for oneof codegen
Anton3 ec95578
feat chaotic: implement bank-authproxy
segoon bc8fe3d
bug websockets: fix UB
db2a0db
feat cmake: include intercomponent install dependencies
segoon ebd151f
feat chaotic: add test to invalid $ref
segoon 6e19ad9
cc chaotic: document middlewares
segoon d09df90
cc proto-structs: add more tests for oneof
Anton3 534f219
cc proto-structs: clean up InheritsFromInstantiation implementation
Anton3 70ae971
feat userver: add service start-ms metric
ce5b019
feat proto-structs: remove boilerplate in common enum name patterns
Anton3 b31f5d7
feature: support exponential format in decimal64::Decimal::FromString…
2b16a9b
feat mongo: support the collection.distinct operation
55a6748
feat grpc: add tests on metadata usage and documentation for them
4879813
cc grpc: document how to complete client-side streaming RPCs gracefully
5de7bf0
feat engine: invalidate cancelled task after Get()
ca52b94
fix proto-structs: fix concept names resolving
4JustMe4 3b0b0df
feat docs: add info on mirrors
apolukhin 48644ad
feat proto-structs: implement map types
Anton3 66f2e92
cc userver: document distro maintainer's role
segoon fa3a8f7
feat docs: improve version change widget
Lone-Marshal 3d1c435
feat userver: generate debian/ & add test for .deb packages installation
segoon 672959d
feat proto-structs: generate proper oneof classes
Anton3 db84423
cc userver: enable Member and Method readability-identifier-naming
TTPO100AJIEX bc33a7d
cc chaotic: improve in-code documentation
segoon 5c70de3
feat cmake: add Fedora github CI workflow
segoon 0d98da8
feat docs: minor updates for the docs building scripts
apolukhin 10b3119
cc kafka: fix -Wpointer-bool-conversion in tests
4JustMe4 f6514c3
feat concurrent: allow zero-sized items in GenericQueue
8ec88f2
cc userver: fixes for debian/ generator
segoon 1fdccc4
feat redis: add Client::GenericCommand
7dbfadb
feat proto-struct: sort dependencies
ArkadyRudenko 6db4eef
feat grpc: add transaction check to grpc calls
8088a19
fix build: declare support for protobuf 6.x.y (v6.30+)
halfdarkangel 2f0b456
feat userver/otlp: add support for separate endpoints
a16140c
feat core: warn on Host header not being present, clarify GetUrl docs
fc78011
feat userver: support parsing custom key types in maps
8181854
cc formats: showcase PerformMinimalFormatConversion in json2yaml
Anton3 04b6740
fix build: set CMAKE_CXX_SCAN_FOR_MODULES OFF
botanegg 98715b8
feat userver: support_deprecated_in_configs
911e2c6
feat userver: set trx_tracker start/end in transactions
da9e76b
feat macos: up boost to 1.89
segoon 8ab036b
feat docs: add changelog for 2.12
apolukhin 0464dff
feat docs: document the gRPC retries and timeouts
apolukhin c9bde1a
feat docs: fix typos
apolukhin 9b7d40b
feat CI: update URL to for MariaDB keys
apolukhin db5ef54
feat qc-gateway: add future states
TTPO100AJIEX 7b4bf1d
feat CI: bump actions/checkout from 4 to 5
bcbb7a6
feat cmake: use GLOB_RECURSE in userver_add_sql_library
Anton3 e50ba7f
feat docs: fix some of the Doxygen noted issues
apolukhin d4f5496
feat ci: fix Conan runs on MacOS
apolukhin 057883a
feat docs: release 2.12
apolukhin e58db4f
feat docs: start 2.13-rc
apolukhin 876d0b7
feat postgresql: add static assertions for custom containers in Postg…
f4c21b7
feat cmake: add CPM to Boost
segoon 1825e27
Revert "feat cmake: add CPM to Boost"
apolukhin d2c6b12
feat userver: support status codes log levels in grpc
90beea9
fix build: update describe for status_codes.cpp
apolukhin 582368a
feat cmake: use namespace when calling utils::RegisterResource
zmij 897ea9c
feat core: reuse ssl ctx for TLS server
d24908a
bug github: fix alpine workflow name
segoon 69f95f2
feat grpc: add test for issue from https://github.com/userver-framewo…
apolukhin 16558d2
feat userver core: fix fs::TempFile destructor crash when fs::TempFil…
f122b64
feat grpc: add src tvm id to access log
c27306d
feat userver/proto-structs: tests and fixes
d1f7aea
cc uservices: replace russian с with english c
TTPO100AJIEX 1ede5ce
cc docs: fix some Doxygen errors
Anton3 2670e0d
refactor: change the way adding src tvm id in access log
c046f86
bug chaotic: fix . in schema name
segoon 99429b8
fix core: disable trx tracker check on testpoint
fe051c4
bug chaotic: fix peerdir for api-4.0
segoon acf2348
bug docs: fix formatting
segoon aaac81a
bug chaotic: fix array serialization in request body
segoon e9c1178
bug github: fix macos workflow
segoon a5a7994
feat docs: add FAQ for SIGUSR1 and fix some links
apolukhin 853c1e5
bug chaotic: fix usrv_build.json contents
segoon af2442f
feat userver/proto-structs: enhancements
fe9130c
feat grpc: publish logging functions for google::protobuf::Message an…
59f0b6e
cc decimal64: add info about exponential format in doc
db1a1a0
feat proto-struct: io functions
ArkadyRudenko b0f3f22
feat ci: add debian
segoon f8e656c
bug cmake: build fix for alpine
segoon b0fcf81
refactor docs: clarify max_response_size_in_flight
apolukhin cac0fc7
feat cmake: add CPM to several depenencies
segoon c85259a
feat cmake: add OpenSSL to CPM
segoon c154316
released controller getter
6210fd3
Fix names resolution
4JustMe4 d46c97e
Add GEOPOS redis command to the driver
03b8c65
feat debian: additions for debian source package
segoon 8fa1a13
feat cmake: print CPM packages
segoon 349c649
feat chaotic: autocreate userver/chaotic/io for uservices/libraries
segoon be5d608
bug chaotic: fix translator for response header type
segoon 14d4794
feat chaotic: ignore x-usrv-non-std-type-reason
segoon d23150a
feat chaotic: support empty media-type
segoon d26a47d
feat chaotic: prepare for driver-mode library
segoon fb6236b
feat cmake: Boost for CPM
segoon 61964ba
feat userver: add method in LRU cache to get update time of a key
7630779
feat proto-structs: support userver/structs/annotations.proto
Anton3 3286809
feat chaotic: support x-usrv-cpp-type: unsigned
segoon 6589b92
feat userver/redis: return chrono type from ttl request
08fd5ff
feat: update third_party date/date.h to a5db3aec
botanegg 039f98f
feat docs: clarify some of the docs
apolukhin b767405
feat redis: improve logs
679ff5e
feat chaotic: improvements here and there
segoon 6d02dbb
bug chaotic: report about duplicate types
segoon 2303ca1
feat userver: make GetOptionalTimezone public
59cf92f
Fix `-Wignored-qualifiers` and `-Wreturn-stack-address` improved in c…
4JustMe4 40b8800
refactor proto-struct: better io
ArkadyRudenko 3dc06a1
add some documentation
8ac8326
refactor proto-structs: prettify IO and bundles
ArkadyRudenko 991e889
feat protobuf: add support for protobuf v6 (30.x)
vasily-sviridov 2a6a7dc
feat proto-structs: camel case for enums
ArkadyRudenko fa404d4
feat mongo: remove MONGO_DEADLINE_PROPAGATION_ENABLED_V2
GitSparTV 727d2e3
fix userver: fix crash on conversion from deeply nested YamlConfig to…
8a37325
feat chaotic: use pydantic in jsonschema
segoon f764877
fix build: add abseil-cpp PR 1739 patch for CPM
botanegg 678e94d
Revert commit rXXXXXX, feat chaotic: use pydantic in jsonschema
db5d2b5
feat docs: add Debian badge to Readme.md
apolukhin f258a39
refactor grpc: move once used 'MakeClientFactorySettings' to anonymou…
kpavlov00 10c2580
feat redis: add options to expire redis command
c8c4c94
feat github: CI for Arch Linux
segoon 3825b51
feat docs: add more publications and mirrors to videos
apolukhin 0e75fd7
test core: trx tracker functional test
6aaacee
feat userver-configs: regen const.py
52515d8
feat grpc-proto-structs: added client/server codegen_declarations.hpp…
kpavlov00 ed03071
feat userver: import dynamic configs for egress proxy
f462ff8
feat userver: add multipart upload methods support to s3api
b0161e0
feat proto-structs: auto-break dependency cycles using utils::Box
Anton3 a56a062
feat yaml_config: treat #env values as string
2f3578f
feat proto-structs: require proto3 optional to produce std::optional …
Anton3 f65d973
feat redis: disable flapping test
apolukhin 3eb84df
fix tests: reenable disabled proto-structs oneof tests
Anton3 d6473ef
fix userver: fix s3api multipart upload response parsers' arguments
943351c
feat grpc: introduce grpc-proto-structs server stream
kpavlov00 203bc2c
cc grpc: drop prefix ProtoStruct
kpavlov00 7a4ac22
refactor grpc: place grpc-client client-data into utils::Box
kpavlov00 f333fcc
refactor grpc: add place grpc-client client-data into box, follow by
kpavlov00 7b16327
Fix -Wdeprecated-literal-operator in taxi
4JustMe4 9fc7102
cc userver: enable function & parameter readability-identifier-naming
TTPO100AJIEX b891210
Resolve merge conflicts and simplify AI settings according to require…
Rexarrior aa1123f
cc proto-structs: drop outer `-` from macro-endmacro
Anton3 a07aa49
bug core: fix TSan markup for Mutex
apolukhin c702440
refactor grpc: fwd ClientData
kpavlov00 4b229a3
fix proto-structs: account for WEAK dependencies on nested types
Anton3 32e9578
add AI settings for roo
Rexarrior 3bb213a
update development settings
Rexarrior 6779c54
extreme config
Rexarrior acaba06
update
Rexarrior 9e6a2ca
move out extreme config
Rexarrior 797102f
Resolve merge conflicts and simplify AI settings according to require…
Rexarrior 030a1cd
Merge branch 'ai-setup' of https://github.com/Rexarrior/userver into …
Rexarrior File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| # AI Agent System Prompt for userver Service Development | ||
|
|
||
| I am an expert C++ software engineer specializing in developing services using the userver framework. My purpose is to help create high-performance, scalable services that leverage the full power of the userver framework's component-based architecture and asynchronous capabilities. | ||
|
|
||
| ## Core Principles | ||
|
|
||
| ### Service Development Focus | ||
| - I develop services that use the userver framework, not the framework itself | ||
| - I focus on implementing business logic in handlers and components | ||
| - I use existing framework components rather than creating new ones | ||
| - I follow service development patterns and best practices | ||
|
|
||
| ### Component-Based Architecture | ||
| - Services are composed of components registered in main.cpp | ||
| - Components have well-defined lifecycles (Constructor → Start → Stop → Destructor) | ||
| - Components are configured through static_config.yaml | ||
| - Dependencies between components are declared explicitly | ||
|
|
||
| ### Asynchronous Programming Model | ||
| - All I/O operations use userver's asynchronous drivers | ||
| - Operations are non-blocking and coroutine-safe | ||
| - Deadline propagation ensures responsive service behavior | ||
| - Cancellation support handles long-running operations gracefully | ||
|
|
||
| ## Service Development Workflow | ||
|
|
||
| ### 1. Service Creation | ||
| - Start with the service_template/ as a base. | ||
| - You MUST use command `userver-create-service service_name [--mongo] [--postgres] [--grpc]` to get service template | ||
| - Customize CMakeLists.txt for project-specific dependencies | ||
| - Implement handlers in src/ directory following established patterns | ||
| - Configure components in configs/static_config.yaml | ||
|
|
||
| ### 2. Handler Implementation | ||
| - Inherit from userver::server::handlers::HttpHandlerBase | ||
| - Use kName constant for component registration | ||
| - Implement HandleRequestThrow for exception-based error handling | ||
| - Extract request parameters with request.GetArg("name") | ||
| - Set response headers and content type appropriately | ||
|
|
||
| ### 3. Component Registration | ||
| - Register components in main.cpp using MinimalServerComponentList() | ||
| - Append standard components like Ping, HttpClient, DnsClient | ||
| - Add custom handlers and components as needed | ||
| - Use component names that match static_config.yaml | ||
|
|
||
| ### 4. Configuration Management | ||
| - Configure task processors for CPU-bound and filesystem-bound operations | ||
| - Map handlers to URLs in static_config.yaml | ||
| - Set up database connections and other external dependencies | ||
| - Use environment variables for deployment-specific settings | ||
|
|
||
| ## Key Implementation Patterns | ||
|
|
||
| ### HTTP Handler Pattern | ||
| Refer to .roorules for detailed implementation patterns. | ||
|
|
||
| ### Request Processing | ||
| Refer to .roorules for detailed request processing techniques. | ||
|
|
||
| ### Error Handling | ||
| Refer to .roorules for detailed error handling approaches. | ||
|
|
||
| ## Service-Specific Components | ||
|
|
||
| ### Core Components | ||
| Refer to .roorules for a complete list of available components. | ||
|
|
||
| ### Database Components | ||
| Refer to .roorules for database component options. | ||
|
|
||
| ### Optional Components | ||
| Refer to .roorules for optional component options. | ||
|
|
||
| ## Best Practices | ||
|
|
||
| ### Performance Optimization | ||
| - Use asynchronous operations to minimize context switches | ||
| - Implement connection pooling for database and HTTP clients | ||
| - Apply deadline propagation to all downstream requests | ||
| - Use caching for frequently accessed data | ||
|
|
||
| ### Reliability Patterns | ||
| - Implement circuit breaker patterns for external dependencies | ||
| - Use proper retry strategies with exponential backoff | ||
| - Handle different HTTP status codes appropriately | ||
| - Implement graceful degradation for non-critical failures | ||
|
|
||
| ### Development Practices | ||
| - Follow component lifecycle guidelines for initialization and cleanup | ||
| - Use framework-provided synchronization primitives | ||
| - Implement structured logging with contextual information | ||
| - Write tests at multiple levels (unit, functional, integration) | ||
|
|
||
| ## Available Resources | ||
|
|
||
| ### Userver framework documentation | ||
| - Repository https://github.com/userver-framework/userver | ||
| - Site with documentation: https://userver.tech/de/d6a/md_en_2index.html | ||
|
|
||
| ### Documentation | ||
| - userver/samples: Example services demonstrating various features | ||
| - userver/service_template: Template for creating new services | ||
| - userver/ai-memory-bank: Memory bank with framework patterns and context | ||
|
|
||
| ### Development Environment | ||
| - CMake for build configuration | ||
| - GTest for unit testing | ||
| - pytest with testsuite for functional testing | ||
| - Google Benchmark for performance testing | ||
|
|
||
| ## Quality Standards | ||
|
|
||
| ### Code Quality | ||
| - Follow userver coding guidelines and patterns | ||
| - Use RAII and exception-safe coding practices | ||
| - Implement proper memory management with smart pointers | ||
| - Maintain consistent code formatting | ||
|
|
||
| ### Testing Requirements | ||
| - Unit tests for core business logic | ||
| - Functional tests for service endpoints | ||
| - Integration tests for database and external service interactions | ||
| - Performance benchmarks for critical operations | ||
|
|
||
| For detailed implementation instructions, refer to the .roorules file. |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,187 @@ | ||
| # userver Service Development Rules | ||
|
|
||
| service_development_rules: | ||
| description: "Rules and guidelines for developing services using the userver framework" | ||
|
|
||
| # Notes about available resources | ||
| notes: | ||
| framework_source: "In userver repo (https://github.com/userver-framework/userver) there is the source code of the framework for reference" | ||
| samples: "In userver/samples there are many examples of userver services demonstrating various features and components" | ||
| memory_bank: "In userver/ai-memory-bank there is memory about framework sources and patterns" | ||
|
|
||
| # Service project structure based on service_template | ||
| project_structure: | ||
| description: "Standard directory structure for userver services" | ||
| structure: | ||
| service_name: | ||
| - "CMakeLists.txt # Build configuration" | ||
| - "configs/ # Configuration files" | ||
| - " └── static_config.yaml # Static service configuration" | ||
| - "src/ # Source code" | ||
| - " ├── main.cpp # Service entry point" | ||
| - " ├── handlers/ # HTTP handlers" | ||
| - " │ ├── handler_name.hpp # Handler declaration" | ||
| - " │ └── handler_name.cpp # Handler implementation" | ||
| - " └── components/ # Custom components (optional)" | ||
| - "tests/ # Tests (optional)" | ||
| - "unittests/ # Unit tests (optional)" | ||
| - "benchmarks/ # Benchmarks (optional)" | ||
|
|
||
| # Key implementation files | ||
| key_files: | ||
| main_cpp: | ||
| description: "Service entry point" | ||
| responsibilities: | ||
| - "Sets up the component list" | ||
| - "Registers handlers and components" | ||
| - "Starts the service using userver::utils::DaemonMain" | ||
|
|
||
| cmake_lists_txt: | ||
| description: "Build configuration" | ||
| responsibilities: | ||
| - "Finds the userver package" | ||
| - "Defines object libraries for source files" | ||
| - "Links against userver components" | ||
| - "Sets up installation targets" | ||
|
|
||
| static_config_yaml: | ||
| description: "Configuration file" | ||
| responsibilities: | ||
| - "Defines task processors" | ||
| - "Configures components" | ||
| - "Maps handlers to URLs" | ||
|
|
||
| # Service configuration patterns | ||
| configuration_patterns: | ||
| handler_configuration: | ||
| description: "Handlers are configured in static_config.yaml" | ||
| pattern: | | ||
| components: | ||
| handler-name: | ||
| path: /url-path | ||
| method: GET,POST # HTTP methods | ||
| task_processor: main-task-processor | ||
|
|
||
| task_processor_configuration: | ||
| description: "Services typically define at least two task processors" | ||
| pattern: | | ||
| task_processors: | ||
| main-task-processor: | ||
| worker_threads: 4 # For CPU-bound tasks | ||
| fs-task-processor: | ||
| worker_threads: 2 # For filesystem-bound tasks | ||
|
|
||
| component_registration: | ||
| description: "Components are registered in main.cpp using the component list" | ||
| pattern: | | ||
| auto component_list = userver::components::MinimalServerComponentList() | ||
| .Append<userver::server::handlers::Ping>() | ||
| .Append<service_namespace::HandlerName>(); | ||
|
|
||
| # Development workflows | ||
| development_workflows: | ||
| building: | ||
| steps: | ||
| - "CMake Configuration: Run cmake to configure the build" | ||
| - "Compilation: Run make or ninja to build the service" | ||
| - "Installation: Run make install to install the service" | ||
|
|
||
| testing: | ||
| steps: | ||
| - "Unit Tests: Run with make test or ctest" | ||
| - "Functional Tests: Use testsuite framework" | ||
| - "Benchmarks: Run performance benchmarks" | ||
|
|
||
| deployment: | ||
| steps: | ||
| - "Binary Deployment: Install the service binary" | ||
| - "Configuration Deployment: Deploy configuration files" | ||
| - "Service Management: Use systemd or similar for service management" | ||
|
|
||
| # Service-specific rules and guidelines | ||
| service_rules: | ||
| handler_implementation: | ||
| guidelines: | ||
| - "Handler Classes: Inherit from userver::server::handlers::HttpHandlerBase" | ||
| - "Handler Names: Use kName constant for component registration" | ||
| - "Request Handling: Implement HandleRequestThrow method for exception-based error handling" | ||
|
|
||
| component_design: | ||
| guidelines: | ||
| - "Component Lifecycle: Follow userver component lifecycle (Constructor → Start → Stop → Destructor)" | ||
| - "Configuration: Use GetComponentConfig() to access component configuration" | ||
| - "Dependencies: Declare dependencies in constructor parameters" | ||
|
|
||
| error_handling: | ||
| guidelines: | ||
| - "Exceptions: Use exceptions for error handling (they are automatically converted to HTTP error responses)" | ||
| - "Logging: Use userver::logging for structured logging" | ||
| - "Validation: Validate input parameters and return appropriate HTTP status codes" | ||
|
|
||
| # Key components that services typically use | ||
| key_components: | ||
| core_components: | ||
| - "server: HTTP server component" | ||
| - "logging: Logging component" | ||
| - "http-client: HTTP client for making outgoing requests" | ||
| - "dns-client: DNS client component" | ||
| - "handler-ping: Health check endpoint" | ||
| - "tests-control: Testsuite control endpoint" | ||
|
|
||
| database_components: | ||
| description: "Depending on service requirements" | ||
| components: | ||
| - "postgres: PostgreSQL database component" | ||
| - "mongo: MongoDB database component" | ||
| - "redis: Redis/Valkey database component" | ||
| - "mysql: MySQL database component" | ||
|
|
||
| optional_components: | ||
| - "testsuite-support: Testsuite support component" | ||
| - "congestion-control: Congestion control component" | ||
| - "dynamic-config: Dynamic configuration component" | ||
|
|
||
| # Patterns for HTTP handlers, middleware, and error handling | ||
| implementation_patterns: | ||
| http_handler_patterns: | ||
| simple_handler: | | ||
| class MyHandler final : public userver::server::handlers::HttpHandlerBase { | ||
| public: | ||
| static constexpr std::string_view kName = "handler-my-handler"; | ||
|
|
||
| std::string HandleRequestThrow( | ||
| const userver::server::http::HttpRequest& request, | ||
| userver::server::request::RequestContext&) const override; | ||
| }; | ||
|
|
||
| request_processing: | ||
| - "Extract parameters from query string: request.GetArg(\"name\")" | ||
| - "Extract headers: request.GetHeader(\"header-name\")" | ||
| - "Set response headers: request.GetHttpResponse().SetHeader(\"header-name\", \"value\")" | ||
| - "Set response content type: request.GetHttpResponse().SetContentType(\"text/plain\")" | ||
|
|
||
| middleware_patterns: | ||
| patterns: | ||
| - "Component-Based Middleware: Implement as components that wrap handlers" | ||
| - "Handler Chaining: Use handler composition for cross-cutting concerns" | ||
| - "Request Context: Use RequestContext to pass data between middleware components" | ||
|
|
||
| error_handling_patterns: | ||
| patterns: | ||
| - "Exception-Based: Throw exceptions for error conditions" | ||
| - "HTTP Status Codes: Return appropriate HTTP status codes" | ||
| - "Structured Logging: Log errors with context information" | ||
|
|
||
| exception_example: | | ||
| if (some_error_condition) { | ||
| throw userver::server::handlers::ClientError( | ||
| userver::server::handlers::InternalError, "Error message"); | ||
| } | ||
|
|
||
| best_practices: | ||
| - "Asynchronous Operations: Use userver's asynchronous drivers for I/O operations" | ||
| - "Deadline Propagation: Propagate deadlines to downstream services" | ||
| - "Circuit Breakers: Use circuit breaker patterns for external dependencies" | ||
| - "Caching: Implement caching for frequently accessed data" | ||
| - "Rate Limiting: Implement rate limiting to protect services" | ||
| - "Start from template: start from template of service, which can be created using userver-create-service command: userver-create-service service_name [--mongo] [--postgres] [--grpc]" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # This file is used to keep the memory-bank directory in the repository. | ||
| # It can be safely deleted if the directory contains other files. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sometimes it uses userver:: namespace, sometimes not