Skip to content

fix(test): match JWT metrics stubs to public API - #86

Merged
gg582 merged 1 commit into
devfrom
fix/25-jwt-metric-stub-types
Sep 13, 2026
Merged

gg582 merged 1 commit into
devfrom
fix/25-jwt-metric-stub-types

Conversation

@DPS0340

@DPS0340 DPS0340 commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix the metrics test doubles in tests/test_middleware_jwt.c to match the public API. Include metrics.h so later signature drift is diagnosed during compilation, including builds without LTO.

The old stubs omitted the metric ID parameter from cwist_metric_inc and used the wrong parameter count/types for cwist_metric_add. The registry stub also returned an untyped pointer. The stubs remain no-ops; JWT assertions and runtime code are unchanged. No compiler warning or sanitizer check is disabled.

Reproduction

On pristine dev 65632aed0a30e8aabe1519aa9b706e19685c2b4b, Linux/aarch64 GCC with the repository's normal optimization/LTO flags:

make -j4 WERROR=1 libcwist.a
make WERROR=1 test_middleware_jwt

The library builds, but linking the test fails with -Werror=lto-type-mismatch for cwist_metric_inc and cwist_metric_add. The same failure reproduces in the #84 integration tree. Fresh source timestamps forced rebuilds; an earlier stale-build control was discarded.

Validation

  • Linux/aarch64 normal GCC LTO: test_middleware_jwt, test_jwt, test_metrics all pass with WERROR=1.
  • ASan/UBSan: the same three target groups pass; existing repository LSan suppressions remain enabled.
  • Public-header regression guard: correct stubs compile without LTO; a temporary wrong metric-ID type is rejected with a conflicting-types diagnostic. The mutation is not committed.
  • Test wiring, allocator baseline gate, and diff whitespace checks pass. The full repository suite was not rerun for this isolated test-only change.

This is a test-only prerequisite found while validating #84 during the #25 investigation, not a P99.999 latency fix. It does not restore FIXED caching or change runtime defaults.

@thegoodengineer thegoodengineer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Properly aligns the metrics test doubles with the public signatures in metrics.h and resolves -Werror=lto-type-mismatch under LTO builds.

@gg582

gg582 commented Sep 13, 2026

Copy link
Copy Markdown
Member

LGTM. +11 lines, -3 lines. That's a small patch. IMO we can merge this right now.

@gg582
gg582 marked this pull request as ready for review September 13, 2026 16:18
@gg582
gg582 merged commit 782efd3 into dev Sep 13, 2026
10 checks passed
@gg582
gg582 deleted the fix/25-jwt-metric-stub-types branch September 14, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants