02391b5bf1
Feature A — daemon mode: - `--mode daemon` (explicit flag; poll mode stays the default with zero behavior change): the bridge runs INSIDE a connected workspace as a manifest-declared channel daemon. Self-registration + heartbeat are skipped entirely (the host runtime owns both; re-registering would flip the host to delivery_mode=poll), and MOLECULE_TARGET_WORKSPACE_ID defaults to WORKSPACE_ID (the host workspace is the agent). - Reply handling reuses the existing bridge machinery unchanged: a synchronous a2a JSON-RPC result rides _forward_once's sync-reply branch; a queued-ack falls back to the inbox-poll correlation path. - plugin.yaml gains contributes.daemons (runtime#216 parsed shape) → daemon-bootstrap.sh, which pip-installs the published wheel (pinned to the manifest version; tests/test_manifest_daemon.py enforces the three-way plugin.yaml/pyproject/pin sync) and execs `--mode daemon`. - Version 0.2.0 → 0.3.0 (the pinned wheel must contain daemon mode). Feature B — hermetic e2e harness (tests/e2e, @pytest.mark.e2e): - The REAL daemon subprocess over real sockets against a fake platform (register/heartbeat/activity/a2a/discover, real cursor semantics) and a fake Lark (OpenAPI REST + a REAL ws long connection speaking lark-oapi's protobuf frame protocol). No external network, no mocks inside the bridge process. - Scenarios: poll-mode full round trip (provenance-asserted envelope + threaded im/v1 reply), daemon-mode sync round trip (asserts NO register call ever — prove-fail verified red by reverting the skip — and host-defaulted target), daemon-mode queued-ack fallback via the inbox poll. - Test-only knobs: LARK_CHANNEL_API_BASE_OVERRIDE (brand.py, points the SDK at the local fake), LARK_CHANNEL_INBOX_POLL_SECS, LARK_CHANNEL_LONG_POLL_SECS (also bounds SIGTERM→exit latency). CI: new `e2e` job (pytest -q -m e2e); unit-tests now runs -m "not e2e" so the jobs partition cleanly. Suite: 77 unit + 3 e2e, all green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
68 lines
2.5 KiB
YAML
68 lines
2.5 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
unit-tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
with:
|
|
python-version: "3.11"
|
|
cache: pip
|
|
|
|
- name: Install package + test deps
|
|
env:
|
|
# molecules-workspace-runtime is published on the org Gitea PyPI
|
|
# registry and is 404 on public PyPI (a squat-proof name), so keep the
|
|
# Gitea index PRIMARY — the runtime always resolves from our registry.
|
|
# The Gitea index is a publish store, NOT a transparent PyPI proxy, so
|
|
# everything it does not host (lark-oapi>=1.5.5, qrcode, pytest) 404s
|
|
# there; add public PyPI as an EXTRA index for those. No dependency-
|
|
# confusion surface: the only Gitea-hosted dep (the runtime) does not
|
|
# exist on public PyPI, so the extra index can never shadow it.
|
|
PIP_INDEX_URL: https://git.moleculesai.app/api/packages/molecule-ai/pypi/simple/
|
|
PIP_EXTRA_INDEX_URL: https://pypi.org/simple/
|
|
run: pip install -e ".[qr]" pytest
|
|
|
|
- name: Byte-compile all modules
|
|
run: python -m py_compile lark_channel_molecule/*.py
|
|
|
|
- name: Run unit tests
|
|
# Both sides are mocked (fake ws events + fake platform tools) —
|
|
# no creds / network needed, deterministic on a generic runner.
|
|
# e2e is excluded here — it runs in its own job below, so the
|
|
# two jobs partition the suite cleanly.
|
|
run: pytest -q -m "not e2e"
|
|
|
|
e2e:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
with:
|
|
python-version: "3.11"
|
|
cache: pip
|
|
|
|
- name: Install package + test deps
|
|
env:
|
|
# Same index shape as unit-tests (see the comment there).
|
|
PIP_INDEX_URL: https://git.moleculesai.app/api/packages/molecule-ai/pypi/simple/
|
|
PIP_EXTRA_INDEX_URL: https://pypi.org/simple/
|
|
run: pip install -e ".[qr]" pytest
|
|
|
|
- name: Run e2e tests
|
|
# Hermetic: the REAL daemon subprocess against local fake
|
|
# platform + fake Lark servers (127.0.0.1 only, incl. a real ws
|
|
# long connection) — no external network, no creds.
|
|
run: pytest -q -m e2e
|