test(M11b-2d-A1): test_m11b2_single_tx.py 迁移函数式夹具消 collection error(48 条可收集,pytest 留证)

[M11b-2d-A1a] 留证刷新:两份 evidence 头部补 # INTERPRETER: 绝对路径 / # PYTEST_VERSION / # PYTHON_VERSION,
末行 # RC=,全部为绝对解释器实跑原样输出。
新增对照证据 m11b2d_a1_pytest_ref_11aac66.txt:HEAD 实测 8 failed 的根因是并行任务
M11b-2d-A1c 被引擎代收口提交 b5c4467 扫入的 apply() helper 改动([su()] -> su(),少一层数组),
非本任务、非夹具层、非真源缺陷;本任务按范围边界禁改 test 文件,已冒泡 PM 裁决。
逐文件 add,未用 -A,未含 wwwroot/,未 push。
This commit is contained in:
agent.develop 2026-09-22 23:04:22 +08:00
parent f8584daf10
commit 8487da2dd2
3 changed files with 180 additions and 15 deletions

View File

@ -1,8 +1,10 @@
# CMD: cd modules/world_sync && /d/pipeline/workspaces/0/sdlc_general/modules/world_sync/.venv/bin/python -m pytest tests/test_m11b2_single_tx.py --collect-only -q
# DATE: 2026-09-22T21:48:56+08:00
# DATE: 2026-09-22T23:03:04+08:00
# INTERPRETER: /d/pipeline/workspaces/0/sdlc_general/modules/world_sync/.venv/bin/python
# PYTEST_VERSION: pytest 9.1.1
# PYTHON_VERSION: Python 3.10.12
# TASK: M11b-2d-A1a 留证刷新(collect-only 可收集性证明,响应 QC #9)
# NOTE: 以下为上述命令完整原样输出。48 items collected / 0 collection error 是本项验收点,与用例是否 PASSED 无关。
tests/test_m11b2_single_tx.py::TestNormalWrite::test_broadcast_happens_only_after_commit
tests/test_m11b2_single_tx.py::TestNormalWrite::test_event_and_state_written_in_one_transaction
tests/test_m11b2_single_tx.py::TestNormalWrite::test_event_row_is_append_only_without_version_backfill
@ -52,5 +54,5 @@ tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_module_level_helpe
tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_plan_assembly_is_side_effect_free
tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_unserialisable_payload_rejected
48 tests collected in 0.05s
48 tests collected in 0.04s
# RC=0

View File

@ -1,8 +1,16 @@
# CMD: cd modules/world_sync && /d/pipeline/workspaces/0/sdlc_general/modules/world_sync/.venv/bin/python -m pytest tests/test_m11b2_single_tx.py -v --tb=short
# DATE: 2026-09-22T21:52:42+08:00
# DATE: 2026-09-22T23:03:04+08:00
# INTERPRETER: /d/pipeline/workspaces/0/sdlc_general/modules/world_sync/.venv/bin/python
# TASK: M11b-2d-A1c 外观债清理(三处 vacuous 断言/死表达式/尾逗号,用例语义与用例数不变)
# NOTE: 以下为 pytest 完整原样输出
# PYTEST_VERSION: pytest 9.1.1
# PYTHON_VERSION: Python 3.10.12
# TASK: M11b-2d-A1a 留证刷新(补解释器绝对路径 + PYTEST_VERSION,响应 QC #9 可复核性)
# NOTE: 以下为上述命令的 pytest 完整原样输出(未截断、未摘要、未修饰)
# FINDING: 本文件为 HEAD(b5c4467) 实测结果——8 failed / 32 passed / 8 xfailed / RC=1。
# FINDING: 失败根因不在本任务范围:并行任务 M11b-2d-A1c 的引擎代收口提交 b5c4467 把 tests/test_m11b2_single_tx.py
# FINDING: 的 apply() helper 由 "state_updates": [su()] if states is None else states 改成 su()(少了一层数组),
# FINDING: 真源 tx_write.py:359 校验 state_updates 必须是数组 -> 直接抛 [PBL-PARAM-0001],连带 5 条;另 3 条为同笔提交弱化的断言。
# FINDING: 对照实验:同一解释器、同一 _m11b2_compat.py 下,把 test 文件还原到 11aac66 版本 -> 40 passed / 8 xfailed / RC=0
# FINDING: (见 m11b2d_a1_pytest_ref_11aac66.txt)。本任务按范围边界第 2 条禁改 test 文件,故不自行修复,已冒泡 PM 裁决。
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-9.1.1, pluggy-1.6.0 -- /d/pipeline/workspaces/0/sdlc_general/modules/world_sync/.venv/bin/python
cachedir: .pytest_cache
@ -10,17 +18,17 @@ rootdir: /d/pipeline/workspaces/0/sdlc_general/modules/world_sync
configfile: pyproject.toml
collecting ... collected 48 items
tests/test_m11b2_single_tx.py::TestNormalWrite::test_broadcast_happens_only_after_commit PASSED [ 2%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_event_and_state_written_in_one_transaction PASSED [ 4%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_broadcast_happens_only_after_commit FAILED [ 2%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_event_and_state_written_in_one_transaction FAILED [ 4%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_event_row_is_append_only_without_version_backfill PASSED [ 6%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_multi_entity_state_updates PASSED [ 8%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_payload_serialised_into_payload_json_column PASSED [ 10%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_payload_serialised_into_payload_json_column FAILED [ 10%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_snapshot_written_in_same_transaction PASSED [ 12%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_trace_is_begin_commit_broadcast_in_that_order PASSED [ 14%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_update_path_bumps_version_server_side PASSED [ 16%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_append_only_guard_rejects_event_update_and_base_write PASSED [ 18%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_trace_is_begin_commit_broadcast_in_that_order FAILED [ 14%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_update_path_bumps_version_server_side FAILED [ 16%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_append_only_guard_rejects_event_update_and_base_write FAILED [ 18%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_errors_are_never_swallowed PASSED [ 20%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_failed_write_leaves_no_event_row PASSED [ 22%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_failed_write_leaves_no_event_row FAILED [ 22%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_immutable_column_in_set_guard PASSED [ 25%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_missing_not_null_column_guard PASSED [ 27%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_multi_entity_partial_failure_rolls_back_first_write PASSED [ 29%]
@ -29,7 +37,7 @@ tests/test_m11b2_single_tx.py::TestAtomicRollback::test_unknown_column_guard PAS
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_update_statement_never_sets_immutable_columns PASSED [ 35%]
tests/test_m11b2_single_tx.py::TestIdempotency::test_derived_idem_key_is_stable_for_same_params PASSED [ 37%]
tests/test_m11b2_single_tx.py::TestIdempotency::test_different_payload_is_not_deduped PASSED [ 39%]
tests/test_m11b2_single_tx.py::TestIdempotency::test_duplicate_event_uid_dedups_without_second_write PASSED [ 41%]
tests/test_m11b2_single_tx.py::TestIdempotency::test_duplicate_event_uid_dedups_without_second_write FAILED [ 41%]
tests/test_m11b2_single_tx.py::TestIdempotency::test_idem_key_param_is_accepted PASSED [ 43%]
tests/test_m11b2_single_tx.py::TestConcurrency::test_concurrent_duplicate_event_only_one_writes PASSED [ 45%]
tests/test_m11b2_single_tx.py::TestConcurrency::test_stale_base_version_raises_conflict_and_keeps_state PASSED [ 47%]
@ -59,5 +67,97 @@ tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_module_level_helpe
tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_plan_assembly_is_side_effect_free XFAIL [ 97%]
tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_unserialisable_payload_rejected XFAIL [100%]
======================== 40 passed, 8 xfailed in 0.39s =========================
# RC=0
=================================== FAILURES ===================================
___________ TestNormalWrite.test_broadcast_happens_only_after_commit ___________
tests/test_m11b2_single_tx.py:282: in test_broadcast_happens_only_after_commit
self.apply("ev-bc")
tests/test_m11b2_single_tx.py:169: in apply
return compat.apply(**params)
tests/_m11b2_compat.py:431: in apply
return asyncio.run(apply_runtime_event(**kwargs))
/usr/lib/python3.10/asyncio/runners.py:44: in run
return loop.run_until_complete(main)
/usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
return future.result()
../pbl_runtime_ext/pbl_runtime_ext/tx_write.py:359: in apply_runtime_event
raise rtx_db.RtxError(ERR_BAD_PARAM, "state_updates 必须是数组")
E pbl_runtime_ext.rtx_db.RtxError: [PBL-PARAM-0001] state_updates 必须是数组
_______ TestNormalWrite.test_event_and_state_written_in_one_transaction ________
tests/test_m11b2_single_tx.py:213: in test_event_and_state_written_in_one_transaction
res = self.apply("ev-ok")
tests/test_m11b2_single_tx.py:169: in apply
return compat.apply(**params)
tests/_m11b2_compat.py:431: in apply
return asyncio.run(apply_runtime_event(**kwargs))
/usr/lib/python3.10/asyncio/runners.py:44: in run
return loop.run_until_complete(main)
/usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
return future.result()
../pbl_runtime_ext/pbl_runtime_ext/tx_write.py:359: in apply_runtime_event
raise rtx_db.RtxError(ERR_BAD_PARAM, "state_updates 必须是数组")
E pbl_runtime_ext.rtx_db.RtxError: [PBL-PARAM-0001] state_updates 必须是数组
_______ TestNormalWrite.test_payload_serialised_into_payload_json_column _______
tests/test_m11b2_single_tx.py:276: in test_payload_serialised_into_payload_json_column
self.apply("ev-p", payload={"a": 1, "b": [1, 2]})
tests/test_m11b2_single_tx.py:169: in apply
return compat.apply(**params)
tests/_m11b2_compat.py:431: in apply
return asyncio.run(apply_runtime_event(**kwargs))
/usr/lib/python3.10/asyncio/runners.py:44: in run
return loop.run_until_complete(main)
/usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
return future.result()
../pbl_runtime_ext/pbl_runtime_ext/tx_write.py:359: in apply_runtime_event
raise rtx_db.RtxError(ERR_BAD_PARAM, "state_updates 必须是数组")
E pbl_runtime_ext.rtx_db.RtxError: [PBL-PARAM-0001] state_updates 必须是数组
______ TestNormalWrite.test_trace_is_begin_commit_broadcast_in_that_order ______
tests/test_m11b2_single_tx.py:238: in test_trace_is_begin_commit_broadcast_in_that_order
self.apply("ev-order")
tests/test_m11b2_single_tx.py:169: in apply
return compat.apply(**params)
tests/_m11b2_compat.py:431: in apply
return asyncio.run(apply_runtime_event(**kwargs))
/usr/lib/python3.10/asyncio/runners.py:44: in run
return loop.run_until_complete(main)
/usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
return future.result()
../pbl_runtime_ext/pbl_runtime_ext/tx_write.py:359: in apply_runtime_event
raise rtx_db.RtxError(ERR_BAD_PARAM, "state_updates 必须是数组")
E pbl_runtime_ext.rtx_db.RtxError: [PBL-PARAM-0001] state_updates 必须是数组
__________ TestNormalWrite.test_update_path_bumps_version_server_side __________
tests/test_m11b2_single_tx.py:257: in test_update_path_bumps_version_server_side
self.assertNotIn("state_version=?", sql.split("WHERE")[0].replace(
E AssertionError: 'state_version=?' unexpectedly found in 'UPDATE pbl_entity_state SET state_json=%s, state_version=?, checksum=%s, updated_by=%s, updated_at=%s '
_ TestAtomicRollback.test_append_only_guard_rejects_event_update_and_base_write _
tests/test_m11b2_single_tx.py:389: in test_append_only_guard_rejects_event_update_and_base_write
self.apply("ev-guard")
tests/test_m11b2_single_tx.py:169: in apply
return compat.apply(**params)
tests/_m11b2_compat.py:431: in apply
return asyncio.run(apply_runtime_event(**kwargs))
/usr/lib/python3.10/asyncio/runners.py:44: in run
return loop.run_until_complete(main)
/usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
return future.result()
../pbl_runtime_ext/pbl_runtime_ext/tx_write.py:359: in apply_runtime_event
raise rtx_db.RtxError(ERR_BAD_PARAM, "state_updates 必须是数组")
E pbl_runtime_ext.rtx_db.RtxError: [PBL-PARAM-0001] state_updates 必须是数组
___________ TestAtomicRollback.test_failed_write_leaves_no_event_row ___________
tests/test_m11b2_single_tx.py:408: in test_failed_write_leaves_no_event_row
with self.assertRaises(RtxError):
E AssertionError: RtxError not raised
_____ TestIdempotency.test_duplicate_event_uid_dedups_without_second_write _____
tests/test_m11b2_single_tx.py:432: in test_duplicate_event_uid_dedups_without_second_write
self.assertEqual(2, self.state_row()["state_version"]) # 仍为 1->2,未被二次写改
E AssertionError: 2 != 1
=========================== short test summary info ============================
FAILED tests/test_m11b2_single_tx.py::TestNormalWrite::test_broadcast_happens_only_after_commit
FAILED tests/test_m11b2_single_tx.py::TestNormalWrite::test_event_and_state_written_in_one_transaction
FAILED tests/test_m11b2_single_tx.py::TestNormalWrite::test_payload_serialised_into_payload_json_column
FAILED tests/test_m11b2_single_tx.py::TestNormalWrite::test_trace_is_begin_commit_broadcast_in_that_order
FAILED tests/test_m11b2_single_tx.py::TestNormalWrite::test_update_path_bumps_version_server_side
FAILED tests/test_m11b2_single_tx.py::TestAtomicRollback::test_append_only_guard_rejects_event_update_and_base_write
FAILED tests/test_m11b2_single_tx.py::TestAtomicRollback::test_failed_write_leaves_no_event_row
FAILED tests/test_m11b2_single_tx.py::TestIdempotency::test_duplicate_event_uid_dedups_without_second_write
=================== 8 failed, 32 passed, 8 xfailed in 0.68s ====================
# RC=1

View File

@ -0,0 +1,63 @@
# CMD: cd modules/world_sync && /d/pipeline/workspaces/0/sdlc_general/modules/world_sync/.venv/bin/python -m pytest tests/test_m11b2_single_tx.py -v --tb=short # 对照实验:仅把 tests/test_m11b2_single_tx.py 还原到 11aac66(其余文件与 HEAD 相同)
# DATE: 2026-09-22T23:03:19+08:00
# INTERPRETER: /d/pipeline/workspaces/0/sdlc_general/modules/world_sync/.venv/bin/python
# PYTEST_VERSION: pytest 9.1.1
# TASK: M11b-2d-A1a 对照证据(证明 8 failed 由 b5c4467 引入,非本任务/非夹具层/非真源缺陷)
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-9.1.1, pluggy-1.6.0 -- /d/pipeline/workspaces/0/sdlc_general/modules/world_sync/.venv/bin/python
cachedir: .pytest_cache
rootdir: /d/pipeline/workspaces/0/sdlc_general/tmp_diag/wsdiag/world_sync
configfile: pyproject.toml
collecting ... collected 48 items
tests/test_m11b2_single_tx.py::TestNormalWrite::test_broadcast_happens_only_after_commit PASSED [ 2%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_event_and_state_written_in_one_transaction PASSED [ 4%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_event_row_is_append_only_without_version_backfill PASSED [ 6%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_multi_entity_state_updates PASSED [ 8%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_payload_serialised_into_payload_json_column PASSED [ 10%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_snapshot_written_in_same_transaction PASSED [ 12%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_trace_is_begin_commit_broadcast_in_that_order PASSED [ 14%]
tests/test_m11b2_single_tx.py::TestNormalWrite::test_update_path_bumps_version_server_side PASSED [ 16%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_append_only_guard_rejects_event_update_and_base_write PASSED [ 18%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_errors_are_never_swallowed PASSED [ 20%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_failed_write_leaves_no_event_row PASSED [ 22%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_immutable_column_in_set_guard PASSED [ 25%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_missing_not_null_column_guard PASSED [ 27%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_multi_entity_partial_failure_rolls_back_first_write PASSED [ 29%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_optimistic_lock_conflict_rolls_back_everything PASSED [ 31%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_unknown_column_guard PASSED [ 33%]
tests/test_m11b2_single_tx.py::TestAtomicRollback::test_update_statement_never_sets_immutable_columns PASSED [ 35%]
tests/test_m11b2_single_tx.py::TestIdempotency::test_derived_idem_key_is_stable_for_same_params PASSED [ 37%]
tests/test_m11b2_single_tx.py::TestIdempotency::test_different_payload_is_not_deduped PASSED [ 39%]
tests/test_m11b2_single_tx.py::TestIdempotency::test_duplicate_event_uid_dedups_without_second_write PASSED [ 41%]
tests/test_m11b2_single_tx.py::TestIdempotency::test_idem_key_param_is_accepted PASSED [ 43%]
tests/test_m11b2_single_tx.py::TestConcurrency::test_concurrent_duplicate_event_only_one_writes PASSED [ 45%]
tests/test_m11b2_single_tx.py::TestConcurrency::test_stale_base_version_raises_conflict_and_keeps_state PASSED [ 47%]
tests/test_m11b2_single_tx.py::TestConcurrency::test_two_concurrent_writers_same_entity_no_lost_update PASSED [ 50%]
tests/test_m11b2_single_tx.py::TestValidation::test_client_supplied_state_version_is_ignored PASSED [ 52%]
tests/test_m11b2_single_tx.py::TestValidation::test_missing_required_params_rejected PASSED [ 54%]
tests/test_m11b2_single_tx.py::TestValidation::test_missing_tenant_rejected PASSED [ 56%]
tests/test_m11b2_single_tx.py::TestValidation::test_read_states_enforces_tenant_scope PASSED [ 58%]
tests/test_m11b2_single_tx.py::TestValidation::test_state_update_item_requires_entity_id PASSED [ 60%]
tests/test_m11b2_single_tx.py::TestValidation::test_state_update_item_requires_state PASSED [ 62%]
tests/test_m11b2_single_tx.py::TestValidation::test_state_updates_must_be_array PASSED [ 64%]
tests/test_m11b2_single_tx.py::TestLatency::test_each_write_reports_latency_and_sla PASSED [ 66%]
tests/test_m11b2_single_tx.py::TestLatency::test_p99_under_200ms PASSED [ 68%]
tests/test_m11b2_single_tx.py::TestLatency::test_percentile_helper_contract PASSED [ 70%]
tests/test_m11b2_single_tx.py::TestScopeAndSqlContract::test_column_contract_is_single_sourced_from_models PASSED [ 72%]
tests/test_m11b2_single_tx.py::TestScopeAndSqlContract::test_ddl_available_for_both_dialects PASSED [ 75%]
tests/test_m11b2_single_tx.py::TestScopeAndSqlContract::test_for_update_clause_degrades_by_dialect PASSED [ 77%]
tests/test_m11b2_single_tx.py::TestScopeAndSqlContract::test_no_broadcast_or_polling_in_write_sources PASSED [ 79%]
tests/test_m11b2_single_tx.py::TestScopeAndSqlContract::test_placeholder_style_per_dialect PASSED [ 81%]
tests/test_m11b2_single_tx.py::TestScopeAndSqlContract::test_transaction_lifecycle_is_balanced PASSED [ 83%]
tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_before_commit_hook_failure_rolls_back_everything XFAIL [ 85%]
tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_duplicate_event_raises_event_write_error XFAIL [ 87%]
tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_event_row_state_version_aligned_with_written_state XFAIL [ 89%]
tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_failure_raises_world_sync_exception_family XFAIL [ 91%]
tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_key_mismatch_between_event_and_state_rejected XFAIL [ 93%]
tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_module_level_helper_uses_configured_writer XFAIL [ 95%]
tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_plan_assembly_is_side_effect_free XFAIL [ 97%]
tests/test_m11b2_single_tx.py::TestRetiredContractCases::test_unserialisable_payload_rejected XFAIL [100%]
======================== 40 passed, 8 xfailed in 0.49s =========================
# RC=0