Merge commit '0d361e6eede9e8a739e776949aa7d5e3de4472da' into auto-review-per-call
# Conflicts: # .agents/notes/implemented/feature/2026-07-25-subagent-policy-inheritance.i18n.yaml # .agents/notes/implemented/feature/2026-07-25-subagent-policy-inheritance.md # .agents/notes/implemented/feature/2026-07-25-subagent-policy-inheritance.zh.md # docs/event-producer-consumer.i18n.yaml # docs/event-producer-consumer.md # docs/event-producer-consumer.zh.md # docs/persistence-catalog.i18n.yaml # docs/persistence-catalog.md # docs/persistence-catalog.zh.md # packages/extensions/tool-cordis/src/api-catalog.ts # snapshots/session/cordis-inspect-jsdoc/session.v2.jsonl # snapshots/web/ptc-round/session.v2.jsonl
This commit is contained in:
commit
a3d00cebc0
1293 files changed
+34691
-12188
No files matched your search
@@ -16,8 +16,15 @@ checker = SimpleNamespace(**runpy.run_path(str(SCRIPT)))
|
||||
|
||||
def test_otool_parser_uses_the_newest_macho_slice() -> None:
|
||||
output = """
|
||||
Load command 8
|
||||
cmd LC_VERSION_MIN_MACOSX
|
||||
cmdsize 16
|
||||
version 10.7
|
||||
sdk 11.1
|
||||
Load command 9
|
||||
cmd LC_BUILD_VERSION
|
||||
minos 11.0
|
||||
Load command 10
|
||||
cmd LC_BUILD_VERSION
|
||||
minos 13.5
|
||||
"""
|
||||
@@ -26,12 +33,34 @@ def test_otool_parser_uses_the_newest_macho_slice() -> None:
|
||||
|
||||
|
||||
def test_otool_parser_requires_a_deployment_target() -> None:
|
||||
with pytest.raises(ValueError, match="contains no LC_BUILD_VERSION"):
|
||||
with pytest.raises(ValueError, match="contains no macOS deployment target"):
|
||||
checker.parse_otool_deployment_target("Load command 0\n")
|
||||
|
||||
|
||||
def test_otool_parser_ignores_unrelated_version_fields() -> None:
|
||||
output = """
|
||||
Load command 1
|
||||
cmd LC_ID_DYLIB
|
||||
cmdsize 48
|
||||
current version 14.1.0
|
||||
compatibility version 1.0.0
|
||||
"""
|
||||
|
||||
with pytest.raises(ValueError, match="contains no macOS deployment target"):
|
||||
checker.parse_otool_deployment_target(output)
|
||||
|
||||
|
||||
def test_wheel_tag_rejects_a_newer_executable_target() -> None:
|
||||
checker.ensure_compatible(Path("runtime"), (13, 5), "macosx_14_0_arm64")
|
||||
checker.ensure_compatible(Path("runtime-x64"), (10, 7), "macosx_14_0_x86_64")
|
||||
|
||||
with pytest.raises(RuntimeError, match="requires macOS 14.1"):
|
||||
checker.ensure_compatible(Path("spawn-helper"), (14, 1), "macosx_14_0_arm64")
|
||||
|
||||
|
||||
def test_wheel_tag_accepts_only_supported_macos_architectures() -> None:
|
||||
assert checker.claimed_version("macosx_14_0_arm64") == (14, 0)
|
||||
assert checker.claimed_version("macosx_14_0_x86_64") == (14, 0)
|
||||
|
||||
with pytest.raises(ValueError, match="unsupported macOS wheel platform tag"):
|
||||
checker.claimed_version("macosx_14_0_universal2")
|
||||
@@ -60,6 +60,8 @@ def test_pep440_version_spells_a_prerelease_the_python_way() -> None:
|
||||
def test_macos_wheel_tag_does_not_claim_unsupported_node_platforms() -> None:
|
||||
assert build_python_release.PLATFORMS["macos-arm64"][0] == "macosx_14_0_arm64"
|
||||
assert build_python_release.PLATFORMS["macos-arm64"][1] == "deepseek-harness-sdk-runtime-macos-arm64"
|
||||
assert build_python_release.PLATFORMS["macos-x64"][0] == "macosx_14_0_x86_64"
|
||||
assert build_python_release.PLATFORMS["macos-x64"][1] == "deepseek-harness-sdk-runtime-macos-x64"
|
||||
|
||||
|
||||
def test_windows_wheel_tag_and_payload_are_x64_only() -> None:
|
||||
@@ -95,7 +97,7 @@ def test_stage_sdk_keeps_distribution_module_and_runtime_pin_distinct(tmp_path:
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("target", "with_helper"),
|
||||
[("linux-x64", False), ("macos-arm64", True), ("win-x64.exe", False)],
|
||||
[("linux-x64", False), ("macos-arm64", True), ("macos-x64", True), ("win-x64.exe", False)],
|
||||
)
|
||||
def test_stage_runtime_copies_platform_payload(
|
||||
tmp_path: Path, target: str, with_helper: bool
|
||||
|
||||
@@ -79,12 +79,11 @@ def test_current_platform_supports_windows_x64_only(monkeypatch: pytest.MonkeyPa
|
||||
runtime._current_platform_tag()
|
||||
|
||||
|
||||
def test_current_platform_rejects_macos_x64(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
def test_current_platform_supports_macos_x64(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(runtime.sys, "platform", "darwin")
|
||||
monkeypatch.setattr(runtime.platform, "machine", lambda: "x86_64")
|
||||
|
||||
with pytest.raises(FileNotFoundError, match="macOS arm64"):
|
||||
runtime._current_platform_tag()
|
||||
assert runtime._current_platform_tag() == "macos-x64"
|
||||
|
||||
|
||||
def test_runtime_requires_ripgrep_sidecar(
|
||||
|
||||
@@ -71,3 +71,194 @@ def test_mcp_smoke_accepts_the_external_server_result() -> None:
|
||||
for chunk in chunks
|
||||
for choice in chunk.get("choices", [])
|
||||
)
|
||||
|
||||
|
||||
def test_snapshot_comparison_normalizes_only_session_generation_provenance() -> None:
|
||||
normalize = SMOKE["normalize_session_format_comparison"]
|
||||
expected = {
|
||||
"header": {"type": "session", "version": 0, "otherVersion": 7},
|
||||
"accepted": {
|
||||
"type": "session-log-deepseek/delivery-accepted",
|
||||
"data": {"sessionId": "s", "throughSeq": 4},
|
||||
},
|
||||
"source": {
|
||||
"kind": "session-reference",
|
||||
"references": [{"sessionId": "other", "capturedThroughSeq": 8}],
|
||||
},
|
||||
}
|
||||
actual = {
|
||||
"header": {"type": "session", "version": 1, "otherVersion": 7},
|
||||
"accepted": {
|
||||
"type": "session-log-deepseek/delivery-accepted",
|
||||
"data": {"sessionId": "s", "sessionFormatVersion": 1, "throughSeq": 4},
|
||||
},
|
||||
"source": {
|
||||
"kind": "session-reference",
|
||||
"references": [{
|
||||
"sessionId": "other",
|
||||
"capturedFormatVersion": 1,
|
||||
"capturedThroughSeq": 8,
|
||||
}],
|
||||
},
|
||||
}
|
||||
|
||||
assert normalize(expected) == normalize(actual)
|
||||
assert normalize(expected)["header"]["otherVersion"] == 7
|
||||
|
||||
|
||||
def test_snapshot_value_normalizes_embedded_assistant_stream_timing() -> None:
|
||||
normalize = SMOKE["normalize_snapshot_value"]
|
||||
event = {
|
||||
"type": "assistant/message",
|
||||
"seq": 4,
|
||||
"time": 100,
|
||||
"data": {
|
||||
"stream": [
|
||||
{"type": "chunk", "time": 101, "chunk": {"type": "finish"}},
|
||||
{"type": "text-chunks", "time0": 102, "dt": [1, 2], "texts": ["a", "b", "c"]},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
normalized = normalize(event, [])
|
||||
|
||||
assert normalized["time"] == 0
|
||||
assert normalized["data"]["stream"] == [
|
||||
{"type": "chunk", "time": 0, "chunk": {"type": "finish"}},
|
||||
{"type": "text-chunks", "time0": 0, "dt": [0, 0], "texts": ["a", "b", "c"]},
|
||||
]
|
||||
|
||||
|
||||
def test_snapshot_comparison_expands_embedded_assistant_streams() -> None:
|
||||
normalize = SMOKE["normalize_session_format_comparison"]
|
||||
expected = [
|
||||
{
|
||||
"type": "assistant/chunk",
|
||||
"seq": 4,
|
||||
"time": 0,
|
||||
"data": {"turn": 1, "step": 1, "chunk": {
|
||||
"type": "text-delta", "index": 0, "text": "done",
|
||||
}},
|
||||
},
|
||||
{
|
||||
"type": "assistant/message",
|
||||
"seq": 5,
|
||||
"time": 0,
|
||||
"data": {"turn": 1, "step": 1, "message": {"role": "assistant"}},
|
||||
"sourceEventSeqs": [4],
|
||||
"surfaceOp": "append",
|
||||
},
|
||||
]
|
||||
actual = [{
|
||||
"type": "assistant/message",
|
||||
"seq": 4,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"turn": 1,
|
||||
"step": 1,
|
||||
"message": {"role": "assistant"},
|
||||
"stream": [{
|
||||
"type": "text-chunks", "time0": 0, "index": 0, "dt": [], "texts": ["done"],
|
||||
}],
|
||||
},
|
||||
"surfaceOp": "append",
|
||||
}]
|
||||
|
||||
assert normalize(actual, 2) == normalize(expected, 1)
|
||||
|
||||
tool_result = {
|
||||
"type": "tool/result",
|
||||
"data": {"turn": 1, "step": 1},
|
||||
"sourceEventSeqs": [4],
|
||||
}
|
||||
assert normalize(tool_result, 1)["sourceEventSeqs"] == [4]
|
||||
assert normalize(tool_result, 2)["sourceEventSeqs"] == [4]
|
||||
|
||||
|
||||
def test_snapshot_stream_expands_reasoning_and_tool_call_records() -> None:
|
||||
expand = SMOKE["expand_snapshot_stream_member"]
|
||||
|
||||
assert expand({
|
||||
"type": "reasoning-chunks", "time0": 0, "index": 1,
|
||||
"dt": [], "texts": ["think"],
|
||||
}) == [{"type": "reasoning-delta", "index": 1, "text": "think"}]
|
||||
assert expand({
|
||||
"type": "tool-call-chunks", "time0": 0, "index": 2,
|
||||
"id": "call-1", "name": "read", "dt": [1], "args": ["{", "}"],
|
||||
}) == [
|
||||
{"type": "tool-call-delta", "index": 2, "id": "call-1", "name": "read", "argumentsDelta": "{"},
|
||||
{"type": "tool-call-delta", "index": 2, "id": "call-1", "name": "read", "argumentsDelta": "}"},
|
||||
]
|
||||
|
||||
|
||||
def test_snapshot_file_builder_order_is_checked_outside_update_mode(tmp_path: Path) -> None:
|
||||
compare = SMOKE["compare_snapshot_files"]
|
||||
|
||||
with pytest.raises(AssertionError, match="snapshot builder produced"):
|
||||
compare({}, False, tmp_path, ("result.json",))
|
||||
|
||||
|
||||
def test_snapshot_comparison_expands_sdk_wrapped_attempts() -> None:
|
||||
normalize = SMOKE["normalize_session_format_comparison"]
|
||||
actual = [{
|
||||
"method": "session.event",
|
||||
"payload": {
|
||||
"sessionId": "s",
|
||||
"event": {
|
||||
"type": "assistant/attempt",
|
||||
"seq": 7,
|
||||
"time": 0,
|
||||
"data": {
|
||||
"turn": 1,
|
||||
"step": 1,
|
||||
"stream": [{"type": "chunk", "time": 0, "chunk": {"type": "finish"}}],
|
||||
},
|
||||
},
|
||||
},
|
||||
}]
|
||||
|
||||
assert normalize(actual) == [{
|
||||
"method": "session.event",
|
||||
"payload": {
|
||||
"sessionId": "s",
|
||||
"event": {
|
||||
"type": "assistant/chunk",
|
||||
"data": {"turn": 1, "step": 1, "chunk": {"type": "finish"}},
|
||||
},
|
||||
},
|
||||
}]
|
||||
|
||||
|
||||
def test_snapshot_generation_names_select_highest_role_without_double_counting(
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
render = SMOKE["snapshot_session_filename"]
|
||||
select = SMOKE["selected_snapshot_session_files"]
|
||||
assert render(0, 0) == "session.jsonl"
|
||||
assert render(0, 2) == "session.v2.jsonl"
|
||||
assert render(3, 0) == "session.3.jsonl"
|
||||
assert render(3, 2) == "session.3.v2.jsonl"
|
||||
|
||||
(tmp_path / "session.jsonl").write_text(
|
||||
'{"type":"session","version":0}\n', encoding="utf-8",
|
||||
)
|
||||
(tmp_path / "session.v1.jsonl").write_text(
|
||||
'{"type":"session","version":1}\n', encoding="utf-8",
|
||||
)
|
||||
(tmp_path / "session.1.jsonl").write_text(
|
||||
'{"type":"session","version":0}\n', encoding="utf-8",
|
||||
)
|
||||
|
||||
assert {index: path.name for index, path in select(tmp_path).items()} == {
|
||||
0: "session.v1.jsonl",
|
||||
1: "session.1.jsonl",
|
||||
}
|
||||
|
||||
|
||||
def test_snapshot_generation_filename_must_match_header(tmp_path: Path) -> None:
|
||||
(tmp_path / "session.v1.jsonl").write_text(
|
||||
'{"type":"session","version":0}\n', encoding="utf-8",
|
||||
)
|
||||
|
||||
with pytest.raises(AssertionError, match="filename declares Session format v1"):
|
||||
SMOKE["selected_snapshot_session_files"](tmp_path)
|
||||
Reference in new issue
Block a user