molecule-core/workspace/tests/snapshots
Hongming Wang 899a2231d6 test(platform_auth): module-functions signature snapshot drift gate
Pin the 5 public functions adapters and the runtime hot-path import
through ``from platform_auth import``:

  - ``auth_headers`` — every outbound httpx call merges this in
  - ``self_source_headers`` — A2A peer + self-message header builder
  - ``get_token`` — main.py reads on boot to decide register-vs-resume
  - ``save_token`` — main.py persists the platform-issued token
  - ``refresh_cache`` — 401-retry path drops in-process cache (#1877)

A grep across workspace/ shows 14+ runtime modules import these:
main.py, heartbeat.py, a2a_client.py, a2a_tools.py, consolidation.py,
events.py, executor_helpers.py (3 sites), molecule_ai_status.py,
builtin_tools/memory.py (3 sites), builtin_tools/temporal_workflow.py
(2 sites). Renaming any of the five (e.g. ``auth_headers`` →
``bearer_headers``) makes every one of those imports raise ImportError
at workspace boot — the failure surface is deep in heartbeat init,
nowhere near the rename site.

Same drift class as the BaseAdapter signature snapshot (#2378, #2380),
skill_loader gate (#2381), runtime_wedge gate (#2383). Reuses the
``_signature_snapshot.py`` helpers shipped in #2381.

Defense-in-depth: ``test_snapshot_has_required_functions`` asserts
the five names are still present, so removing one even with a
synchronized snapshot edit forces an explicit edit here with a
justification.

``clear_cache`` is intentionally NOT in the snapshot — it's a
test-only helper. Production code MUST NOT depend on it.

Verified red on deliberate rename: ``auth_headers`` →
``bearer_headers`` produces a clean diff of the missing function in
the failure message. Restored before commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 08:41:42 -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
platform_auth_signature.json test(platform_auth): module-functions signature snapshot drift gate 2026-04-30 08:41:42 -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