Skip to content

fix(specs): fall back only when ju is absent; let broken ju imports fail - #6

Merged
thorwhalen merged 2 commits into
masterfrom
fix/ju-import-guard
Oct 12, 2026
Merged

thorwhalen merged 2 commits into
masterfrom
fix/ju-import-guard

Conversation

@thorwhalen

@thorwhalen thorwhalen commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Closes #4.

Root cause

On the runner, ju==0.1.31 failed to import: ju/oas.py does import dill at module level and dill is not a declared dependency of ju. The bare except ImportError around the whole ju block in specs.py swallowed that, so CI only ever ran the basic fallback (CI coverage showed specs.py lines 97-108, the ju path, as missed). Reproduced in a clean venv: ju 0.1.31 raises ModuleNotFoundError: No module named 'dill'; ju 0.1.33 imports and generates specs correctly.

Change

  • _import_func_to_form_spec(): only a missing ju / ju.rjsf falls back, emitting a visible JuNotInstalledWarning. Any other import failure (missing ju dependency, renamed symbol) propagates. The func_to_form_spec call itself is no longer inside a try block.
  • ju>=0.1.33 floor (clean import; json_schema_to_signature's 'properties' branch ignores json_schema['required'] entirely ju#9 required-field handling).
  • New tests take the ju path with no fallback guard: skip with a reason only when ju is absent, fail with the real traceback when ju is broken. Also tests for the fallback warning and for propagation.

Verified in three clean venvs: ju 0.1.33 → all pass; ju 0.1.31 → fails loudly on dill; no ju → 4 skipped with reason + warning.

Review

Adversarial review (fresh Opus subagent): no confirmed defects in the diff. It checked three venvs (ju 0.1.33, broken 0.1.31, no ju), reversed test order and isolation leaks; all clean. Findings acted on:

Dependents gate: priv test-dependents uf (also -t): no dependents, so only uf's own suite ran. Its 38 doctest failures are identical to master's (pre-existing, #5). Repo tests/: 35 passed.

CI: ju 0.1.33 installed on the runner; ju tests ran (0 skipped); the ju branch of specs.py is now covered.

https://claude.ai/code/session_01UMu2bF25xcBqjScMKa7A3X

…ail (#4)

The bare `except ImportError` around the whole ju spec-generation block
swallowed a ModuleNotFoundError for `dill` (undeclared, imported at module
level by ju 0.1.31's oas.py), so CI only ever exercised the basic fallback.

- Import ju.rjsf through _import_func_to_form_spec: only a missing `ju` /
  `ju.rjsf` falls back, with a visible JuNotInstalledWarning. Any other
  import failure propagates. The spec-generation call is no longer guarded.
- Require ju>=0.1.33 (imports cleanly; honors required fields, i2mint/ju#9).
- Add no-fallback ju integration tests that skip only when ju is absent,
  plus tests for the warning and for broken-dependency propagation.

Closes #4

Claude-Session: https://claude.ai/code/session_01UMu2bF25xcBqjScMKa7A3X
…t ju

Adversarial-review finding: an old ju without ju.rjsf, or a stray namespace
'ju/' dir, fell back with a misleading 'not installed' warning. Only a
missing top-level 'ju' now falls back. Tests simulate absence with a finder
(as a real absence behaves) and cover the missing-submodule case.

Claude-Session: https://claude.ai/code/session_01UMu2bF25xcBqjScMKa7A3X
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.

except ImportError in specs.py masks a runner import failure — the ju integration has never run in CI

1 participant