Skip to content

Modernization Phase 2.2: modules — streamr-logger + streamr-utils (folly GMF, coro canary) [iosbuild] - #30

Merged
ptesavol merged 1 commit into
mainfrom
modernize/2.2-logger-utils
Jul 3, 2026
Merged

ptesavol merged 1 commit into
mainfrom
modernize/2.2-logger-utils

Conversation

@ptesavol

@ptesavol ptesavol commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

The phase the plan budgeted risk for: folly enters the global module fragment, and streamr-utils is the folly::coro coroutine canary. Both cleared with margin.

What's migrated

  • streamr-logger — 4 partitions (:Logger, :LoggerImpl, :SLogger, :StreamrLogLevel) + primary unit. folly's logging machinery compiles in the GMF without incident. detail/ headers get no partitions (internal API); the detail-testing LoggerEnvTest keeps its detail #include alongside import streamr.logger — mixing is the designed property of the façade.
  • streamr-utils — 21 partitions + primary. The coroutine canary (waitForEvent, waitForCondition, collect, toCoroTask — folly::coro Tasks in exported signatures) passed with zero compiler workarounds under Clang 22. The per-header opt-out budget went unused.
  • 20 test files + both examples now import; logger 63/63, utils 49/49 tests green through modules.

Mechanisms discovered (now part of the scaffolding/docs)

  1. target_compile_features(… PUBLIC cxx_std_26) is required on exported module targets — when another build tree consumes the export, CMake synthesizes a BMI-compiling target on the consumer side and hard-errors unless the standard is an exported usage requirement. Added to streamr_add_module_library(); surfaced the moment logger consumed json's export.
  2. Namespace-scope constexpr constants have internal linkage and can't be re-exported — 7 header constants became inline constexpr (the correct C++17 idiom regardless of modules).
  3. clangd-modules root cause pinned down: the quirks from 2.1 and this phase share one mechanism — clangd fails to unify std types between its preamble and types reached through BMIs, biting only where std types cross the module boundary in import-using files. One test file (toEthereumAddressOrENSNameTest.cpp, whose whole API is std types in Branded wrappers) needed the planned lint-exclusion fallback — first and only use; the compiler still typechecks it on every build. Also: bugprone-exception-escape now correctly fires on main() in import-using files (clangd sees deeper through BMIs) — real findings, fixed with function-try-blocks.

Verification

Gate Result
Package builds (26 BMIs + archives) ✅
Package tests via import ✅ logger 63/63, utils 49/49
Downstream standalone builds (proto-rpc, dht — find_package + #include) ✅ unchanged
Root tree ✅ 307/307
Full lint ✅ (one documented exclusion)
iOS cross-build this PR ([iosbuild])

Honest bench note: no incremental-rebuild improvement is expected yet — dht/trackerless-network still #include SLogger/utils headers. The measured win (the 48-TU/62–70 s SLogger.hpp baseline) arrives when those packages flip in 2.4/2.5 and their test TUs load BMIs instead of re-parsing the header stack.

Next

Phase 2.3: streamr-proto-rpc — the first :protos partition (over ProtoRpc.pb.h) and the RpcCommunicator template stack.

🤖 Generated with Claude Code

…canary) (iosbuild)

- streamr-logger: 4 partitions + primary; folly logging machinery in the
  global module fragment compiles cleanly. detail/ headers stay internal;
  the detail-testing test keeps its #include alongside import.
- streamr-utils: 21 partitions + primary; the folly::coro coroutine
  canary (waitForEvent, waitForCondition, collect, toCoroTask) passed
  with zero compiler workarounds under Clang 22.
- streamr_add_module_library() now sets target_compile_features(PUBLIC
  cxx_std_26): consumer build trees synthesize BMI-compiling targets from
  the export and require the standard in the exported usage requirements.
- 7 namespace-scope constexpr header constants -> inline constexpr
  (internal linkage cannot be exported; correct C++17 idiom regardless).
- 20 test files + 2 examples flipped to import (+small
  include-what-you-use pass).
- clangd-modules root cause documented: preamble/BMI std-type unification
  fails where std types cross the module boundary; one test file excluded
  from clangd-tidy (first use of the planned fallback). exception-escape
  on main() in import-using files fixed with function-try-blocks.

Verified: logger 63/63, utils 49/49 via import; proto-rpc/dht downstream
builds unchanged; root tree 307/307; full lint.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ptesavol
ptesavol merged commit dbb4d89 into main Jul 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant