Skip to content

Add manual QFAF dollar amount with explicit ST offset-gap reporting - #68

Merged
HouseofTyrell merged 2 commits into
mainfrom
claude/manager-name-anonymization-c5puc7
Jul 23, 2026
Merged

HouseofTyrell merged 2 commits into
mainfrom
claude/manager-name-anonymization-c5puc7

Conversation

@HouseofTyrell

Copy link
Copy Markdown
Owner

Summary

Advisors can now enter an exact QFAF dollar amount alongside a fixed collateral amount, instead of relying on auto-sizing — and the app explicitly shows by how much the QFAF ST gains and collateral ST losses fail to offset at that level.

What changed

Inputs (both surfaces)

  • Workspace rail → Fund Overlay → Sizing gains a third option: Manual amount ($), with a dollar input seeded from the current auto-sized value. The rail summary chip shows Manual $X.
  • Classic calculator → Sizing Mode gains a Manual $ radio with the same behavior.
  • Both expose the pre-existing qfafOverride engine input (already CSV round-tripped), so no new serialization surface.

Engine semantics (one-engine rule preserved — calculate() only)

  • A manual amount is exact: the conservative sizing cushion no longer shaves it (sizing.ts).
  • A manual amount is never dynamically resized: isDynamic now requires qfafOverride === undefined, mirrored identically in core.ts and sensitivity.ts.
  • In total-budget funding mode, solveCollateralForTotal already allocated total − override to collateral (unchanged, now tested).

Offset-gap visibility

  • Workspace: a note under the manual input reports the gap and its consequence — "Fund ST gains exceed collateral ST losses by $X — the excess is taxed at ST rates" / "…losses exceed gains by $X — the excess carries forward".
  • Classic: the existing Net ST Position row shows the gap; the sizing card relabels Auto-Sized → Manual and the section guidance adapts.
  • Year-by-Year table: new Net ST Offset column (rows orientation, expanded Capital group) and row (transposed orientation) = ST gains − ST losses per year, colored by direction. Derived from already-surfaced engine fields.
  • Popups: new qfaf-manual-amount and col-net-st-offset entries; auto-sized-qfaf / net-st-position updated (audit-complete directive).
  • Excel export: Assumptions sheet gains a "QFAF Sizing" row (Manual ($X) / Dynamic / Fixed).

All new user-visible strings route through brandText() so they respect the public-anonymization toggle ("Fund"/"Manager" by default).

Testing

  • 6 new engine tests: cushion exactness, fixed hold across years, manual-beats-dynamic precedence, over-offset gap (taxed residual), under-offset gap (§1211 netting → carryforward), and total-budget allocation.
  • Full suite: 442/442 passing; npm run build, lint (0 errors), and format:check clean.
  • Playwright-verified against npm run dev on both surfaces: manual option appears, seeds correctly, gap note updates in both directions ($1M manual vs $1.65M losses → $150K gap ✓), switching back to Dynamic clears the override, and Classic shows "Net ST Position $900,000 excess ST losses" for a $500K manual amount ✓.

🤖 Generated with Claude Code

https://claude.ai/code/session_01S9oJbhvHXD2pJqwobUyxno


Generated by Claude Code

Advisors can now enter an exact QFAF position alongside a fixed collateral
amount instead of relying on auto-sizing, and see by how much the two fail
to offset:

- New 'Manual amount' sizing option in the Workspace rail and a 'Manual $'
  radio in the Classic calculator, both exposing the existing qfafOverride
  input (seeded from the current auto-sized value)
- A manual amount is exact: the sizing cushion no longer shaves it, and
  dynamic yearly resizing never replaces it (core + sensitivity mirrored)
- Offset-gap readout under the Workspace input (excess ST gains taxed /
  excess ST losses carried), reusing the SizingSummary Net ST Position row
  in Classic
- New per-year 'Net ST Offset' column/row in ResultsTable (both
  orientations) with popup entries; Excel assumptions sheet reports the
  sizing mode
- 6 new engine tests covering exactness, fixed hold, dynamic-override
  precedence, both gap directions, and total-budget allocation

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S9oJbhvHXD2pJqwobUyxno
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Deploying enhanceddirectindexingcalc with  Cloudflare Pages  Cloudflare Pages

Latest commit: d648ecc
Status: ✅  Deploy successful!
Preview URL: https://1e85e6e8.enhanceddirectindexingcalc.pages.dev
Branch Preview URL: https://claude-manager-name-anonymiz.enhanceddirectindexingcalc.pages.dev

View logs

The dark-theme navigation test asserted visibility of the first
.year-breakdown-table, which since the mobile redesign is the mobile copy
of the audit table — hidden on desktop and behind a closed disclosure on
mobile. It now asserts the project-appropriate wrapper (desktop table, or
mobile detail panel + opened disclosure).

The mobile-drawer test edited income $3M→$4M and expected total savings
to change, but at $3M income the NOL is already fully consumed (80% x
income exceeds it), so the totals are identical — verified with equal
engine outputs. The test now edits collateral, which always rescales
savings.

Product code was correct; both were test-only fixes. Logged as bug #10 in
docs/DECISIONS.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S9oJbhvHXD2pJqwobUyxno
@HouseofTyrell
HouseofTyrell merged commit 272d6d0 into main Jul 23, 2026
2 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