feat: prefill isolated issue-only reporter for clients without Git

This commit is contained in:
阿白叔 committed 2026-10-30 14:05:16 +08:00
1 parent 6c708224d2
commit e9b77186dc
15 files changed
+435 -20

No files matched your search

+22
View File
@@ -17,3 +17,25 @@ def test_launch_does_not_inherit_unrelated_credentials_or_user_harness_home(tmp_
assert 'OPENAI_API_KEY' not in env
assert 'DSH_HOME' not in env
assert env['DX_DSH_HOME'].startswith(str(tmp_path))
def test_context_publication_survives_a_real_windows_reader_lock(tmp_path):
import ctypes
from ctypes import wintypes
from threading import Timer
write_context(tmp_path, TaskSnapshot('t', 'draft'))
kernel = ctypes.WinDLL('kernel32', use_last_error=True)
kernel.CreateFileW.argtypes = (wintypes.LPCWSTR, wintypes.DWORD, wintypes.DWORD, ctypes.c_void_p,
wintypes.DWORD, wintypes.DWORD, wintypes.HANDLE)
kernel.CreateFileW.restype = wintypes.HANDLE
kernel.CloseHandle.argtypes = (wintypes.HANDLE,)
handle = kernel.CreateFileW(str(tmp_path / 'task-context.json'), 0x80000000, 3, None, 3, 0, None)
assert handle != ctypes.c_void_p(-1).value
release = Timer(.03, lambda: kernel.CloseHandle(handle))
release.start()
try:
value = write_context(tmp_path, TaskSnapshot('t', 'failed', issue_code='controlled'))
assert json.loads((tmp_path / 'task-context.json').read_text())['revision'] == value['revision']
assert not list(tmp_path.glob('context-*.tmp'))
finally:
release.join()