Skip to content

feat(sdk): add scenario evaluation and spot-target solving - #46

Draft
thestephenromano wants to merge 2 commits into
mainfrom
feature/scenario-tool-api
Draft

thestephenromano wants to merge 2 commits into
mainfrom
feature/scenario-tool-api

Conversation

@thestephenromano

@thestephenromano thestephenromano commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Adds typed Python scenario evaluation and spot solving, plus a runnable SDK example app that supplies the solver-client acceptance demonstration for API #34 and API #146.

Both sync and async clients expose evaluate_scenarios() and solve_spot(), with quotes and explicit CU ceilings. BSM/BS1993 results retain ordered partial errors, point/interval boundaries, sign regions, unresolved coverage and commercial receipts. The approved flat solve rates are 100 CU BSM / 200 CU BS1993.

The solver example app runs locally with the installed SDK and no extra runtime dependencies. Its browser form supports target option price and signed-position P&L, fixed scenario assumptions and bounded spot search. Quote and Solve are separate explicit actions; below-quote caps and stale/reused quotes are refused locally. Input edits invalidate results while preserving receipt history. Numerical work stays in the API, with no hidden pricing requests or automatic retries. Also includes command-line examples and standalone scenario/solver notebooks.

The contract is pinned byte-for-byte to API MR !209 commit 7b4f233b2222fbb95b2492d5c57dbde1ac32e571, SHA-256 38a0c933ea805f132bc4245867c3130c5a1db94e23cb4837872abf8c27e33ccc. Native fixtures preserve original capture and validation provenance.

Validation:

  • SDK full suite: 672 passed, 20 native tests skipped locally on Python 3.14, before three additional receipt representation cases. Final app suite: 22 passed on both Python 3.11 and 3.14.
  • Protected native API: all ten successful solver fixture cases through app HTTP -> SDK -> API matched native results and 100/200-CU quotes/receipts. Seven documented input walkthroughs separately passed, including below-cap refusals, both targets/models, no-boundary, interval and unresolved outcomes.
  • Failure tests preserve zero/full/unknown charges, request IDs and malformed-response evidence without retry; large CU values remain exact decimal strings in the browser adapter.
  • Ruff, formatting, mypy, notebook generation check, JavaScript syntax and isolated wheel/sdist checks passed. Source distribution includes the complete app; the app runs --help outside the checkout with only the installed wheel.
  • Earlier SDK validation also passed all 19 native operation tests and Docker checks for all eight notebooks. Final GitHub CI remains an independent gate.
  • Retained evidence: SDK validation and example app validation.

Open client acceptance check: complete the documented browser walkthrough and attach rendered evidence. Computer-use URL policy blocked visual verification; automated app/native checks are not claimed as visual sign-off. This remains tracked in API #34/#146 and SDK #45.

Owner deployment hold: keep this PR draft and auto-merge off. Do not merge to main or release until the matching API has been deployed and live schema, scenario permissions, authenticated quotes and 100/200-CU receipts have been verified. This PR does not authorize deployment, signed-policy activation or publication.

Closes #45. Related: #2, #6, #7; API #34 and #146. Portfolio scenarios and attribution remain separate work.

thestephenromano added a commit that referenced this pull request Nov 5, 2026
The API's rate-card correction removes `units_charged` and
`compute_schedule_version` from public responses. Requiring them makes
otherwise valid pricing responses fail SDK validation.

Accept both fields as optional, deprecated compatibility data for older
deployments. Commercial evidence remains exclusively `fcu_quoted` /
`fcu_charged`; there is no fallback conversion. Sync and async tests
exercise the new response shape. The pinned deployed contract and
historical fixtures remain unchanged for this compatibility preparation.

Validation: 539 tests passed, 18 opt-in integration tests skipped; Ruff
lint/format and mypy passed. GitHub CI passed on Python 3.11 and 3.14,
including the Docker notebook check.

Companion to [API
#155](https://gitlab.com/prophetizo/morphiq-labs/sites/morphiq-api/-/issues/155)
and [API MR
!210](https://gitlab.com/prophetizo/morphiq-labs/sites/morphiq-api/-/merge_requests/210).
Independent of solver PR #46. Draft: coordinate with the API rollout; do
not merge/release as part of solver work.
thestephenromano added a commit that referenced this pull request Nov 5, 2026
Release Please generated this release from merged changes. Its unsigned
commit was rejected by the signed-commit rule; the identical tree was
signed locally and pushed without changing any generated version or
changelog content.

##
[0.2.0](v0.1.1...v0.2.0)
(2026-11-05)


### ⚠ BREAKING CHANGES

* **client:** align Python SDK with API v0.5.0
([#41](#41))

### Features

* **client:** align Python SDK with API v0.5.0
([#41](#41))
([043287a](043287a))


### Bug Fixes

* accept metadata without retired capacity fields
([#47](#47))
([5547614](5547614))


### Documentation

* adopt strategic pragmatism guidance
([#42](#42))
([7484eb2](7484eb2))


Companion to API !210. Solver PR #46 remains excluded.

This branch has not been deployed

No deployments
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.

feat(sdk): add scenario evaluation and flat-rate spot solving

1 participant