fix(tasks): isolate peripheral feedback writes by execution scope
Generic Container CI/CD / test-build-publish (push) Successful in 4m15s
Server CI/CD v2 / build-test-publish-and-deploy (push) Successful in 4m17s

An old development synchronizer could overwrite a production recovery timestamp in a shared project database even after production deployment. Check task scope before feedback or source-withdrawal writes and before idempotency replay.

Cover cross-scope rejection, same-scope success and replay, and preserve actual field feedback time when later order metadata changes.
This commit is contained in:
2026-11-08 04:07:07 +08:00
parent acc8f8f7cb
commit 549019507e
4 changed files with 74 additions and 8 deletions
+8 -4
View File
@@ -1513,11 +1513,13 @@ class OperationalTaskService:
body = _json(command)
scope = f"task:{task_id}:external-feedback"
async with self.repo.transaction():
await self.repo.lock(f"task:{task_id}")
task = await self._task(task_id)
require(task.get("execution_scope") == self.execution_scope,
"EXECUTION_SCOPE_MISMATCH", "当前环境不能同步其他执行范围的任务", status=403)
replay = await self._request_replay(scope, command.request_id, body)
if replay:
return ExternalFeedbackResult(task=await self.detail(task_id), **replay)
await self.repo.lock(f"task:{task_id}")
task = await self._task(task_id)
if task["task_type"] == "event_investigation":
self._require_actionable_task(task)
own_source = task["source"].get("external_id")
@@ -1674,11 +1676,13 @@ class OperationalTaskService:
body = _json(command)
scope = f"task:{task_id}:withdraw-external-source"
async with self.repo.transaction():
await self.repo.lock(f"task:{task_id}")
task = await self._task(task_id)
require(task.get("execution_scope") == self.execution_scope,
"EXECUTION_SCOPE_MISMATCH", "当前环境不能同步其他执行范围的任务", status=403)
replay = await self._request_replay(scope, command.request_id, body)
if replay:
return await self.detail(task_id)
await self.repo.lock(f"task:{task_id}")
task = await self._task(task_id)
source = task["source"]
require(
task["task_type"] == "external_work_order"