Skip to content

fix(tilting): one coordinate row per distinct target - #235

Merged
thomaspinder merged 1 commit into
feat/150-entropic-tiltingfrom
fix/214-duplicate-target-labels
Jul 29, 2026
Merged

fix(tilting): one coordinate row per distinct target#235
thomaspinder merged 1 commit into
feat/150-entropic-tiltingfrom
fix/214-duplicate-target-labels

Conversation

@thomaspinder

Copy link
Copy Markdown
Owner

Summary

Follow-up on the tilting branch (#213), stacked on feat/150-entropic-tilting:

Passing the same target twice produced duplicate target coordinate labels — correct numbers, but .sel(target=...) returned multiple rows. New dedupe_targets (called before any moment column is built) implements a two-way split:

  • Exact duplicates (full frozen-model equality, probability/mean included): dropped silently, first occurrence kept, order preserved — harmless user redundancy.
  • Same label, different target (e.g. P=0.3 and P=0.4 on the same event): immediate ValueError naming the label and both requested values — previously this surfaced only post-solve as an opaque "not jointly achievable" that named neither. The label pins the quantity; two values for it are contradictory constraints, and now they fail early and legibly.

build_moments returns the deduped list so achieved/requested/event_draws/the coordinate all align; reverse_stress (single target) is a no-op pass-through.

Closes #214

Gates

82 tilting+reverse-stress tests green (+8); branch fast suite 683 passed; ruff/ty clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Egjd7ToFeb9TQqFnfRQZxV

@codecov-commenter

codecov-commenter commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.6%. Comparing base (3739b1e) to head (85e0088).

Additional details and impacted files
@@                    Coverage Diff                    @@
##           feat/150-entropic-tilting    #235   +/-   ##
=========================================================
  Coverage                       94.6%   94.6%           
=========================================================
  Files                             44      44           
  Lines                           3077    3095   +18     
  Branches                         355     359    +4     
=========================================================
+ Hits                            2911    2929   +18     
  Misses                           117     117           
  Partials                          49      49           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thomaspinder
thomaspinder force-pushed the feat/150-entropic-tilting branch from 4cd35a4 to 3739b1e Compare July 29, 2026 13:41
`target_label` names the quantity a target constrains, not the value
asked of it, so passing the same target twice gave the `target`
coordinate two identical labels and `.sel(target=...)` two rows.

`build_moments` now canonicalises the target list before the solve and
returns it alongside `(G, t)`:

- A target repeated verbatim is redundancy, not a mistake — one moment
  column achieves it exactly as the duplicated pair would — so the
  repeat is dropped silently, first occurrence kept, order preserved.
- Two *different* targets sharing a label (same event, two
  probabilities; same mean, two values) are contradictory. They used to
  surface late as a joint-infeasibility failure from the dual, naming
  neither the label nor the values that clash; they now raise
  immediately with both.

`tilt_result` labels the coordinate from the returned list, so
`achieved` / `requested` / `event_draws` and `TiltedForecastResult
.targets` all stay aligned with the columns of `G`.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Egjd7ToFeb9TQqFnfRQZxV
@thomaspinder
thomaspinder force-pushed the fix/214-duplicate-target-labels branch from b347489 to 85e0088 Compare July 29, 2026 13:49
@thomaspinder
thomaspinder merged commit 4b41c78 into feat/150-entropic-tilting Jul 29, 2026
9 checks passed
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.

2 participants