fix(jira,tests): send real datetime to RT/BT date fields, resolve assignee usernames for operators
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled
- RT/BT Start/End Date are genuine Jira "datetime" custom fields (confirmed via issue_editmeta), not plain dates. Pushing a bare "YYYY-MM-DD" string made Jira default the time-of-day to midnight, so RT Start Date and RT End Date ended up showing the same meaningless midnight timestamp instead of the actual execution window. Now sends a full ISO datetime. - The test detail page showed "RT: Unassigned" for the operator who WAS correctly assigned, because GET /users/operators (the only source AssigneeControl used to resolve an assignee ID into a username) is restricted to leads/managers — a plain operator has no other way to resolve their own ID. TestOut now resolves and includes the assignee's username directly (red/blue tech + reviewer), so the badge no longer depends on a permission-gated list the viewer might not have access to.
This commit is contained in:
@@ -330,6 +330,12 @@ class TestOut(BaseModel):
|
||||
# Assignment fields
|
||||
red_tech_assignee: uuid.UUID | None = None
|
||||
blue_tech_assignee: uuid.UUID | None = None
|
||||
# Resolved usernames — the operator (or lead) viewing a test they're not
|
||||
# a lead/manager on can't call GET /users/operators (403), so they have
|
||||
# no other way to resolve who an assignee ID actually is. Populated
|
||||
# from the ORM relationship, same pattern as technique_name below.
|
||||
red_tech_assignee_username: str | None = None
|
||||
blue_tech_assignee_username: str | None = None
|
||||
|
||||
# Review assignment fields
|
||||
red_reviewer_assignee: uuid.UUID | None = None
|
||||
@@ -340,6 +346,8 @@ class TestOut(BaseModel):
|
||||
blue_review_by: uuid.UUID | None = None
|
||||
blue_review_at: datetime | None = None
|
||||
blue_review_notes: str | None = None
|
||||
red_reviewer_assignee_username: str | None = None
|
||||
blue_reviewer_assignee_username: str | None = None
|
||||
system_gaps: str | None = None
|
||||
|
||||
# On-hold fields
|
||||
@@ -398,6 +406,23 @@ class TestOut(BaseModel):
|
||||
except Exception: # nosec B110
|
||||
pass # DetachedInstanceError or similar — leave technique fields None
|
||||
|
||||
# Resolved assignee usernames (lazy-load, same as technique above).
|
||||
# A plain operator/tech viewing their own test can't call
|
||||
# GET /users/operators (lead/manager-only) to resolve an assignee ID
|
||||
# into a name, so the API needs to hand it over pre-resolved.
|
||||
for attr, field in (
|
||||
("red_tech_assigned_user", "red_tech_assignee_username"),
|
||||
("blue_tech_assigned_user", "blue_tech_assignee_username"),
|
||||
("red_reviewer", "red_reviewer_assignee_username"),
|
||||
("blue_reviewer", "blue_reviewer_assignee_username"),
|
||||
):
|
||||
try:
|
||||
user = getattr(obj, attr, None)
|
||||
if user is not None:
|
||||
obj.__dict__[field] = user.username
|
||||
except Exception: # nosec B110
|
||||
pass # DetachedInstanceError or similar — leave username None
|
||||
|
||||
# Only split evidences when they are already in memory (loaded via joinedload)
|
||||
raw_evs = obj.__dict__.get("evidences")
|
||||
if raw_evs is not None:
|
||||
|
||||
Reference in New Issue
Block a user