Skip to content

Commit a8e210a

Browse files
test: add deterministic Moonshine integration and enforce session resume identity (#3)
* test: add Moonshine runtime integration and session identity coverage Replays the completed deterministic Moonshine runtime integration harness and the session resume identity fix onto the latest upstream-synced main. * ci: separate offline and Moonshine integration test layers
1 parent 5f7fbb7 commit a8e210a

3 files changed

Lines changed: 391 additions & 6 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Moonshine runtime integration tests
2+
3+
on:
4+
push:
5+
paths:
6+
- "run_archive.py"
7+
- "archive-format-specification.md"
8+
- "skills/**"
9+
- "tests/integration_run_archive_moonshine.py"
10+
- ".github/workflows/moonshine-integration-tests.yml"
11+
pull_request:
12+
paths:
13+
- "run_archive.py"
14+
- "archive-format-specification.md"
15+
- "skills/**"
16+
- "tests/integration_run_archive_moonshine.py"
17+
- ".github/workflows/moonshine-integration-tests.yml"
18+
19+
permissions:
20+
contents: read
21+
22+
env:
23+
MOONSHINE_COMMIT: 72a64f8984e0e7e1b0a50f6e53e4d00e4fffbb7d
24+
25+
jobs:
26+
moonshine-integration:
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 10
29+
30+
steps:
31+
- name: Check out Creative-Intelligence
32+
uses: actions/checkout@v7
33+
34+
- name: Set up Python 3.11
35+
uses: actions/setup-python@v7
36+
with:
37+
python-version: "3.11"
38+
39+
- name: Install pinned Moonshine runtime
40+
run: |
41+
python -m pip install --upgrade pip
42+
python -m pip install --no-deps "git+https://github.com/DeepMathLLM/Moonshine.git@${MOONSHINE_COMMIT}"
43+
44+
- name: Run deterministic Moonshine integration tests
45+
run: python -m unittest -v tests.integration_run_archive_moonshine

run_archive.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -857,13 +857,22 @@ def _render_material_paths(staged: Sequence[Dict[str, object]]) -> str:
857857
def _open_or_create_session(app: MoonshineApp, object_job: ObjectJob, item_state: Dict[str, object]) -> ShellState:
858858
session_id = str(item_state.get("session_id") or "").strip()
859859
if session_id:
860-
shell_state = app.start_shell_state(session_id=session_id)
861-
if shell_state.project_slug != object_job.project_slug:
862-
raise RunnerError(
863-
"session %s belongs to project %s, expected %s"
864-
% (session_id, shell_state.project_slug, object_job.project_slug)
860+
try:
861+
return app.start_shell_state(
862+
session_id=session_id,
863+
mode="chat",
864+
project_slug=object_job.project_slug,
865+
agent_slug=AGENT_SLUG,
865866
)
866-
return shell_state
867+
except ValueError as exc:
868+
session_meta = app.session_store.get_session_meta(session_id) or {}
869+
actual_project = str(session_meta.get("project_slug") or "")
870+
if actual_project and actual_project != object_job.project_slug:
871+
raise RunnerError(
872+
"session %s belongs to project %s, expected %s"
873+
% (session_id, actual_project, object_job.project_slug)
874+
) from exc
875+
raise RunnerError("session %s is incompatible with archive runner: %s" % (session_id, exc)) from exc
867876
return app.start_shell_state(
868877
mode="chat",
869878
project_slug=object_job.project_slug,

0 commit comments

Comments
 (0)