molecule-core/workspace/tests/snapshots
Hongming Wang 70176e6c8f test(runtime_wedge): module-functions signature snapshot drift gate
BaseAdapter docstring tells adapter authors:

> ``runtime_wedge.mark_wedged()`` / ``clear_wedge()`` — flip the
> workspace to ``degraded`` + auto-recover when your SDK hits a
> non-recoverable error class. Import directly from ``runtime_wedge``;
> the heartbeat forwards the state to the platform automatically.

That's a contract — adapter templates depend on the four module-level
functions (``is_wedged``, ``wedge_reason``, ``mark_wedged``,
``clear_wedge``) being importable by those exact names with those
exact signatures. Renaming any silently breaks every adapter that
calls them: the import resolves the module fine, the
``AttributeError`` only surfaces when the adapter actually hits its
first SDK error — long after the rename merges.

Same drift class as #2378 / #2380 / #2381 (BaseAdapter, skill_loader)
applied to the module-level function surface.

Changes:

  - tests/_signature_snapshot.py gains build_module_functions_record.
    Walks a module's public top-level functions, optionally filtered
    to a specific name list (used here — runtime_wedge has internal
    helpers like reset_for_test that intentionally aren't part of
    the contract). Skips re-exports via __module__ check so a
    `from foo import bar` doesn't pollute the snapshot.
  - tests/test_runtime_wedge_signature.py snapshots the four
    contract functions. Plus a defense-in-depth required-functions
    test that catches removal even when source + snapshot are
    updated together.

Verified: deliberately renaming `mark_wedged` → `mark_wedged_RENAMED`
trips the gate with full snapshot diff in the failure message.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 07:01:10 -07:00
..
a2a_instructions_cli.txt chore(registry): snapshot tests + CLI-block alignment for #2240 2026-04-28 20:42:15 -07:00
a2a_instructions_mcp.txt chore(registry): snapshot tests + CLI-block alignment for #2240 2026-04-28 20:42:15 -07:00
adapter_base_signature.json test(adapter_base): extend signature snapshot to public dataclasses (#2364 item 2 followup) 2026-04-30 05:53:10 -07:00
hma_instructions.txt chore(registry): snapshot tests + CLI-block alignment for #2240 2026-04-28 20:42:15 -07:00
runtime_wedge_signature.json test(runtime_wedge): module-functions signature snapshot drift gate 2026-04-30 07:01:10 -07:00
skill_loader_signature.json test: extract shared signature-snapshot helpers + skill_loader gate 2026-04-30 06:27:20 -07:00