feat!: assert MethodDone is only called while executing a method#1270
feat!: assert MethodDone is only called while executing a method#1270André Jordan (andjordan) wants to merge 1 commit into
Conversation
Dependency ReviewThe following issues were found:
Snapshot WarningsConsider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. License Issuesexternal/crypto/mbedtls/CMakeLists.txt
osal/freertos/CMakeLists.txt
external/segger_rtt/CMakeLists.txt
lwip/lwip/CMakeLists.txt
external/protobuf/CMakeLists.txt
osal/threadx/CMakeLists.txt
external/crypto/micro-ecc/CMakeLists.txt
cmake/emil_test_helpers.cmake
external/args/CMakeLists.txt
infra/syntax/CMakeLists.txt
external/crypto/tiny-aes128/CMakeLists.txt
OpenSSF ScorecardScorecard details
Scanned Files
|
✅
|
| Descriptor | Linter | Files | Fixed | Errors | Warnings | Elapsed time |
|---|---|---|---|---|---|---|
| ✅ ACTION | actionlint | 11 | 0 | 0 | 0.26s | |
| ✅ ACTION | zizmor | 11 | 0 | 0 | 0 | 5.24s |
| ✅ CPP | clang-format | 1096 | 8 | 0 | 0 | 8.65s |
| ✅ DOCKERFILE | hadolint | 2 | 0 | 0 | 0.25s | |
| ✅ JSON | jsonlint | 7 | 0 | 0 | 0.3s | |
| ✅ JSON | prettier | 7 | 0 | 0 | 0 | 0.5s |
| markdownlint | 8 | 0 | 5 | 0 | 1.08s | |
| ✅ MARKDOWN | markdown-table-formatter | 8 | 0 | 0 | 0 | 0.22s |
| ✅ REPOSITORY | checkov | yes | no | no | 33.6s | |
| ✅ REPOSITORY | git_diff | yes | no | no | 0.07s | |
| ✅ REPOSITORY | grype | yes | no | no | 60.02s | |
| ✅ REPOSITORY | ls-lint | yes | no | no | 0.06s | |
| osv-scanner | yes | 1 | no | 1.01s | ||
| ✅ REPOSITORY | secretlint | yes | no | no | 15.25s | |
| ✅ REPOSITORY | syft | yes | no | no | 2.92s | |
| ✅ REPOSITORY | trivy | yes | no | no | 18.07s | |
| ✅ REPOSITORY | trivy-sbom | yes | no | no | 0.22s | |
| ✅ REPOSITORY | trufflehog | yes | no | no | 4.53s | |
| lychee | 140 | 2 | 0 | 121.98s | ||
| prettier | 21 | 1 | 1 | 0 | 0.65s | |
| ✅ YAML | v8r | 21 | 0 | 0 | 9.19s | |
| ✅ YAML | yamllint | 21 | 0 | 0 | 0.77s |
Detailed Issues
⚠️ SPELL / lychee - 2 errors
📝 Summary
---------------------
🔍 Total..........697
🔗 Unique.........661
✅ Successful.....690
⏳ Timeouts.........0
🔀 Redirected.....310
👻 Excluded.........5
❓ Unknown..........0
🚫 Errors...........2
⛔ Unsupported......2
Errors in .github/CODE_OF_CONDUCT.md
[ERROR] https://www.contributor-covenant.org/ (at 76:42) | Network error: Connection reset by peer (os error 104)
Errors in external/protoc/CMakeLists.txt
[404] https://github.com/protocolbuffers/protobuf/releases/download/v$%7Bprotobuf_tag%7D/protoc-$%7Bprotobuf_version%7D-$%7Bos_postfix%7D.zip (at 18:13) | Rejected status code: 404 Not Found
Hint: Followed 310 redirects. You might want to consider replacing redirecting URLs with the resolved URLs. Use verbose mode (`-v`/`-vv`) to see redirection details.
Hint: You can configure accepted/rejected response codes with `-a` or `--accept`
⚠️ MARKDOWN / markdownlint - 5 errors
.github/instructions/microtest.instructions.md:7 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## Google Test Suite Coding Ru..."]
external/crypto/tiny-aes128/README.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "### Tiny AES128 in C"]
external/crypto/tiny-aes128/README.md:29 error MD046/code-block-style Code block style [Expected: fenced; Actual: indented]
external/crypto/tiny-aes128/README.md:39 error MD046/code-block-style Code block style [Expected: fenced; Actual: indented]
external/crypto/tiny-aes128/README.md:49 error MD046/code-block-style Code block style [Expected: fenced; Actual: indented]
⚠️ REPOSITORY / osv-scanner - 1 error
Scanning dir .
Starting filesystem walk for root: /
Scanned external/segger_rtt file and found 0 packages
Scanned external/args file and found 0 packages
Scanned external/protobuf file and found 0 packages
Scanned external/protoc file and found 0 packages
Scanned external/crypto file and found 0 packages
End status: 155 dirs visited, 1615 inodes visited, 5 Extract calls, 889.207481ms elapsed, 889.207696ms wall time
No package sources found, --help for usage information.
⚠️ YAML / prettier - 1 error
[error] Explicitly specified pattern "documents/modules/ROOT/examples/clangformat.yaml" is a symbolic link.
.clusterfuzzlite/project.yaml 38ms (unchanged)
.github/dependabot.yml 15ms (unchanged)
.github/workflows/ci.yml 58ms (unchanged)
.github/workflows/dependency-scanner.yml 19ms (unchanged)
.github/workflows/documentation.yml 12ms (unchanged)
.github/workflows/fuzzing-batch.yml 5ms (unchanged)
.github/workflows/fuzzing-cron.yml 6ms (unchanged)
.github/workflows/fuzzing-pr.yml 5ms (unchanged)
.github/workflows/linting-formatting.yml 10ms (unchanged)
.github/workflows/release-please.yml 8ms (unchanged)
.github/workflows/security.yml 8ms (unchanged)
.github/workflows/static-analysis.yml 8ms (unchanged)
.github/workflows/validate-pr.yml 13ms (unchanged)
.ls-lint.yml 2ms
.mega-linter.yml 3ms (unchanged)
antora-playbook-branch.yml 5ms (unchanged)
antora-playbook-site.yml 3ms (unchanged)
documents/antora.yml 2ms (unchanged)
documents/supplemental-ui/ui.yml 1ms (unchanged)
mull.yml 1ms (unchanged)
Notices
📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)
See detailed reports in MegaLinter artifacts
Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)
- Documentation: Custom Flavors
- Command:
npx mega-linter-runner@9.5.0 --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,ACTION_ZIZMOR,CPP_CLANG_FORMAT,DOCKERFILE_HADOLINT,JSON_JSONLINT,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GRYPE,REPOSITORY_LS_LINT,REPOSITORY_OSV_SCANNER,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,SPELL_LYCHEE,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

Show us your support by starring ⭐ the repository
There was a problem hiding this comment.
Pull request overview
This PR hardens the protobuf Echo service lifecycle by asserting that Service::MethodDone() is only invoked while a method is being executed, and refactors the service entrypoint to route through a non-virtual StartMethod() wrapper that tracks execution state before dispatching to a new StartMethodImpl() override.
Changes:
- Add execution-state tracking to
services::Serviceand enforce it viareally_assertinMethodDone(). - Rename/route service method-start overrides from
StartMethodtoStartMethodImpl(including generated code via the protoc Echo plugin). - Update tests to exercise the new assertion and adjust FlashEcho tests to invoke calls through a proxy/send-grant flow.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| services/util/test/TestFlashEcho.cpp | Updates tests to send Flash RPCs via FlashProxy::RequestSend() so service methods run under the proper Echo method-execution lifecycle. |
| protobuf/protoc_echo_plugin/ProtoCEchoPlugin.cpp | Updates code generation to emit StartMethodImpl overrides instead of StartMethod. |
| protobuf/echo/test/TestEcho.cpp | Adds a death test verifying MethodDone() aborts when called without an active method. |
| protobuf/echo/test_doubles/ServiceStub.hpp | Renames the service override to StartMethodImpl to match the new Service contract. |
| protobuf/echo/test_doubles/ServiceStub.cpp | Renames the implementation to StartMethodImpl accordingly. |
| protobuf/echo/ServiceForwarder.hpp | Refactors the forwarder to override StartMethodImpl (and adjusts access section). |
| protobuf/echo/ServiceForwarder.cpp | Renames the forwarder implementation to StartMethodImpl. |
| protobuf/echo/Echo.hpp | Introduces StartMethod() wrapper + StartMethodImpl() pure virtual and adds executingMethod state. |
| protobuf/echo/Echo.cpp | Implements StartMethod() wrapper and enforces MethodDone() assertion/reset behavior. |
| infra::SharedPtr<MethodDeserializer> Service::StartMethod(uint32_t serviceId, uint32_t methodId, uint32_t size, const EchoErrorPolicy& errorPolicy) | ||
| { | ||
| executingMethod = true; | ||
| return StartMethodImpl(serviceId, methodId, size, errorPolicy); | ||
| } |
|



A
services::Serviceimplementation must not callMethodDoneoutside of executing a dispatched method. This adds areally_assertguard in theServicebase class to catch spurious or doubleMethodDonecalls.