Repository navigation
fix: only the winning experiment is exposed for a shared variable key - #7
Conversation
Fails on main: an unassigned lower-id candidate (strict audience mismatch, no unit) and a winner on an arm without the key were exposed too, and a later candidate supplied the value when the winner's arm lacked the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
variable_value() exposed every candidate it visited and both reads fell through to a later experiment when the winner's arm did not define the key. The winner is now the first candidate by id the unit is assigned, overridden or rule-assigned to; its variant supplies the value or the caller default, and only it is exposed. Matches the Java SDK's Context.getVariableAssignment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…didate still wins a shared key Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…xposed for treatment() Also say in the README and CHANGELOG that a unit outside the traffic split still wins with the control value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ttribute change and refresh The v1.0.0 notes were still under Unreleased, so the shared-key entry read as part of the released version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed winner Also say in the CHANGELOG that a key defined by one experiment no longer exposes a unit outside it, and how an out-of-range override now resolves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent sdk-review on 6223db2: COMMENT (no P1/P2), 7 P1/P2 fixed across 6 reviewer passes Earlier passes and what was fixed, all test gaps or docs, no production defect found:
Final reviewer report: .git/sdk-review/6223db2…mdCOMMENT at Compared the released v1.0.0 (GitHub release tarball; its headers are byte-identical to tag Must fixNone at P1 or P2 against the brief given for this change. Owner call (blocks merge until decided, not a code defect)
Tests needed (current implementation correct)15 full-suite mutations: 15 killed, 0 survived (1 mutant first failed to compile; I fixed the patch and reran it). These include the old main rule (expose every visited candidate), fall-through on a missing key, payload-order indexing, descending-id walk, dropping Compatibility / parity / forward-compat evidence
PerformanceWarmed cached reads, 2,000,000 iterations, P3 / notes
Version and release notes
Pre-existing on main (not this PR)
Verification limits / provenance: gcc 15.2 only (no clang installed). No CI run exists for this head: the branch is not pushed and there is no PR ( sdk-review evidence: cpp-sdk (branch fix/shared-variable-key-winner, no PR)
1. Trees
2. Backwards compatibility
3. Parity
4. Tests and mutation
5. Performance
6. Forward compatibilityNOT RUN: the diff does not touch models.h or decoding; the released test suite passes on head. 7. Build / CI
8. Docs / CHANGELOG
Findings
Verification limits
|
|
No actionable comments were generated in the recent review. WalkthroughThe change adds a helper that selects the first qualifying experiment in ID order for a shared variable key. Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: Merge Risk:
|
…er without the key Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…le is replaced Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…assigned shared-key candidate win Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ure does not disturb the read Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent sdk-review on c45201b: APPROVE (no P1/P2), 1 P1/P2 fixed across 2 reviewer passes
Final reviewer report: .git/sdk-review/c45201b….mdAPPROVE at Compared GitHub release Must fixNone. No P1/P2 found. Tests needed (current implementation correct)20 full-suite mutations: 20 killed, 0 survived. That is 17 on the resolver and read APIs, plus 3 extra ones aimed at the fix commits. Every mutant was run against the full 156-case suite.
Compatibility / parity / forward-compat evidence
PerformanceWarmed
The 1 alloc/op is the returned P3 / notes
Version and release notes
Pre-existing on main (not this PR)
Verification limits / provenance:
sdk-review evidence: cpp-sdk#7
1. Trees
Version source / X-Agent / CHANGELOG heading: CMake 2. Backwards compatibility
3. Parity
4. Tests and mutation
Totals: 20 run / 20 killed / 0 survived. After each mutant the source was restored, rebuilt and the suite re-run: 156/156. Worktree
5. Performance
6. Forward compatibility
7. Build / CI
8. Docs / CHANGELOG
Findings
Verification limits
|
|
P3-only follow-up on top of the gated c45201b: 3b1915e adds one test section and changes no production code. It is the final reviewer's optional P3: a The reviewer's other two P3s (CI on the new head; the PR body is stale) are handled by this push and the updated Status section. |
|
Review submitted The automated review has been submitted. See the review for the verdict and any findings. Head: |
|
Question Q1 — Simplify the shared-key refresh fixture Is the provider-backed refresh in the winner-removal test meant to pin a separate contract, or can the test call refresh(data_of({high_exp()})) directly and drop the one-use provider fixture? Context: tests/shared_variable_key_test.cpp:93–105,388–395; FixedDataProvider has one use. The baseline Context refresh/cache-invalidation tests already exercise provider-backed refresh, and refresh() forwards fetched data to refresh(const ContextData&) in src/context.cpp:568–580. The new logger test also uses the direct overload. I found no provider-specific requirement in the PR description or review discussion. Why I'm asking: If the test only needs to cover winner removal, the direct overload exercises the same index rebuild and avoids a test-only provider class and promise. Suggested answers (free text is always welcome):
@joalves, please include |
jervasion-absmartly
left a comment
There was a problem hiding this comment.
❌ Changes requested
The new resolver implements the intended winner-only rule for ordinary reads. I found two cases where the SDK can return the wrong value or record an exposure that does not match it, plus one regression test that still passes when the behavior it names is broken.
Next step: Make the value and exposure agree across refresh and logger callbacks, and strengthen the refresh regression test.
Must fix
- Bind overrides cached before an experiment arrives — a prior
peek()can make a newly loaded winner return the default and publish an exposure with ID0.src/context.cpp:311 - Keep the returned value aligned with the recorded exposure — a synchronous logger can change the cached arm before the read returns.
src/context.cpp:332 - Make the callback-refresh test distinguish the in-flight read from the next lookup — the current test passes even if the resolver looks up the key again after the callback.
tests/shared_variable_key_test.cpp:398
Suggestions (optional)
- One possible test-fixture simplification and four redundant comment blocks are noted in the review details.
Unanswered author questions
- Q1: Simplify the shared-key refresh fixture — whether provider-backed refresh is intentional determines whether the one-use fixture can be removed. This does not affect the verdict.
What I checked
- ✅ The local Release build and all 156 CTest cases passed, including 15 shared-key cases.
- ✅ Both exact-head GitHub CI runs passed build, test, package, and package-consumer checks.
- ✅ The focused probe confirmed the intended ordinary winner selection and reproduced both incorrect results above. A separate mutation run confirmed the refresh test gap.
Review details
Head: 3b1915e5f30416a146cba17d469a4738394a77c3
Base, merge base and responsibility baseline: 1c628e4dee98c24ec16a697bb382363d89bad723
Round: 1 (initial).
The owner decision recorded in the PR replaces the previously shipped JS-style fall-through with the Java selection rule. I checked the cited Java revision (9b2414bf40ee5b51b0f690d099b7c4e6ce7a5187): ordinary winner selection and missing-key fallback match; Java-only holdouts are out of scope. Both public getters are affected, as are the exposure records handed to the publisher. treatment() and public signatures are unchanged. The changelog describes the change for shared and single-experiment keys. The separate conformance PR, absmartly/cross-sdk-tests#52, is open; I did not rerun its cross-SDK suite or treat the older JS scenarios as an exact-head gate.
Commands and results: git diff --check 1c628e4d HEAD passed; cmake -S . -B /workspace/cpp7-build -DCMAKE_BUILD_TYPE=Release -DABSMARTLY_BUILD_TESTS=ON, cmake --build /workspace/cpp7-build --parallel 4, ctest --test-dir /workspace/cpp7-build --output-on-failure and cmake --build /workspace/cpp7-build --target package passed (156/156; TGZ and ZIP). g++ -std=c++17 -Wall -Wextra -Wpedantic -Werror -fsyntax-only passed on src/context.cpp with the configured JSON headers. The public-API probe ran against the exact-head library and then with the merge-base context.cpp object; the production-only mutation likewise replaced only that object and ran the unchanged Catch2 suite (1601 assertions, 156 cases). Actions runs 45439925244 and 45439907790 both reported Build & test successful for the exact SHA.
Passes (non-blocking): run: core runtime/API/data (resolver and exposure path); dedicated error-handling specialist completed (default/failure paths, callback and publisher behavior); tests/CI/packaging (new registered test file and public behavior); deployment/operations/observability (changed exposure emission and collector payload); cross-cutting simplicity; comment hygiene; diff composition. Not run: shared-component UI (no frontend files); behaviour-bearing data/policy (no runtime data, schema or policy files; test fixtures are embedded in the compiled C++ tests and were reviewed there).
Comment hygiene (non-blocking): 26 comment / 375 code lines, ratio ~1:14.4, 4 blocks flagged.
threshold T=5; restatements counted: no (10 × C < E)
include/absmartly/context.h:136–137— restates the returned winner/pair and null case.tests/shared_variable_key_test.cpp:47— restates that the adjacent fixtures define the key only in variant 1.tests/shared_variable_key_test.cpp:56— restates the strict-mismatch fixture.tests/shared_variable_key_test.cpp:62— restates the missing-unit fixture.
Diff composition (non-blocking): every file is required for the change; none flagged. The pinned helper enumerated 20 content writes across the 11 PR commits; checked their paths and contents, including replaced versions. README endpoint and key examples are placeholders.
Simplifications (non-blocking): 1 candidate.
- If the winner-removal test is not meant to cover provider-backed fetching, use the direct
refresh(data)overload and remove the one-useFixedDataProvider(roughly 10 fewer code lines; equivalence not established while Q1 is open).
Run a simplification pass locally before pushing: these candidates cost less to address now than as a further review round.
…shes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jervasion-absmartly
left a comment
There was a problem hiding this comment.
❌ Changes requested
All three blockers from the previous review still reproduce on the unchanged head. The Java-style winner rule is not in dispute.
Next step: Address the three existing threads; no new blockers were found.
Must fix
- Bind an override cached before its experiment arrives — after refresh, the read must use the loaded experiment's value and exposure metadata, not the placeholder's default and ID
0. - Keep the returned value and queued exposure on the same arm — an override change inside the exposure logger can affect later reads, but must not change the value returned by the in-flight read.
- Make the logger-refresh test distinguish the original read from a fresh lookup — the test must fail if the read reselects its winner after the callback.
Suggestions (optional)
- One possible fixture simplification and four redundant comment blocks are listed below.
Unanswered author questions
- Q1: Simplify the shared-key refresh fixture — whether provider-backed refresh is intentional determines whether the one-use fixture can be removed. This does not affect merge readiness.
What I checked
- ✅ Local Release build, all 156 CTest cases, and both package archives passed.
- ✅ Both exact-head GitHub Actions runs passed, including the package-consumer checks.
- ✅ An independent recheck reproduced both runtime defects and confirmed that the callback-refresh test still passes with a re-lookup mutation that changes the in-flight result. Failed refresh and publish/retry behavior also worked as expected.
Review details
Head: 3b1915e5f30416a146cba17d469a4738394a77c3
Base, merge base and responsibility baseline: 1c628e4dee98c24ec16a697bb382363d89bad723
Round: 2 (review_requested). No source changes since round 1 and no reply addressing the three findings. Existing inline threads carry the reproduction details; no duplicate inline comments.
The PR deliberately replaces JS-style fall-through with the Java rule for the public variable getters and ordinary exposure records. C++ holdouts and the separate cross-SDK conformance PR are out of this change's scope. The failure-path specialist confirmed that refresh-provider and publish errors retain the expected recovery behavior; the two reproduced defects are in the public return value and the SDK's queued exposure record, not an assumption about collector acceptance. The mutation finding is about the in-flight result named by the test, not the narrower invalidated-iterator guard the test also provides.
Validation: git diff --check 1c628e4d HEAD; cmake -S . -B /workspace/cpp7-r2-build -DCMAKE_BUILD_TYPE=Release -DABSMARTLY_BUILD_TESTS=ON; cmake --build /workspace/cpp7-r2-build --parallel 3; ctest --test-dir /workspace/cpp7-r2-build --output-on-failure --quiet; absmartly_tests '[shared-variable-key]' (109 assertions / 15 cases); cmake --build /workspace/cpp7-r2-build --target package; and strict C++17 syntax checking of src/context.cpp (-Wall -Wextra -Wpedantic -Werror). Actions runs 45439925244 and 45439907790 both completed successfully. The independent error pass reran the public-API scenarios and the unmodified callback-refresh section against the production-only mutation.
Passes (non-blocking): run: core runtime/API/data (winner selection, assignment cache and callback lifetime); dedicated error-handling specialist completed (fallback, logger, refresh and publisher failures); tests/CI/packaging (new Catch2 translation unit, unchanged workflow and both consumers); deployment/operations/observability (changed exposure event emission and payload); cross-cutting simplicity; comment hygiene; diff composition. Not run: shared-component UI (no frontend files); standalone behaviour-bearing data/policy pass (no standalone runtime data, schema, or policy changed; embedded fixtures covered in the test pass).
Comment hygiene (non-blocking): 26 comment / 375 code lines, ratio ~1:14.4, 4 blocks flagged.
threshold T=5; restatements counted: no (10 × C < E)
include/absmartly/context.h:136–137— restates the winner pair and null case.tests/shared_variable_key_test.cpp:47— restates the adjacent variant fixtures.tests/shared_variable_key_test.cpp:56— restates the strict-mismatch fixture.tests/shared_variable_key_test.cpp:62— restates the missing-unit fixture.
Diff composition (non-blocking): every file is required for the change; none flagged. The pinned history audit enumerated the same 20 content writes across 11 commits; exact head and baseline match the content audit from round 1.
Simplifications (non-blocking): 1 candidate.
- If provider-backed fetching is not part of the winner-removal test's purpose, use direct
refresh(data)and remove the one-useFixedDataProvider(roughly 10 fewer code lines; equivalence not established while Q1 is open).
Run a simplification pass locally before pushing: these candidates cost less to address now than as a further review round.
…and exposed-candidate cases Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s; note the post-refresh re-exposure Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Q1 (#7 (comment)): the test only needs to pin winner removal, so the direct refresh is enough. In 8e7d29c the winner-removal test calls |
|
Independent sdk-review on 63a3780: APPROVE (no P1/P2), 3 P1/P2 fixed across 2 reviewer passes This round fixes Jervasion's round-1 findings on 3b1915e.
The final reviewer's P3s, plus Jervasion's optional comment-hygiene points and Q1, are handled in the P3-only follow-ups 94a5440 and 8e7d29c (see the next comment). The CHANGELOG entry stays under Fixed, as the owner asked. Final reviewer report: .git/sdk-review/63a3780….mdAPPROVE at Compared GitHub release Must fixNone. No P1/P2 found. Tests needed (current implementation correct)20 full-suite mutations (all 159 cases each): 19 killed, 1 survived.
Compatibility / parity / forward-compat evidence
PerformanceOrdinary path, warmed, pinned to 1 CPU, -O2, 2M iterations × 2 runs. The fixture is 3 experiments: a shared key P3 / notes
Version and release notesCMake is still Pre-existing on main (not this PR)
Verification limits / provenance:
sdk-review evidence: #7
1. Trees
2. Backwards compatibility
3. Parity
4. Tests and mutation
Totals: 20 run / 19 killed / 1 survived (M10 → P3 test gap).
5. Performance
6. Forward compatibility
7. Build / CI
8. Docs / CHANGELOG
Findings
Verification limits
|
|
P3-only follow-up on top of the gated 63a3780. No production code changed in either commit.
Locally: 160/160 tests pass. |
|
Independent sdk-review on 8e7d29c: APPROVE (no P1/P2), 0 P1/P2 fixed across 1 reviewer pass This is a fresh gate on the exact PR head. The reviewer raised two P3s. I am not acting on either, so this head and the pending Jervasion request stay as they are:
If Jervasion raises either point, I'll address it in its batch. Reviewer report: .git/sdk-review/8e7d29c….mdAPPROVE at Compared GitHub release Verified fixed since
|
| read | main | head |
|---|---|---|
variable_value(s) |
66.2 | 68.0 |
peek_variable_value(s) |
65.0 | 66.6 |
variable_value(k) |
106.4 | 112.6 |
peek_variable_value(k) |
105.8 | 108.8 |
Allocations per warmed read: 0.00 on both trees for all four. Control reads this PR does not touch (peek()/treatment()): main 36.4-36.7 / 36.9-37.4, head 37.5-37.7 / 37.7-37.9 in the default build, and equal (36.4-36.7 vs 36.5-36.7) when both libraries are built with -falign-functions=64, while variable_value(k) stays slower in that build (105.0-113.4 vs 108.4-111.5, noisier). So roughly 2-6 ns/op (≈2-6%) appears attributable to the change, probably the out-of-line resolver call plus the value copy taken before the exposed check; forcing the resolver inline recovered most of the peek_variable_value(k) gap but not all of variable_value(k). The 63a3780 review measured head 2-3% faster with a different fixture, so the sign is not robust across fixtures. Hardware instruction counters are blocked in this sandbox (perf_event_open: EPERM), so I could not get a deterministic count. Synthetic, steady-state, single-thread; not end-to-end. No new cache or memo, so no counter test is needed.
P3 / notes
- P3 performance, small measured slowdown on warmed shared-key reads (
src/context.cpp:302-348). Numbers above: +1.6-1.8 ns single-key, +3.0-6.2 ns shared-key, 0 allocations either side, sign differs from the previous review's fixture. I file it as P3 rather than P2 because it is a few ns, allocation-free, not reproducible in sign across fixtures, and production behaviour is correct; if the owner applies the "any measured ordinary-path regression is P2" bar literally, it moves up. Optional: makevariable_assignmentinlinein the .cpp (it has two callers) and, invariable_value, return the found value directly whenassignment->exposedis already true, then re-measure. - P3 doc, id-0 late load is not rebound (
src/context.cpp:621). Measured: an override cached before an experiment with id 0 loads keeps the unbound assignment after refresh (value = default, 1 exposure with id 0). That is the deliberate cost of theid != 0guard (the id-0 loaded case would otherwise re-expose forever, pinned attests/shared_variable_key_test.cpp:131), and the backend never sends id 0. Optional: add "(experiments with id 0 are not rebound)" to the CHANGELOG sentence, or leave as is. - Not a finding. Exposure counts drop for unassigned single-key experiments, and there is no fall-through. That is the owner's rule, documented under Fixed. Do not restore the old behaviour.
- Not a finding. The C++ rebind of a late-loaded override is an owner-requested extension (Java and JS do not rebuild a cached override when its experiment loads). It is documented in the CHANGELOG.
- Housekeeping, not this PR. The repo has six stale worktrees registered from earlier review runs (
/tmp/sdkrev.0iMc/*,/tmp/sdkrev.jBgT/*). Mine were removed; those were left as found.
Version and release notes
CMake is 1.0.0; the entry is under ## Unreleased / ### Fixed; the PR adds the missing ## 1.0.0 (2026-11-16) heading over the released notes without rewriting them (0 removed lines in the CHANGELOG diff from v1.0.0). Owner call (decided): the skill's bar files customer-visible exposure changes under Changed; the owner explicitly asked for Fixed, so it stays. Owner call (open): the next tag. Exposure counts move, so 1.1.0 is safer than 1.0.1; recommendation 1.1.0.
Pre-existing on main (not this PR)
- None found that bears on this diff. v1.0.0..main changes 0 lines in
src/.
Verification limits / provenance: All builds and runs on aarch64, GCC 15.2, CMake 4.2; Clang not installed (not run). Official cross-sdk-tests wrapper lane not run (cpp-wrapper needs cpp-sdk#6's switchback.h); scenario counts come from my own runner. Hardware perf counters unavailable (EPERM), so performance is wall-clock only. CI on this exact head: run 45910526705 (pull_request) and 45910520855 (push), "Build & test" success. No JS/numeric-edge vectors run: the diff touches no hashing, split, numeric or header code. Published-registry step not applicable (no registry; GitHub tag v1.0.0 used as release).
sdk-review evidence: #7
- Head:
8e7d29c058a7128d8cd96317cb203e1bb24702b4(gh pr view 7 --json headRefOid→ same;git ls-remoterefs/pull/7/head → same) - Mode: independent reviewer (read-only)
- Previous pass / review:
63a378038bffb4a03bac2f132b782b000958f4c8(commits since: 2 —94a5440test id-0 overridden winner, drop comments, CHANGELOG re-exposure note;8e7d29ctest uses directrefresh(data)overload) - Scratch:
/tmp/tmp.zjC09Cyf8l(worktrees removed at the end;git status --short→ 0 lines) - Finished (UTC): 2026-11-27T10:24Z
1. Trees
| Tree | Identifier | How obtained | Verified |
|---|---|---|---|
| Released | GitHub tag v1.0.0 (9ea8669); no package registry |
git tag → v1.0.0; git worktree add rel v1.0.0 |
tag commit |
| Main / merge base | 1c628e4 |
git merge-base origin/main HEAD |
== origin/main |
| Head | 8e7d29c |
git rev-parse HEAD |
== PR head |
Version source / CHANGELOG: CMakeLists.txt:2 VERSION 1.0.0; CHANGELOG ## Unreleased above ## 1.0.0 (2026-11-16); `git diff v1.0.0 HEAD -- CHANGELOG.md |
grep -c '^-[^-]'` → 0 (released notes not rewritten). | ||
git diff --quiet 63a3780 HEAD -- src → SRC_IDENTICAL. git diff --stat 63a3780 HEAD → CHANGELOG (+2/-1), context.h (-2 comment lines), shared_variable_key_test.cpp (+15/-22). |
2. Backwards compatibility
- API diff:
git diff v1.0.0 HEAD -- include→ context.h only: +<utility>, +privatevariable_assignment, +test-only friend (main), comment changes.nm -C --defined-only lib | grep Context::main vs head → +1 private symbol, 0 removed. sizeof Context/Assignment/Exposure: rel 736/184/96, main 736/184/96, head 736/184/96. - Consumer probe (
/tmp/tmp.zjC09Cyf8l/consumer,find_package(absmartly-sdk)againstcmake --installof each tree; logger subclass + both reads + variable_keys): rel ✓1 2 0, main ✓1 2 0, head ✓1 2 0. (ABI run-old-on-new not applicable: static library.) - Released tests vs head lib (src+include of head swapped into rel/main trees): release 140 cases / 1474 assertions pass; main 141 / 1492 pass; head own 160 / 1624 pass. Extra failures: none.
- Head's new tests on main lib (
[shared-variable-key]): 19 cases, 7 passed, 12 failed; 84 assertions, 20 failed. - No-rule behaviour sweep (
probe/sweep.cpp, 12 UIDs × 5 experiments × 4 keys):cmp s-rel.txt s-main.txt→ identical. Head differs only in documented classes (see review);treatment()variants identical 12/12; peek pending 0 on all trees; vv pending main 5/4 → head 2. - Error/null/logging contract:
check_ready(true)kept on both reads; default returned for unknown key on all trees (nope=D); no new events or event types. - Public fields/hooks whose effect changed: none (no public field touched).
- Entry points: constructor-with-data (all tests),
refresh(ContextData)andrefresh()via provider (tests at 63a3780; now direct overload) ×variable_value/peek_variable_value/treatment/peek. Fetch/future path shares the sameContextinternals (not separately probed).
3. Parity
- Java reference:
gh api repos/absmartly/java-sdk/contents/core-api/src/main/java/com/absmartly/sdk/Context.java(main),getVariableAssignmentat line 2077,getVariableValue727,peekVariableValue779: same winner predicate and default-on-missing-key; holdout/switchback branches N/A. - JS: superseded by owner decision (not compared).
- Numeric edge table: NOT RUN — diff touches no hashing/split/numeric/header code.
- cross-sdk-tests:
git clone --branch consolidate/sdk-round-2026-11→14c967f; runnerrunner/r.cpp(result + event subset match) over 340-368: 22 eligible / 7 skips of 29 (357 358 359 360 366 367 368: holdouts/switchback). Head pass=22 fail=0; main pass=13 fail=9 (340 341 347 348 349 351 356 361 362). Official cpp-wrapper build: failsabsmartly/switchback.h: No such fileon both main and head (wrapper pinned to cpp-sdk#6).
4. Tests and mutation
- Full suite on head: Release 160 cases / 1624 assertions pass; Debug ASan+UBSan 160/160; Debug
-Wall -Wextra -Wpedantic -Werrorbuilds, 160/160. - Harness:
tools/mut.py(one mutant at a time on a copy of head, incremental rebuild, full suite).
| # | Mutant (src/context.cpp) | Failing cases | Result |
|---|---|---|---|
| M1 | winner ignores overridden (:311) |
7 (context_test, shared_variable_key_test) | killed |
| M2 | winner ignores rule_override |
2 (assignment_rules_test, shared) | killed |
| M3 | winner ignores assigned |
18 | killed |
| M4 | fall-through when winner lacks key | 3 (shared) | killed |
| M5 | expose every visited candidate (old behaviour) | 14 (+ segfault rc -11) | killed |
| M6 | peek_variable_value exposes the winner |
5 | killed |
| M7 | value re-resolved after exposure (no snapshot) | 2 (shared) | killed |
| M8 | no rebind (drop !unbound, :622) |
1 (shared) | killed |
| M9 | rebind ignores data->id != 0 (:621) |
1 (shared, new id-0 test) | killed |
| M10 | rebind on every read | 6 | killed |
| M11 | re-expose on every variable_value |
4 | killed |
| M12 | candidates in descending id | 8 | killed |
| M13 | variable_value never exposes |
16 | killed |
| M14 | winner requires has_variables |
1 (shared) | killed |
| Totals: 14 run / 14 killed / 0 survived. |
Standard-set items not applicable (no rule-scope, app_version, header, decoder, numeric or cache code in this diff).
- Fix-commit audit (commits since
63a3780):
| Commit | New state | Where else it must be set/cleared/read | Entry points skipping it | Mutant |
|---|---|---|---|---|
94a5440 |
none in production (tests, CHANGELOG, header comments removed) | — | — | M9 now killed by the new id-0 test |
8e7d29c |
none in production (test uses refresh(ContextData) instead of a provider) |
the provider path refresh() delegates to refresh(ContextData) (src/context.cpp:563-575), so coverage is equivalent |
— | — |
5. Performance
| Path | main | head | probe / runtime | counter test? |
|---|---|---|---|---|
variable_value(s) warmed |
66.2 ns | 68.0 ns | 2M iter, median of 7 interleaved runs, taskset -c 1, -O2, GCC 15.2, aarch64 |
n/a (no cache added) |
peek_variable_value(s) |
65.0 | 66.6 | same | n/a |
variable_value(k) shared |
106.4 | 112.6 | same | n/a |
peek_variable_value(k) shared |
105.8 | 108.8 | same | n/a |
| allocs/op (all four) | 0.00 | 0.00 | counting operator new, 1000 reads |
— |
control peek()/treatment() default build |
36.3-36.7 / 36.9-37.4 | 37.5-37.7 / 37.7-37.9 | 3 runs | — |
control, both built -falign-functions=64 |
36.4-36.5 / 36.9-37.0 | 36.5-36.7 / 36.9-37.3 | 3 runs | — |
variable_value(k), aligned build |
105.0-113.4 | 108.4-111.5 | 3 runs | — |
Variants tried: resolver forced inline (inl): k reads 107.0-111.2 / 103.3-104.5; inline + early return when exposed (v2): 108.3-112.0 / 103.1-104.9. Instruction counts: NOT RUN (perf_event_open → EPERM). |
6. Forward compatibility
- Decoder untouched by this PR (
git diff origin/main...HEAD -- include/absmartly/models.hempty). Scenario payloads withapplications,customFieldValues: nulldecode on head (22/22 contexts ready). Full key injection/removal matrix: NOT RUN (no decode change).
7. Build / CI
- Package:
cmake --install build-head --prefix inst→ rc 0; consumerfind_packagebuild ✓ (step 2). - Floors:
cmake_minimum_required(VERSION 3.16)and C++17 unchanged (CMakeLists.txt not in diff). - Strict warnings: Debug
-Wall -Wextra -Wpedantic -Werror→ builds, 160/160. - Clang: NOT RUN (not installed). PR body states Clang 22 passed at the production-fix commit; production unchanged since.
- CI on this exact head:
gh run list --commit 8e7d29c…→ run 45910526705 (pull_request) "Build & test" success; run 45910520855 (push) "Build & test" success. - Pins: none added by this PR.
8. Docs / CHANGELOG
- Section:
## Unreleased/### Fixed(owner-requested); new## 1.0.0 (2026-11-16)heading over already-released notes, 0 released lines removed. - Migration vs published API: no public API change; the behaviour change (exposure counts, no fall-through, rebind + re-exposure) is described with who is affected.
- README: new "Shared variable keys" paragraph matches the measured behaviour (traffic-excluded unit gets control and is exposed: sweep UIDs where
e5wins on variant 0 → default + 1e5exposure). - Stale strings:
git grep -n "1\.0\.1\|1\.1\.0" -- CHANGELOG.md README.md CMakeLists.txt→ 0 hits.
Findings
| Sev | Title | Evidence line above | Fixed in |
|---|---|---|---|
| P3 | Small measured slowdown on warmed shared-key reads (0 allocs) | §5 table | — |
| P3 | id-0 late-loaded override not rebound (by design; doc only) | review "P3 / notes", probe probe/p.cpp id0-late-load: value=default pending=1 |
— |
| Owner | Fixed vs Changed placement (decided: Fixed) | §8 | — |
| Owner | Next tag 1.0.1 vs 1.1.0 (recommend 1.1.0) | §1 | — |
Verification limits
- Clang build: NOT RUN (toolchain absent).
- Official cross-sdk-tests wrapper lane: NOT RUN (wrapper requires cpp-sdk#6 headers); local runner used.
- Hardware instruction counters: NOT RUN (EPERM).
- Numeric edge table / JS vectors / forward-compat injection matrix: NOT RUN — no code in those areas changed.
- Future-based (
create_contextfetch) entry point not separately probed; it shares the sameContextread path.
jervasion-absmartly
left a comment
There was a problem hiding this comment.
❌ Changes requested
The shared-variable resolver and the earlier callback/refresh fixes now behave correctly in the covered cases, but one remediation regression remains: a valid experiment ID of 0 is still being used as the “not yet bound” sentinel for cached overrides. That can return the caller default and emit incomplete exposure metadata when an override is set before an ID-0 experiment is loaded.
Next step: Distinguish an override-only cached assignment from a bound assignment without using the experiment ID as the sentinel, then add coverage for the pre-load override → refresh path with experiment ID 0.
Must fix
- Do not use experiment ID
0as the unbound marker — an override cached before its experiment arrives must bind to a subsequently loaded experiment even when its valid ID is0; otherwisevariable_value()returns the default and the exposure carries stale/missing experiment data.src/context.cpp:621
Suggestions
- None — the previously requested provider-fixture simplification was applied.
What I checked
- ✅ Release build and all 160 CTest cases passed, including all shared-variable-key tests.
- ✅ Exact-head GitHub Actions CI runs completed successfully for the reviewed SHA.
- ✅ The callback/logger and refresh fixes from the previous review now have distinguishing tests and no longer reproduce the prior findings.
- ✅ A focused harness reproduces the remaining ID-0 pre-load override regression.
Review details
Head: 8e7d29c058a7128d8cd96317cb203e1bb24702b4
Base and merge-base: 1c628e4dee98c24ec16a697bb382363d89bad723
Round: 3 (follow-up).
Convergence summary — review round 3
- Unresolved original blockers: 0
- Remediation regressions: 1
- Independent PR-change findings: 0
- Acceptance criteria still open: an override cached before loading must bind to the refreshed experiment and use its variant variables, unit, iteration, and exposure metadata regardless of whether the experiment ID is zero.
- Human adjudication requested: no — the regression is verified and has a focused fix direction.
The prior three findings are resolved at this head: pre-load overrides bind for nonzero experiment IDs; variable_value() captures the selected value before the logger callback; and the refresh-on-exposure test now returns the original value while the next lookup observes the refreshed empty snapshot. The remaining issue is in the remediation added for the first finding (63a3780), retained at this head.
Passes (non-blocking): run: core runtime/API/data; dedicated error-handling specialist (completed); tests/CI/packaging; deployment/operations/observability; cross-cutting simplicity; comment hygiene; diff composition. Not run: shared-component UI (no frontend source changed); behaviour-bearing data/policy (no runtime data, schema, or policy files changed).
Comment hygiene (non-blocking): 25 comment / 423 code lines, ratio ~1:16.9, 3 blocks flagged.
threshold T=5; restatements counted: no (10 × C < E)
tests/shared_variable_key_test.cpp:47— adjacent fixture description restates the variant definitions.tests/shared_variable_key_test.cpp:56— adjacent fixture comment restates the strict-mismatch setup.tests/shared_variable_key_test.cpp:62— adjacent fixture comment restates the missing-unit setup.
Diff composition (non-blocking): every file is required for the change; none flagged. The introduced-content audit completed successfully for the cumulative merge-base..head history; no credential, scratch artifact, cache, or unnecessary file was found.
Simplifications (non-blocking): none.
Validation commands: git diff --check 1c628e4dee98c24ec16a697bb382363d89bad723..8e7d29c058a7128d8cd96317cb203e1bb24702b4; cmake -S . -B /workspace/repo/cpp-sdk-review-build -DCMAKE_BUILD_TYPE=Release -DABSMARTLY_BUILD_TESTS=ON; cmake --build /workspace/repo/cpp-sdk-review-build --parallel 4; ctest --test-dir /workspace/repo/cpp-sdk-review-build --output-on-failure; and the pinned introduced-blobs audit. Exact-head Actions runs 45910526705 and 45910520855 both completed with conclusion success.
…el; snapshot treatment()'s variant Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t data; pin the rebind checks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d return; rewrap CHANGELOG Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent sdk-review on dd5b15c: APPROVE (no P1/P2), 1 P1/P2 fixed across 2 reviewer passes This round fixes Jervasion's round-3 finding on 8e7d29c: experiment id 0 was being used as the marker for "not yet bound".
The final reviewer's two P3s are handled in the test/docs-only follow-up 6e54bb9 (next comment). The CHANGELOG entry stays under Fixed, as the owner asked. Final reviewer report: .git/sdk-review/dd5b15c….mdAPPROVE at Compared tag Verified fixed since
|
| Tree | Identifier | How obtained | Verified |
|---|---|---|---|
| Released | tag v1.0.0 (9ea8669); no registry |
git tag → v1.0.0; git worktree add --detach rel v1.0.0 |
tag commit |
| Main / merge base | 1c628e4 |
git merge-base origin/main HEAD → 1c628e4… |
== origin/main |
| Previous head | d033110 |
previous report .git/sdk-review/d033110….md |
|
| Head | dd5b15c |
git rev-parse HEAD |
local, unpushed |
- Version:
CMakeLists.txt:2project(absmartly-sdk VERSION 1.0.0 …). CHANGELOG## Unreleased/### Fixedabove## 1.0.0 (2026-11-16). git diff v1.0.0 HEAD -- CHANGELOG.md | grep -c '^-[^-]'→ 0.git show dd5b15c --stat→ CHANGELOG.md +2/-1, src/context.cpp +16/-6, tests/shared_variable_key_test.cpp +57.
2. Backwards compatibility
git diff --quiet d033110 HEAD -- include→ identical.git diff v1.0.0 HEAD -- include: +<utility>, +privatevariable_assignment, +test-only friend (main), −2 comment lines (main).- Consumer probe: NOT RE-RUN; headers identical to d033110, where rel, main and head compiled.
- Released tests against the head lib (
cp -r head/src head/includeinto copies of the v1.0.0 and 1c628e4 trees,cmake --build): x-rel "All tests passed (1474 assertions in 140 test cases)"; x-main "All tests passed (1492 assertions in 141 test cases)". - Own suites: main 141/1492 pass; d033110 161/1634 pass; head 161/1652 pass.
- Behaviour probe
probe/p.cpp(g++ -O2 … libabsmartly-sdk.a), output lines main / prev / head:- A: 1 [id=5] / 2 [id=5, id=5] / 1 [id=5]
- B: 1 / 1 / 1
- C: main vv="h" n=2 [id=0 x, id=9 h]; prev and head vv="x" n=2 [id=0 x u="", id=7 x u=session_id]
- D: main vv="h"; prev and head vv="x" [id=0 u="", id=0 u=session_id]
- E: 1 / 2 / 1
- F: main vv="h" n=2 [x v=2, h]; prev and head vv="x" n=2 [x v=2, x v=2]
- Probe
probe/q.cpp(override config change, same id/unit/iteration): main and head bothvv="old" pending=1, staying loaded and leaving and returning. Pre-existing. - Public fields/hooks whose effect changed: none.
- Entry points: constructor with data;
refresh(ContextData);refresh()delegates to it (src/context.cpp:572-585). Reads: treatment, peek, variable_value, peek_variable_value (unchanged since 8e7d29c).
3. Parity
- Java
getVariableAssignment: winner code unchanged since 8e7d29c. NOT RE-RUN (at 8e7d29c: cross-sdk-tests 340-368, 22 eligible / 7 skips of 29, 22/22 pass). - Numeric edge table: NOT RUN (no numeric, hash or header code in the diff).
4. Tests and mutation
- Full suite on head: Release 161 cases / 1652 assertions pass in 0.017 s (wall). Debug with
-fsanitize=address,undefined -Wall -Wextra -Wpedantic -Werror: builds with no warnings, 161/1652 pass. - Harness
tools/mut.pyon copymut: one mutant at a time, full suite each time, source restored afterwards.
| # | Mutant (src/context.cpp) | Failing cases | Result |
|---|---|---|---|
| M1 | winner ignores overridden |
7 | killed |
| M2 | winner ignores rule_override |
2 | killed |
| M3 | winner ignores assigned |
18 | killed |
| M4 | fall through when the winner lacks the key | 3 | killed |
| M5 | expose every visited candidate | 14 (rc -11) | killed |
| M6 | peek_variable_value exposes | 5 | killed |
| M7 | value re-read after exposure | 1 | killed |
| M8 | treatment returns the live variant (re-lookup) | 1 | killed |
| M9 | rebind erase removed | 1 | killed |
| M10 | erase every recorded override unconditionally (d033110 behaviour) | 1 | killed |
| M11 | drop the id comparison |
1 | killed |
| M12 | drop the unit_type comparison |
1 | killed |
| M13 | drop the iteration comparison |
1 | killed |
| M14 | drop the has_variables comparison |
1 | killed |
| M15 | erase an override even while still unloaded | 1 | killed |
| M16 | record all overrides, not only unloaded ones | 3 | killed |
| M17 | variable_value never exposes | 16 | killed |
| M18 | winner requires has_variables | 1 | killed |
| M19 | < → <= in variant_has_variables (:617) |
0 | SURVIVED |
| Totals: 19 run / 18 killed / 1 survived (M19 → P3 test gap). |
- Kill test for M19 (appended to a scratch copy of the test file as
[review]): head "All tests passed (3 assertions in 1 test case)", full suite 162/1655 pass.tools/mut.py M19→ 1 failed of 162 (killed). M14 is also killed by it. - Fix-commit audit:
| Commit | New state | Where it must be set/cleared/read | Entry points skipping it | Mutant |
|---|---|---|---|---|
dd5b15c |
refresh-local unloaded_overrides + 4-field equality check before erase |
must compare every field queue_exposure publishes from the cached override (id, unit, variant, overridden; assigned etc. are false for overrides) plus the variables source; variant is already equal (same override), so id/unit_type/iteration cover the published fields; has_variables covers placeholder vs loaded |
constructor, become_ready, become_failed call build_index() without it (fine: assignments_ is empty, or the context failed); set_override does not touch assignments_ (the get_or_create_assignment variant check covers it) |
M10-M15 killed; M19 survived |
dd5b15c |
variables content not compared | a config-only change keeps stale variables; same as main (probe q) | — | pre-existing |
5. Performance
| Path | main | d033110 | head | probe |
|---|---|---|---|---|
| warmed treatment() | 31.89 ns | 34.74 | 32.03 | 2M iterations, 1 run, taskset -c 1, -O2 GCC 15.2 aarch64 |
| warmed variable_value() | 87.81 ns | 88.05 | 86.21 | 2M iterations |
| refresh(same data), 2 experiments | 2009.1 ns | 2032.0 | 2027.7 | 200k iterations |
| No cache added by this commit, so no counter test is needed. |
6. Forward compatibility
- NOT RUN: decoder untouched (
git diff origin/main...HEAD -- include/absmartly/models.hempty).
7. Build / CI
- Release builds of head, main and d033110: rc 0. ASan+UBSan -Werror Debug build: rc 0, no warnings.
- Floors unchanged (CMakeLists.txt not in the PR diff; CMake 3.16 / C++17).
- CI on dd5b15c: NOT AVAILABLE.
gh run list --branch fix/shared-variable-key-winner→ latest 45910526705 and 45910520855 (success) on 8e7d29c; dd5b15c is unpushed. - Clang: NOT RUN (
which clang++→ none). - Pins: none.
8. Docs / CHANGELOG
- Entry under
### Fixed(owner decision). The new sentence matches probe A. awk 'length($0)>80' CHANGELOG.md→ line 39 (99 characters) → P3.- Stale strings:
git grep -n "1\.0\.1\|1\.1\.0" -- CHANGELOG.md README.md CMakeLists.txt→ 0.
Findings
| Sev | Title | Evidence | Fixed in |
|---|---|---|---|
| P3 | Test gap: <= off-by-one in variant_has_variables survives (M19) |
§4 M19 + kill test | — |
| P3 | CHANGELOG line 39 is 99 characters, unwrapped | §8 awk | — |
| Owner | Next tag 1.0.1 vs 1.1.0 | §1 | — |
| Gate | No CI on dd5b15c (unpushed) | §7 | — |
Verification limits
- dd5b15c has no CI run (unpushed). Not run: Clang; cross-sdk-tests; JS/numeric vectors; forward-compat matrix; consumer probe (headers unchanged); allocation counters. Performance figures come from one run each.
|
P3-only follow-up on top of the gated dd5b15c: 6e54bb9 changes only tests and the CHANGELOG, no production code.
Locally: 161/161 tests pass. |
jervasion-absmartly
left a comment
There was a problem hiding this comment.
✅ Approved
The previous ID-0 override regression is fixed. Pre-load overrides now bind based on whether the experiment data was loaded, and the refresh comparisons preserve or rebuild bound assignments correctly across ID, iteration, unit-type, and variant-data changes. The callback-safe return snapshots also remain correct.
Next step: None — ready to merge.
What I checked
- ✅ Full Release build and all 161 CTest cases passed.
- ✅ The new ID-0 pre-load binding and refresh/override transition cases pass, including the one-past-last variant case.
- ✅ Exact-head GitHub Actions CI runs
46005005513and46004993914completed successfully. - ✅ Focused runtime and error-handling passes found no additional verified defects.
- ✅ The previous round’s blocker is resolved and no new blocking issue was found.
Review details
Head: 6e54bb98eff67220da6764a2ef1a8f6b82944895
Base and merge-base: 1c628e4dee98c24ec16a697bb382363d89bad723
Round: 4 (follow-up).
Convergence summary — review round 4
- Unresolved original blockers: 0
- Remediation regressions: 0
- Independent PR-change findings: 0
- Acceptance criteria still open: none
- Human adjudication requested: no
The round-3 remediation regression is resolved: refresh() records overrides cached while their experiment was unloaded, drops the placeholder when the experiment arrives, and lets the next read rebuild from the loaded data without using ID 0 as a sentinel. Bound overrides are retained when the returning experiment data is unchanged and rebuilt when ID, iteration, unit type, or variant-variable availability changes. treatment() and variable_value() snapshot their return values before callbacks can mutate the context.
Passes (non-blocking): run: core runtime/API/data; dedicated error-handling specialist (completed); tests/CI/packaging; deployment/operations/observability; cross-cutting simplicity; comment hygiene; diff composition. Not run: shared-component UI (no frontend source changed); behaviour-bearing data/policy (no runtime data, schema, or policy files changed).
Comment hygiene (non-blocking): 29 comment / 525 code lines, ratio ~1:18.1, 3 blocks flagged.
threshold T=6; restatements counted: no (10 × C < E)
tests/shared_variable_key_test.cpp:47— adjacent fixture description restates the variant definitions.tests/shared_variable_key_test.cpp:56— adjacent fixture comment restates the strict-mismatch setup.tests/shared_variable_key_test.cpp:62— adjacent fixture comment restates the missing-unit setup.
Diff composition (non-blocking): every file is required for the change; none flagged. The introduced-content audit completed successfully for the cumulative merge-base..head history; no credential, scratch artifact, cache, or unnecessary file was found.
Simplifications (non-blocking): none.
Validation commands: git diff --check 1c628e4dee98c24ec16a697bb382363d89bad723..6e54bb98eff67220da6764a2ef1a8f6b82944895; cmake -S . -B /workspace/repo/cpp-sdk-review-build-r4 -DCMAKE_BUILD_TYPE=Release -DABSMARTLY_BUILD_TESTS=ON; cmake --build /workspace/repo/cpp-sdk-review-build-r4 --parallel 4; ctest --test-dir /workspace/repo/cpp-sdk-review-build-r4 --output-on-failure; and the pinned introduced-blobs audit. Exact-head Actions runs 46005005513 and 46004993914 both completed with conclusion success.
|
Independent sdk-review on 6e54bb9: APPROVE (no P1/P2/P3), 0 P1/P2 fixed across 1 reviewer pass This is the final gate on the exact head Jervasion approved. It is a fresh reviewer with no findings.
The only open item is the owner's version call: the reviewer recommends 1.1.0. No commit was pushed after this review. Final reviewer report: .git/sdk-review/6e54bb9….mdAPPROVE at Compared tag Verified fixed since
|
| Tree | Identifier | How obtained | Verified |
|---|---|---|---|
| Released | tag v1.0.0; no registry |
git tag → v1.0.0; git worktree add --detach rel v1.0.0 |
tag commit |
| Main / merge base | 1c628e4 |
git merge-base origin/main HEAD |
== origin/main |
| Previous head | dd5b15c |
.git/sdk-review/dd5b15c….md |
|
| Head | 6e54bb9 |
git rev-parse HEAD |
== PR head |
- Version:
CMakeLists.txt:2VERSION 1.0.0. CHANGELOG## Unreleased/### Fixed.git diff v1.0.0 HEAD -- CHANGELOG.md | grep -c '^-[^-]'→ 0. git show 6e54bb9: CHANGELOG.md, 3 lines rewrapped; tests/shared_variable_key_test.cpp +10 lines.
2. Backwards compatibility
git diff --quiet dd5b15c HEAD -- include src→ identical. The v1.0.0 → headincludediff: context.h +6/-2 (utility include, private method, friend from main).- Consumer probe: NOT RE-RUN (headers identical to d033110/dd5b15c, where it compiled).
- Released tests against the head lib: x-rel rc=0 "All tests passed (1474 assertions in 140 test cases)"; x-main rc=0 "All tests passed (1492 assertions in 141 test cases)".
- Own suites: rel 140/1474, main 141/1492, prev 161/1652, head 161/1655, all rc=0.
- Behaviour probe
probe/p.cppS1-S7 plus a 7-UID sweep, main vs head: diffs listed in the review, all documented. - Public fields/hooks whose effect changed: none (no header change since dd5b15c).
- Entry points: constructor with data,
refresh(ContextData),refresh()→ treatment, peek, variable_value, peek_variable_value. The probe goes through the constructor andrefresh(ContextData).
3. Parity
- Java
getVariableAssignment: winner code unchanged since 8e7d29c. NOT RE-RUN (at 8e7d29c: cross-sdk-tests 340-368, 22 eligible / 7 skips of 29, 22/22 pass). - Numeric edge table: NOT RUN (no numeric, hash or header code in the diff).
4. Tests and mutation
- Full suite on head: Release 161 cases / 1655 assertions, rc 0. Debug
-fsanitize=address,undefined -fno-sanitize-recover=all -Wall -Wextra -Wpedantic -Werror: builds with no warnings, 161/1655 pass. - Harness
tools/mut.pyon copymut: one mutant at a time, full suite each time, source restored afterwards.
| # | Mutant (src/context.cpp) | Failing cases of 161 | Result |
|---|---|---|---|
| M1 | winner ignores overridden |
7 | killed |
| M2 | winner ignores rule_override |
2 | killed |
| M3 | winner ignores assigned |
18 | killed |
| M4 | fall through when the winner lacks the key | 3 | killed |
| M5 | expose every visited candidate | 14 (rc -11) | killed |
| M6 | peek_variable_value exposes | 5 | killed |
| M7 | value re-read after exposure | 1 | killed |
| M8 | treatment re-looks up the variant after exposure | 1 | killed |
| M9 | rebind erase removed | 1 | killed |
| M10 | always erase recorded overrides | 1 | killed |
| M11 | drop the id comparison | 1 | killed |
| M12 | drop the unit_type comparison | 1 | killed |
| M13 | drop the iteration comparison | 1 | killed |
| M14 | drop the has_variables comparison | 1 | killed |
| M15 | erase while still unloaded | 1 | killed |
| M16 | record all overrides | 3 | killed |
| M17 | variable_value never exposes | 16 | killed |
| M18 | winner requires has_variables | 1 | killed |
| M19 | < → <= (:617) |
1 | killed (new test :498) |
| M20 | variant >= 0 → >= -1 (:616) |
0 | survived, EQUIVALENT (size_t(-1) fails the bound) |
| M21 | candidates by id descending | 8 | killed |
| M22 | falsy value treated as missing | 1 | killed |
| Totals: 22 run / 21 killed / 1 survived (equivalent; not a finding). |
- Fix-commit audit:
| Commit | New state | Where it must be set/cleared/read | Entry points skipping it | Mutant |
|---|---|---|---|---|
6e54bb9 |
none (test plus docs only) | — | — | M19 now killed |
5. Performance
| Path | main | head | probe |
|---|---|---|---|
| warmed treatment() | 32.16 / 32.20 ns | 34.61 / 33.16 ns | 2M, 2 runs, taskset -c 1, -O2 GCC 15.2 aarch64 |
| warmed variable_value() | 73.22 / 73.19 ns | 70.73 / 69.96 ns | same |
| warmed peek_variable_value() | 72.56 / 72.70 ns | 69.79 / 68.63 ns | same |
| No cache added, so no counter test is needed. |
6. Forward compatibility
- NOT RUN: decoder untouched (
git diff --quiet origin/main HEAD -- include/absmartly/models.h→ identical).
7. Build / CI
- Release builds of rel, main, prev and head: rc 0. ASan/UBSan -Werror: rc 0.
- Floors unchanged (
CMakeLists.txtidentical to origin/main; CMake 3.16 / C++17). - CI on this exact head: push run 46004993914 (headSha 6e54bb9, job "Build & test" success); pull_request run 46005005513 (headSha 6e54bb9, success).
- Clang: NOT RUN (not installed).
- Pins: none.
8. Docs / CHANGELOG
- Entry under
### Fixed(owner decision). Its claims match probes S1, S4, S6 and S7. awk 'length($0)>80' CHANGELOG.md→ 0 lines.- Stale strings:
git grep -n "1\.0\.1\|1\.1\.0" -- CHANGELOG.md README.md CMakeLists.txt→ 0.
Findings
| Sev | Title | Evidence | Fixed in |
|---|---|---|---|
| (prev P3) | M19 test gap | §4 M19 killed | 6e54bb9 |
| (prev P3) | CHANGELOG wrap | §8 awk | 6e54bb9 |
| Owner | Next tag 1.0.1 vs 1.1.0 | §1 | — |
Verification limits
- Not run: Clang; cross-sdk-tests; JS/numeric vectors; forward-compat matrix; consumer probe (headers unchanged); allocation counters. Performance figures come from 2 runs each.
Summary
Fix shared-variable-key resolution to match Java core-api
Context.getVariableAssignment:peek_variable_value()exposes nothing. Null, false, 0 and empty values count as values; only a missing key returns the default.What was wrong:
variable_value()exposed every candidate it visited. That included experiments the user was not in and experiments that ended on the default. Both reads also fell through to a later experiment when the winner's arm lacked the key. This recorded users in experiments they never saw, and let the arm a user got decide which experiment counted them.Who is affected: anyone with two or more running experiments that share a variable key. When only one experiment defines a key,
variable_value()also stops exposing users who are not in it.treatment()is unchanged.Docs: README has a new "Shared variable keys" note. The CHANGELOG has an Unreleased Fixed entry covering what was wrong, who is affected and the rule now applied. The notes already released are now under
## 1.0.0 (2026-11-16)(they were still under Unreleased).Owner decision / Java parity
This PR applies the owner's final shared-key decision. Java reference:
absmartly/java-sdk@9b2414bf40ee5b51b0f690d099b7c4e6ce7a5187, core-apiContext.getVariableAssignment. The independent reviewer confirmed it matches line for line.The C++ SDK has no holdouts, so none are added here, and the PR does not depend on any holdouts or switchbacks branch. Flag, not decided here: Java fires the applicable holdout exposures for every candidate it visits, while ordinary experiment exposure is winner-only. That looks inconsistent with a blanket "only the winner is exposed" rule.
Tests and evidence
Tests failed first: they were written and run before the fix. On the base, 7 of the 9 initial cases failed (12 assertions):
Guards already passing on the base: peek, lowest-id participant, and some override and rule paths. These are not claimed to fail before the fix.
Full suite: 161/161 pass in a Release build and in a strict C++17 Debug build (
-Wall -Wextra -Wpedantic). The strict build has no warnings, and the package target builds.Clang: Clang 22 passed all tests at the production-fix commit. Later commits changed only tests and docs.
Mutation checks, all caught by the tests:
variable_value()or peek);The final reviewer killed 20 of 20 mutants. A new test pins that a logger calling
refresh()from inside the exposure event does not disturb the read. On main this is an ASan heap-use-after-free (src/context.cpp:304); head passes, including under ASan+UBSan.cross-sdk-tests changes needed
Tested SDK SHA for the cross-sdk-tests#52 worker (
run_vsuw6q537c6gwi3i):6223db2177072660df3885bde618c52bea4d3580.This PR makes no cross-sdk-tests changes and opens no per-SDK cross-sdk-tests PR. The consolidated PR should:
sharedVariableKeyscapability);feat/shared-variable-key-conformance-ready). They encode the superseded expose-every-candidate/fall-through rule, so they fail on this head by design.Status for reviewers
6e54bb9. Jervasion APPROVED this exact head (round 4: no findings, no suggestions, no open threads). The final independent sdk-review on the same SHA is also APPROVE (no P1/P2/P3); the evidence is in a PR comment. CI is green.variable_value()with the old JS rule. Whichever merges second has to re-apply this rule.🤖 Generated with Claude Code
Summary by CodeRabbit