fix(tasks): mirror parent_id to Project body for BatchTask create - #574
fix(tasks): mirror parent_id to Project body for BatchTask create#574prasad-albert wants to merge 2 commits into
Conversation
|
Looks good - no bugs or correctness issues found. |
| The location where the property task is performed. | ||
| parent_id : str | ||
| The ID of the parent project. | ||
| The ID of the parent inventory item. |
There was a problem hiding this comment.
waiting on confirmation of what exactly parentId is here? inventory or project
There was a problem hiding this comment.
The agent worker workaround mirrors parent_id → project for PropertyTask.This PR does two things that point the other way:
In create(), it mirrors parent_id → Project body only for BatchTask (isinstance(task, BatchTask)), not PropertyTask.
BaseTask carries both parent_id and project inherited by every task type, so both interpretations are structurally possible. The two views cannot both be correct:
If this change is right(PropertyTask.parent_id is an inventory item, only BatchTask.parent_id is a project): then the worker's PropertyTask mirror is actively wrong. It is stuffing an inventory id into the Project entity link. That mirror should be removed, not kept, and this is the correct fix for the BatchTask side.
If the worker is right (PropertyTask.parent_id is a project), then this change is incomplete (it should also mirror PropertyTask) and its docstring change is wrong.
I believe this needs confirmation from the task API owner or a real create test for both task types before merge
There was a problem hiding this comment.
confirmed with @siddhant-albertinvent -- parentId is always project ID irrespective of task type.
There was a problem hiding this comment.
actually, the tests are failing and they expect parent ID to be inventory ID for Property Tasks
cc: @siddhant-albertinvent
When a BatchTask is created with parent_id set but project omitted, the API requires the Project entity in the request body for ACL resolution. Without it the server crashes at runtime. Auto-populate Project from parent_id in that case. Also corrects the PropertyTask docstring: parent_id refers to the parent inventory item, not a project.
parentId in the query param and Project.id in the payload must always match, regardless of task type. Also reverts an incorrect PropertyTask docstring edit (parent_id is the parent project, not inventory item).
2efd859 to
cde27ad
Compare
|
Looks good - no bugs or correctness issues found. |
Summary
BatchTask.createwithparent_idset butprojectomitted caused a server-side runtime crash — the API requires theProjectentity link in the request body for ACL resolution alongside theparentIdquery param{"Project": {"id": parent_id}}in the payload forBatchTaskwhenprojectis not already presentPropertyTaskdocstring:parent_idis the parent inventory item ID, not a project ID