Skip to content

fuse_adapter O5: resolve whitelist aliases and stop coercing counters #11

Backlog

Description

@Pigbibi

Follow-up from Codex review round 5 on #9. Both are P2 and were deferred under the SH-2 split policy: from round 5 on, P2s go to follow-up issues.

1. Whitelist aliases conflict with canonical defaults

Thread: #9 (comment)

build_fuse_validated_inputs() always sets a canonical symbol_whitelist (default ["TQQQ", "SOXL", "BIL"]) and account_whitelist (default ["stage_n_shadow"]), even when the caller supplied only o5_symbol_whitelist / o5_account_whitelist. The vendored evaluate_O5() treats differing whitelist aliases as a violation.

As a result, an otherwise compliant TQQQ buy with o5_symbol_whitelist=["TQQQ", "SOXL"] is rejected. After three such sessions the account HALT latches.

Fix: when an alias is supplied, resolve the canonical value from it (or omit the canonical default), in the same way the O5 counters are handled (649007c, b0e285a).

2. session_order_count coercion turns invalid evidence into valid counts

Thread: #9 (comment)

int(raw_count) turns booleans (False becomes 0) and negative fractions (-0.5 becomes 0) into valid counters before O5 can validate them, so O5 passes where it should fail closed.

Fix: pass the supplied value through unchanged. Let the vendored _resolve_o5_alias validation reject non-integer, boolean or negative values.

Acceptance

  • A regression test for each case, reproducing the Codex examples.
  • The full suite and python -m shadow.sh2_acceptance stay green.

Activity

  1. Pigbibi commented on Nov 26, 2026

    @Pigbibi
    ContributorAuthor

    Adding the LOW findings from qsl-ai-reviewer on #9 @ 9137a64 (coverage complete, unresolved_findings false), per the SH-2 split policy:

    • fuse_adapter.build_fuse_validated_inputs(): tier=None or an unknown tier silently falls back to TIER_CONFIGS["balanced"] and tier_loss_budget_D = 0.30. Fail closed instead (None for tier_joint_cap and tier_loss_budget_D), and treat tier=None as invalid rather than as "None".
    • fuse_adapter._resolve_sizing_q_pre(): a non-integer Decimal (e.g. Decimal("10.5")) is truncated by int(). Reject it as None.
    • sizing.compute_session_sizing(): ln_one_minus_shock is still computed after Step 3 moved into compute_tier_max_loss_fraction(). Remove the unused local.
    • sizing.compute_session_sizing(): validate that tier_control_states is a Mapping with the expected tier keys before indexing, as is already done for fund_control_states.
    • tests/test_fuse_adapter.py: some tests assert directly on private helpers (_map_market_corporate_action, _apply_explicit_payload_tier, _finite_number, _map_calendar_statuses). Move them to public adapter entry points.

    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions