Skip to content

fix: cleanup DOE tools for backend integration#79

Merged
kgdunn merged 6 commits into
mainfrom
claude/review-backend-integration-XaZxR
Apr 14, 2026
Merged

fix: cleanup DOE tools for backend integration#79
kgdunn merged 6 commits into
mainfrom
claude/review-backend-integration-XaZxR

Conversation

@kgdunn
Copy link
Copy Markdown
Owner

@kgdunn kgdunn commented Apr 13, 2026

Summary

Prepares the DOE calculator engine for integration into the agentic backend. Four targeted fixes address issues that would cause problems in a server context.

  • Fix deprecated pd.Series.append()Column.extend() used append() which was removed in pandas 2.0. Replaced with pd.concat().
  • Add loop guard in optimal.pypoint_exchange() had an unbounded while is_singular loop that could hang forever if the candidate set is collinear. Now retries up to 1000 times with a clear ValueError.
  • Remove unimplemented stubs from tool enumridge_analysis and pareto_front were listed as selectable methods in the optimize_responses tool spec, but both are stubs. An LLM agent could select them and get a confusing error. Removed from enum; stub functions remain for future implementation.
  • Add logger.exception() to all 9 tool wrappers — Previously every tool swallowed exceptions with return {"error": str(e)}, losing the traceback entirely. Now logs the full traceback before returning the error dict.
  • Bump version to 1.2.8

Test plan

  • All 614 existing tests pass (10 skipped)
  • ruff check passes on all changed files
  • Coverage remains at 86%

https://claude.ai/code/session_0146zTx37yUE7Les58rSUWL8

claude added 6 commits April 13, 2026 21:48
pd.Series.append() was removed in pandas 2.0. Column.extend() would
crash at runtime on pandas >= 2.0. Switch to pd.concat() which is the
recommended replacement.

https://claude.ai/code/session_0146zTx37yUE7Les58rSUWL8
The while loop in point_exchange() had no upper bound, risking an
infinite loop when the candidate set is inherently singular (e.g.
collinear columns). This is especially dangerous in a server context
where it would block a worker thread indefinitely.

Now retries up to 1000 times and raises ValueError with a clear
message if no non-singular starting design is found.

https://claude.ai/code/session_0146zTx37yUE7Les58rSUWL8
These methods are stubs returning error dicts. Exposing them in the
enum lets an LLM agent select them, producing a confusing pseudo-error.
The stub implementations remain in optimization.py for future work,
but they are no longer advertised as selectable options.

https://claude.ai/code/session_0146zTx37yUE7Les58rSUWL8
Previously, all 9 tool functions swallowed exceptions with bare
return {"error": str(e)}, losing the traceback entirely. Now each
except block logs the full traceback via logger.exception() before
returning the error dict. The return-value contract is unchanged.

This is critical for debugging in a server context where the backend
configures log handlers to route to its observability stack.

https://claude.ai/code/session_0146zTx37yUE7Les58rSUWL8
Remove stale noqa: BLE001 directives (now that logger.exception()
means exceptions are no longer swallowed blindly). Remove stale
noqa: PERF203 from the refactored loop. Fix en-dash to hyphen in
comment.

https://claude.ai/code/session_0146zTx37yUE7Les58rSUWL8
Includes fixes for deprecated pandas API, infinite loop guard in
optimal design, removal of unimplemented stubs from tool enum, and
added logging to all tool wrappers.

https://claude.ai/code/session_0146zTx37yUE7Les58rSUWL8
@kgdunn kgdunn merged commit 1d5638f into main Apr 14, 2026
6 of 7 checks passed
@kgdunn kgdunn deleted the claude/review-backend-integration-XaZxR branch April 14, 2026 06:10
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