Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,39 @@ jobs:
(cd codegen && gradle generateFixtures generateProtocolTests)
git diff --exit-code -- examples protocol-tests

# Coverage measurement for the runtime (issue #48): the combined lcov
# report + rendered HTML land as a build artifact and the per-module
# summary prints in the log, so srcs<->tests gaps stop needing a manual
# audit. Measurement only — no threshold gate yet; add one once the
# baseline has soaked (same posture as benchmarks below).
coverage:
name: coverage (runtime, lcov)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: bazel-contrib/setup-bazel@0.19.0
with:
bazelisk-cache: true
repository-cache: true
disk-cache: coverage
- name: bazel coverage
run: |
bazelisk coverage //... --config=ci --combined_report=lcov \
--instrumentation_filter='//runtime[/:]'
- name: summarize and render
run: |
sudo apt-get update -q || true
sudo apt-get install -y -q lcov
REPORT="$(bazelisk info output_path)/_coverage/_coverage_report.dat"
lcov --summary "$REPORT"
lcov --list "$REPORT"
genhtml --output-directory coverage-html "$REPORT"
cp "$REPORT" coverage-html/coverage.lcov
- uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage-html

# Informational (PLAN Phase 7): publish numbers, no pass/fail threshold yet.
benchmarks:
name: benchmarks (informational)
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,16 @@ via `git_override` until then.
content-type/method/route) the way jsonrpc2's generated suite always did —
including the previously-unasserted simpleRestJson `@pattern`-violation
wire message.
- **Union x protocol conformance cells filled** (`protocol-tests/unions/`):
the cbor and jsonRpc2 union cells — previously reliant on coin-flip random
integration tests that only prove serde self-consistency — now pin the
wire subdocument for every union variant deterministically in all four
directions (client encode/decode, server decode/echo), plus the reject
cells (empty, multi-member, unknown-member, null-member) and the `__type`
discriminator tolerance.
- **Code-coverage tooling**: a `coverage` CI job runs
`bazel coverage --combined_report=lcov` over the runtime, prints the
per-module summary, and uploads the rendered HTML report as an artifact;
`make coverage` runs the same locally. Measurement only — no gate yet.

[Unreleased]: https://github.com/aaylward/smithy-cpp/commits/main
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ fuzz-smoke:
consumer:
cd examples/bazel-consumer && $(BAZEL) test //... && ./model-evolution-check.sh

# Line coverage for the runtime; the combined lcov report path prints at the
# end (render with genhtml, or read the CI job's artifact).
.PHONY: coverage
coverage:
$(BAZEL) coverage //... --combined_report=lcov \
--instrumentation_filter='//runtime[/:]'
@echo "combined report: $$($(BAZEL) info output_path)/_coverage/_coverage_report.dat"

# Informational, never gates (PLAN Phase 7).
.PHONY: benchmarks
benchmarks:
Expand Down
5 changes: 3 additions & 2 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ make verify-full # + sanitizers, fuzzer smoke runs, the consumer module, clang
```

Each aggregate is also callable piecemeal (`make test codegen goldens lint
sanitize fuzz-smoke consumer tidy benchmarks format`); the recipes mirror
`.github/workflows/ci.yml`, one target per job. The underlying commands:
sanitize fuzz-smoke consumer tidy coverage benchmarks format`); the recipes
mirror `.github/workflows/ci.yml`, one target per job. The underlying
commands:

```sh
# C++ runtime: build + run all tests
Expand Down
40 changes: 40 additions & 0 deletions protocol-tests/unions/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
load("@rules_cc//cc:defs.bzl", "cc_test")

# Union x protocol conformance cells (issue #48): union round-tripping was
# only pinned for simpleRestJson; the cbor and jsonRpc2 cells relied on
# seeded random integration tests that flip a coin on whether the union
# appears and can only prove serde self-consistency. These suites pin the
# wire subdocument for every SinkChoice variant deterministically — client
# encode/decode and server decode/echo — plus the reject cells and the
# __type discriminator tolerance. Hand-written (not generated), so they
# live outside the golden generated/ trees.

cc_test(
name = "union_cbor_test",
size = "small",
srcs = ["union_cbor_test.cc"],
deps = [
"//examples/roundtrip/rpc/generated:client",
"//examples/roundtrip/rpc/generated:server",
"//runtime:cbor",
"//runtime:client",
"//runtime:http",
"//runtime:protocol_test_support",
"@googletest//:gtest_main",
],
)

cc_test(
name = "union_jsonrpc2_test",
size = "small",
srcs = ["union_jsonrpc2_test.cc"],
deps = [
"//examples/roundtrip/jsonrpc/generated:client",
"//examples/roundtrip/jsonrpc/generated:server",
"//runtime:client",
"//runtime:http",
"//runtime:json",
"//runtime:protocol_test_support",
"@googletest//:gtest_main",
],
)
Loading
Loading