[Test failure] New tusker task tests assert null stats and a 500 the product no longer gives (3 tests)
The test is wrong confidence medium · medium priority · api-tests-master, last seen in build 597
The verdict
- Fix is in
- the automation suite (e2e): the test is wrong
- Issue
- ENG-8849 · Completed
- Owner
- [email protected] (the test agent opens the pull request once this is in Ready for Development)
- Filed in
- Backlog, Test Agent Automation
- Service
- tusker
- History when filed
- new, this error since build 597
- Branches
- fails on master; these tests are not in the production suite (api-tests-production build 620).
These tests were added in e0b8dc44d (ENG-8483) and have never passed. They encode stale or wrong expectations.
1) Stats: e2e/automation/tests/tusker/test_tasks.py:91-92 expects `categoryCounts`/`priorityCounts` to be null for an unknown inbox. tusker's `RespondWithJSON` (tusker/internal/util.go:21) marshals through `apijson.Marshal`. Since a90d083b9 (Nov 3, 'Return empty arrays instead of null') that turns nil slices into `[]`, so `[]` is the intended output. knowledge/tasks.md:117 is stale on this point.
2) Outside-study tests (`[single]`, `[bulk]`): they expect 500 'user is not part of study' but get 200. The member is TEST_MISC (`get_token_user1`). The shared study's team fixture (fixtures/common.py:324-329) gives TEST_MISC the study role `recruiter`, so `tasklib.GetTask` finds an actor and does not refuse. TEST_NON_STUDY has no study role and is the likelier user for this case. I did not confirm that the task sits in the shared `data["study"]`, or that TEST_MISC is an actor of it in this run.
The mid-run deploys and the chat-agent pod trouble are not tied to these requests, and the responses are deterministic 200s with no service errors.
Proposed fix
In test_tasks.py:91-92 assert `stats["categoryCounts"] == []` and `stats["priorityCounts"] == []`, and update knowledge/tasks.md:117 to match. For `test_update_task_by_member_outside_study_is_rejected`, call `build_org_header` with a pool user who has no study role (TEST_NON_STUDY, the one the other tests use for 'member with no study role') instead of `get_token_user1`. Then keep the 500 / 'user is not part of study' assertions, and fix the knowledge note that names TEST_MISC as a non-actor.
History of this root cause
- filed ENG-8849 · build 597 8d ago
The test is wrong, confidence medium; 3 tests; to nobody in Backlog
- branches ENG-8849 7d ago
Tests 3
Oldest to newest, up to 30 runs. Green passed, red failed with this error, amber failed with another error. Skipped and collapsed runs are left out. Newest build: 599.
| Test | History | Newest run | Reading |
|---|---|---|---|
| test_update_task_by_member_outside_study_is_rejected[single] Tasks |
did not run | ||
| test_update_task_by_member_outside_study_is_rejected[bulk] Tasks |
did not run | ||
| test_get_task_stats_unknown_inbox_is_empty Tasks |
did not run |
How the agent decided
- Models
- claude-sonnet-5-5 ($0.84, 34 lookups)
- Settled by
- the investigating model
- Cost
- $0.84
What it looked up (34, in order)
1. read_file repo=main, path=e2e/automation/tests/tusker/test_tasks.py, start_line=1, end_line=85 · 4291 chars back
e2e/automation/tests/tusker/test_tasks.py (260 lines), lines 1-85:
1 import logging as logger
2 import os
3
4 import pytest
5
6 from automation.models.inbox import Inbox
7 from automation.models.task import Task
8 from automation.tests.fixtures.tusker_task_fixtures import UPDATE_DUE_BEFORE, UPDATE_NOTE
9
10 TASK_CATEGORY = "RequestRecords"
11 USER_EMAIL = os.getenv("TEST_USER")
12
13
14 def inbox_count(overview, section, inbox_id):
15 return next((item["count"] for item in overview[section] or [] if item["tildaId"] == inbox_id), 0)
16
17
18 def count_for(items, key, value):
19 return next((item["count"] for item in items or [] if item[key] == value), 0)
20
21
22 @pytest.mark.Tusker
23 @pytest.mark.xdist_group(name="Tusker")
24 @pytest.mark.TaskUpdates
25 class TestTasks:
26 def test_list_inboxes_counts_new_ready_task(self, tusker_task):
27 before = tusker_task["inboxes_before"]
28 response = Inbox(tusker_task["headers"]).get()
29 assert response.status_code == 200, f"List inboxes failed: {response.status_code} — {response.text}"
30 after = response.json()
31 logger.info(f"myTasksCount {before['myTasksCount']} -> {after['myTasksCount']}")
32
33 for key in ("myTasksCount", "userInboxCount", "studyInboxCount", "siteInboxCount"):
34 assert isinstance(after[key], int), f"{key} is not an int: {after[key]!r}"
35 assert after["myTasksCount"] == before["myTasksCount"] + 1
36 assert after[
… (2791 more characters not kept)
2. search_code repo=main, text=categoryCounts · 1390 chars back
tusker/api/tasks.go
1485: CategoryCounts []TaskCategoryCount `json:"categoryCounts"`
1492: // @Description Returns aggregate task statistics for the selected `state` (defaults to 'ready'): `selectedStateCount`, `categoryCounts`, and `priorityCounts`. All three fields use the same state filt
1499: // @Param state query string false "Task state filter applied to selectedStateCount, categoryCounts, and priorityCounts (default: ready)" Enums(ready, completed, draft, not applicable, waiting
execsvc/pkg/execution/training.go
305: listPage, categoryCounts := s.ListTrainingsPage, s.GetTrainingCategoryCounts
307: listPage, categoryCounts = s.ListOrgTrainingsPage, s.GetOrgTrainingCategoryCounts
315: statusCounts, err := categoryCounts(ctx, scope.id, callerOrgId, page.Search)
e2e/automation/knowledge/tasks.md
117: - **`GET /api/tasks/stats?inbox=`**: `inbox` is required (400 `inbox is required`). An unknown inbox is a 200 with `selectedStateCount: 0` and **`null`** `categoryCounts` / `priorityCounts`. `priority
data-science/packages/tilda-backend-client/tilda_backend_client/_generated/task/types.py
524: category_counts: Annotated[Optional[list["TaskCategoryCount"]], _NONE_TO_LIST] = Field(default=None, alias="categoryCounts")
execsvc/pkg/repo/training_query.go
data-science/packages/tilda-backend-client/tilda_backend_client/_generated/study/__init__.py
3. commits repo=main, path=e2e/automation/tests/tusker/test_tasks.py · 176 chars back
e0b8dc44d 2026-11-13T06:03 tilda-gitbot[bot]: Add API tests for the 7 uncovered tusker task routes (inboxes, assignment, bulk/single update, categories, sta (ENG-8483) (#17220)
4. read_file repo=main, path=tusker/api/tasks.go, start_line=1470, end_line=1600 · 5987 chars back
tusker/api/tasks.go (1624 lines), lines 1470-1600:
1470 State string `in:"query=state" json:"state"`
1471 }
1472
1473 type TaskCategoryCount struct {
1474 Category string `json:"category"`
1475 Count int `json:"count"`
1476 }
1477
1478 type TaskPriorityCount struct {
1479 Priority string `json:"priority"`
1480 Count int `json:"count"`
1481 }
1482
1483 type TaskStats struct {
1484 SelectedStateCount int `json:"selectedStateCount"`
1485 CategoryCounts []TaskCategoryCount `json:"categoryCounts"`
1486 PriorityCounts []TaskPriorityCount `json:"priorityCounts"`
1487 }
1488
1489 // Stats godoc
1490 //
1491 // @Summary Aggregate task counts for an inbox. Use for dashboards.
1492 // @Description Returns aggregate task statistics for the selected `state` (defaults to 'ready'): `selectedStateCount`, `categoryCounts`, and `priorityCounts`. All three fields use the same state filter.
1493 // @Description Returns aggregate counts only — no task list. For tasks themselves use GET /api/tasks/ (broad filter) or GET /api/tasks/home/ (current user dashboard).
1494 // @Tags Tusker
1495 // @Accept json
1496 // @Produce json
1497 // @Param Organization header string true "Org alias"
1498 // @Param inbox query string true "Inbox tildaid (from GET /api/inboxes/user)"
1499 // @Param state query string false "Task state filter applied to selectedStateCount, categoryCounts, and priorityCounts (default: ready)" Enums(ready, comp
… (4487 more characters not kept)
5. commits repo=main, path=tusker, since=2026-11-10T00:00:00Z · 366 chars back
03f9c2d6b 2026-11-13T17:58 Shashank-Agrawal12: authz: organization archive (soft delete) and purge (ENG-7837) (#17340)
9b80cb7b6 2026-11-12T06:30 arzatskis: Use camelCase for API query params and JSON fields across Go and Python services (#17334)
f03208870 2026-11-10T14:17 ojasgo: Speed up Docker builds: per-image BuildKit cache mounts + two-phase uv sync (#17264)
6. read_file repo=main, path=e2e/automation/tests/tusker/test_tasks.py, start_line=155, end_line=260 · 6199 chars back
e2e/automation/tests/tusker/test_tasks.py (260 lines), lines 155-260:
155
156 assert response.status_code == 500
157 assert "Could not find task with id no-such-task" in response.json()["message"]
158
159 def test_update_task_back_to_automatic_unassigns_and_logs(self, tusker_task):
160 headers = tusker_task["headers"]
161 response = Task(headers).put(tusker_task["task_id"], {"assignment": "automatic"})
162 assert response.status_code == 200, f"Update task failed: {response.status_code} — {response.text}"
163
164 logs = Task(headers).get(f"{tusker_task['task_id']}/changelogs").json()
165 reasons = [log["reason"] for log in logs]
166 assert "changed assignment to automatic. " in reasons
167
168 @pytest.mark.parametrize(
169 "payload, message",
170 [
171 ({"assignment": "bogus"}, "invalid assignment bogus value"),
172 ({"state": "completed"}, "wrong endpoint to complete task"),
173 ({"state": "not applicable"}, "wrong endpoint to complete task"),
174 ({"priority": 25, "assignment": "bogus"}, "invalid assignment bogus value"),
175 ],
176 ids=["invalid_assignment", "complete_via_tusker", "not_applicable_via_tusker", "rejected_change_not_applied"],
177 )
178 def test_update_task_rejects_invalid_change(self, tusker_task, payload, message):
179 headers = tusker_task["headers"]
180 response = Task(headers).p
… (4699 more characters not kept)
7. read_file repo=main, path=tusker/api/tasks.go, start_line=1598, end_line=1624 · 978 chars back
tusker/api/tasks.go (1624 lines), lines 1598-1624:
1598
1599 categories := make([]string, 0, len(categoryCountMap))
1600 for k := range categoryCountMap {
1601 categories = append(categories, k)
1602 }
1603 sort.Strings(categories)
1604 for _, cat := range categories {
1605 stats.CategoryCounts = append(stats.CategoryCounts, TaskCategoryCount{
1606 Category: cat,
1607 Count: categoryCountMap[cat],
1608 })
1609 }
1610
1611 priorities := make([]int64, 0, len(priorityCountMap))
1612 for k := range priorityCountMap {
1613 priorities = append(priorities, k)
1614 }
1615 sort.Slice(priorities, func(i, j int) bool { return priorities[i] < priorities[j] })
1616 for _, pri := range priorities {
1617 stats.PriorityCounts = append(stats.PriorityCounts, TaskPriorityCount{
1618 Priority: tasklib.PriorityStr(int(pri)),
1619 Count: priorityCountMap[pri],
1620 })
1621 }
1622
1623 internal.RespondWithJSON(w, http.StatusOK, stats)
1624 }
8. commit_diff repo=main, sha=03f9c2d6b, path=tusker · 1770 chars back
03f9c2d6b 2026-11-13T17:58 Shashank-Agrawal12: authz: organization archive (soft delete) and purge (ENG-7837) (#17340)
37 files changed: advpsvc/internal/pubsub.go, authz/main.go, authz/org-deletion_DESIGN.md, authz/pkg/handlers/organization.go, authz/pkg/handlers/scale_organization.go, authz/pkg/health/org_job.go, authz/pkg/health/org_job_test.go, authz/pkg/health/org_purge.go, authz/pkg/health/org_purge_test.go, authz/pkg/health/org_restore.go, authz/pkg/health/org_restore_test.go, authz/pkg/health/org_soft_delete.go, authz/pkg/health/org_soft_delete_catalog.go, authz/pkg/health/org_soft_delete_graph.go, authz/pkg/health/org_soft_delete_integration_test.go, authz/pkg/health/org_soft_delete_request_test.go, authz/pkg/health/org_soft_delete_resume_test.go, authz/pkg/health/org_soft_delete_test.go, authz/pkg/health/organization.go, authz/pkg/health/util.go, authz/pkg/pubsub/org_soft_delete.go, authz/pkg/pubsub/org_soft_delete_test.go, authz/pkg/pubsub/study.go, authz/pkg/repo/organization.go, docsvc/pkg/models/document/org_deletion_gcs_test.go …
--- tusker/pubsub/pubsub.go
@@ -254,6 +254,12 @@ func onboardMsgHandler(ctx context.Context, msgType string, msgInt interface{},
return fmt.Errorf("could not perform svc hold for org %s: %w", msg.ObjectId, err)
}
case tildaobj.OperationDeleted:
+ if msg.IsSoftDelete() {
+ // Org archive: authz has already marked the org inbox and its tasks delpending, and
+ // the TUSKER_SVC hold stays so nothing is physically remo
… (270 more characters not kept)
9. search_code repo=main, text=user is not part of study · 1186 chars back
finsvc/pkg/http/httperror.go
31: if strings.Contains(err.Error(), "does not have access to Careplans") || strings.Contains(err.Error(), "user is not part of study") {
32: er.ToastMsg = "user is not part of study"
notifsvc/pkg/http/httperror.go
31: if strings.Contains(err.Error(), "does not have access to Careplans") || strings.Contains(err.Error(), "user is not part of study") {
32: er.ToastMsg = "user is not part of study"
execsvc/pkg/handlers/errors.go
144: if strings.Contains(msg, "does not have access to Careplans") || strings.Contains(msg, "user is not part of study") {
145: response["toastMsg"] = "user is not part of study"
docsvc/pkg/handlers/helpers.go
40: if strings.Contains(msg, "does not have access to Careplans") || strings.Contains(msg, "user is not part of study") {
41: response["toastMsg"] = "user is not part of study"
e2e/automation/knowledge/tasks.md
113: - **A task the caller cannot see is 500, not 404 or 403**: `tasklib.GetTask` errors (`not found`, or `user is not part of study` for an org member who is not a study actor, such as TEST_MISC) are all
patientsvc/internal/task.go
201: msg := fmt.Sprintf("user is not part of study")
10. commit_diff repo=main, sha=9b80cb7b6, path=tusker · 2848 chars back
9b80cb7b6 2026-11-12T06:30 arzatskis: Use camelCase for API query params and JSON fields across Go and Python services (#17334)
109 files changed: AGENTS.md, authz/pkg/handlers/members.go, authz/pkg/handlers/staff.go, authz/pkg/health/credentialcheck_test.go, authz/pkg/health/screeningclient.go, common/params/params.go, data-science/authzsvc/authz_svc/app.py, data-science/authzsvc/pyproject.toml, data-science/authzsvc/uv.lock, data-science/chat-agent/Dockerfile, data-science/chat-agent/Dockerfile.evals, data-science/chat-agent/pyproject.toml, data-science/chat-agent/src/artifacts/api_models.py, data-science/chat-agent/src/artifacts/blocks.py, data-science/chat-agent/src/artifacts/models.py, data-science/chat-agent/src/artifacts/route.py, data-science/chat-agent/src/auth/route.py, data-science/chat-agent/src/chat_agent/api_models.py, data-science/chat-agent/src/import_jobs/api_models.py, data-science/chat-agent/src/memory/api_models.py, data-science/chat-agent/src/memory/dependencies.py, data-science/chat-agent/src/memory/route.py, data-science/chat-agent/src/projects/models.py, data-science/chat-agent/src/runs/api_models.py, data-science/chat-agent/src/threads/route.py …
--- tildaobj/tusker_obj_defs.go
@@ -130,7 +130,7 @@ type TaskSearchParams struct {
Categories []string `in:"query=category" json:"category"` // Classification category
Priorities []int `in:"query=priority" json:"priority"` // Task priority level
States []str
… (1348 more characters not kept)
11. read_file repo=main, path=e2e/automation/knowledge/tasks.md, start_line=105, end_line=125 · 2623 chars back
e2e/automation/knowledge/tasks.md (120 lines), lines 105-120:
105 - `test_get_visit_exec_task_with_invalid_task_id` expects 404 (the not-found remap) and `test_with_missing_associationId` expects `"objLabel Study: get with empty tildaId…"` (the empty-tildaid guard).
106
107 ## Update, bulk update, changelogs, stats, assignment, inboxes (`test_tasks.py`)
108
109 Tasks come from `DocumentTask.create_upload_task_for_study` (`RequestRecords`, assigned to TEST_USER, so it is in the caller's User inbox) because it returns the task id and needs no careplan. The fixtures are in `tusker
110
111 - **`PUT /api/tasks/{id}`** answers 200 `"Update successful"` (a JSON string). It writes `priority` (non-zero), `due_before` (non-zero), `assignment` (`automatic`/`manual`) and `note`. The `UpdateTaskWithNote` changelog
112 - 400 `invalid assignment <v> value`; 400 `wrong endpoint to complete task` for `state` `completed` or `not applicable` (completion belongs to the owning service); 400 `cannot change state of completed task`. All of th
113 - **A task the caller cannot see is 500, not 404 or 403**: `tasklib.GetTask` errors (`not found`, or `user is not part of study` for an org member who is not a study actor, such as TEST_MISC) are all `could not find ta
114 - An empty body `{}` is a 200 no-op.
115 - **`PUT /api/tasks/bulk`** reads only `tildaid`, `due_before`, `assignment` and `note`; priority and state in an entry are ignored. It does not validate `assignment`. An unknown id abor
… (1123 more characters not kept)
12. commits repo=main, path=tusker/api/tasks.go, since=2026-11-01T00:00:00Z · 127 chars back
9b80cb7b6 2026-11-12T06:30 arzatskis: Use camelCase for API query params and JSON fields across Go and Python services (#17334)
13. search_code repo=main, text=func RespondWithJSON · 245 chars back
dslsvc/pkg/rest/errors.go
tusker/internal/util.go
16: func RespondWithJSON(w http.ResponseWriter, code int, payload interface{}) {
payoutsvc/api/handlers/helpers.go
regsvc/api/routes.go
workplansvc/pkg/handlers/respond.go
common/utils/utils.go
14. commits repo=main, path=tusker, since=2026-11-13T00:00:00Z · 118 chars back
03f9c2d6b 2026-11-13T17:58 Shashank-Agrawal12: authz: organization archive (soft delete) and purge (ENG-7837) (#17340)
15. commits repo=main, path=tasklib, since=2026-11-10T00:00:00Z · 38 chars back
no commits to that path in that window
16. read_file repo=main, path=tusker/internal/util.go, start_line=1, end_line=70 · 2406 chars back
tusker/internal/util.go (75 lines), lines 1-70:
1 package internal
2
3 import (
4 "encoding/json"
5 "errors"
6 "net/http"
7 "os"
8
9 "github.com/tildabio/main/common/apijson"
10 "github.com/tildabio/main/common/authlib"
11 logger "github.com/tildabio/main/util/observability"
12 "go.uber.org/zap"
13 )
14
15 // respondWithJSON write json response format
16 func RespondWithJSON(w http.ResponseWriter, code int, payload interface{}) {
17 Logger := logger.Get()
18 w.Header().Set("Content-Type", "application/json")
19 w.WriteHeader(code)
20 if payload != nil {
21 response, _ := apijson.Marshal(payload)
22 if _, err := w.Write(response); err != nil {
23 Logger.Error("failed to write HTTP response", zap.Error(err))
24 }
25 }
26 }
27
28 // respondwithError return error message
29 func RespondWithError(w http.ResponseWriter, code int, msg string) {
30 RespondWithJSON(w, code, map[string]string{"message": msg})
31 }
32
33 func DecodeBody(r *http.Request, v interface{}) error {
34 return json.NewDecoder(r.Body).Decode(v)
35 }
36
37 // Read json config file
38 //
39 // NOTE (ENG-5028, flagged not fixed): callers include config.configRead(),
40 // which config.ConfigInit() runs once at boot AND schedules forever afterwards
41 // via a background goroutine (every kConfigReadFreq seconds). A transient
42 // read/decode failure on a later reload -- not just at boot -- os.Exit()s the
43 // whole tusker process via these Fatals. Left as-is: this function has no
44 /
… (906 more characters not kept)
17. search_code repo=main, text=internal.GetOrg, path_prefix=tusker/api/tasks.go · 30 chars back
no match on the default branch
18. commits repo=main, path=common/apijson · 101 chars back
a90d083b9 2026-11-03T19:35 arzatskis: Return empty arrays instead of null from API responses (#16800)
19. search_code repo=main, text=func Marshal, path_prefix=common/apijson · 69 chars back
common/apijson/apijson.go
32: func Marshal(v any) ([]byte, error) {
20. commit_diff repo=main, sha=a90d083b9, path=common/apijson/apijson.go · 5911 chars back
a90d083b9 2026-11-03T19:35 arzatskis: Return empty arrays instead of null from API responses (#16800)
42 files changed: AGENTS.md, advpsvc/internal/advocate.go, advpsvc/internal/advorg.go, advpsvc/internal/campaign.go, advpsvc/internal/condition.go, advpsvc/internal/rate_plan.go, advpsvc/internal/screener.go, authz/pkg/handlers/errors.go, common/apijson/apijson.go, common/apijson/apijson_test.go, dashQL/handlers/chart_handler.go, docsvc/pkg/handlers/helpers.go, dslsvc/pkg/rest/errors.go, ehrsub/server.go, enrollsvc/internal/chartreview.go, enrollsvc/internal/crlist.go, enrollsvc/internal/filter.go, enrollsvc/internal/keyword.go, enrollsvc/internal/report.go, enrollsvc/internal/sponsor.go, enrollsvc/internal/study.go, enrollsvc/internal/study_by_org.go, enrollsvc/internal/study_notification_digest_api.go, enrollsvc/internal/study_notifications.go, eventsvc/server.go …
--- common/apijson/apijson.go
@@ -0,0 +1,283 @@
+// Package apijson marshals HTTP response bodies so that nil slices encode as []
+// and nil maps as {} rather than null, matching what clients expect for
+// collection-valued fields.
+//
+// encoding/json/v2 can do this natively, but before Go 1.27 it only exists under
+// GOEXPERIMENT=jsonv2, which every service build would need. Once the repo is on
+// Go 1.27, replace the reflection below with a v2 marshal using
+// jsonv1.DefaultOptionsV1() plus json.FormatNilSliceAsNull(false) and
+// json.FormatNilMapAsNull(false): v2's own defaults change more than collec
… (4411 more characters not kept)
21. search_code repo=main, text=not part of study, path_prefix=tasklib · 30 chars back
no match on the default branch
22. search_code repo=main, text=func GetTask( · 501 chars back
notifsvc/pkg/api/msgService.go
common/tasklib/tasklib.go
265: func GetTask(ctx context.Context, dbi interface{}, org string, id string, userEmail string) (*tildaobj.Task, error) {
execsvc/pkg/handlers/task.go
350: func GetTask(w http.ResponseWriter, r *http.Request) {
finsvc/pkg/api/finService.go
execsvc/pkg/execution/taskMgmt.go
496: func GetTask(ctx context.Context, taskId string, user *tildaobj.User, organization *tildaobj.Organization, hidePHI, newVisitModal bool) (interface{}, error) {
23. read_file repo=main, path=common/tasklib/tasklib.go, start_line=255, end_line=360 · 5165 chars back
common/tasklib/tasklib.go (2105 lines), lines 255-360:
255 if err != nil {
256 return "", fmt.Errorf("failed to lock task %v: %w", taskId, err)
257 }
258 if len(result.Results) == 0 {
259 return "", fmt.Errorf("task %v not found while locking its state", taskId)
260 }
261 state, _ := result.Results[0][0].(string)
262 return state, nil
263 }
264
265 func GetTask(ctx context.Context, dbi interface{}, org string, id string, userEmail string) (*tildaobj.Task, error) {
266 task := &tildaobj.Task{}
267 // The Study-inbox arm never admits a Training task: it is visible exactly where its Category inboxes
268 // are, or any org of the study could open a CRO's study-team training by id.
269 cypher := `
270 match (o:` + tildaobj.DBTypeOrganization + `{alias:$orgAlias})
271 match (task:` + tildaobj.DBTypeTask + `{tildaid:$taskId})
272 with case when (exists ((task)-[:` + tildaobj.TaskToInboxEdgeLabel + `]->(:` + tildaobj.DBTypeInbox + `)-[:` + tildaobj.InboxToOrganizationEdgeLabel + `]->(o))
273 or exists ((task)-[:` + tildaobj.TaskToInboxEdgeLabel + `]->(:` + tildaobj.DBTypeInbox + `{type:'User'})-[:` + tildaobj.InboxToUserEdgeLabel + `]->(:User{email:$userEmail}))
274 or (coalesce(task.category, '') <> $trainingCategory and exists((task)-[:` + tildaobj.TaskToInboxEdgeLabel + `]-(:` + tildaobj.DBTypeInbox + `{type:'Study'})-[:` + tildaobj.InboxToStudyEdgeLabel + `]-(:` + tildaobj.DBTy
275 then task end as t, o
276 with t, o
277 optional match (t)-[:` + tildaobj.Ta
… (3665 more characters not kept)
24. commits repo=main, path=common/tasklib/tasklib.go, since=2026-11-01T00:00:00Z · 38 chars back
no commits to that path in that window
25. read_file repo=main, path=e2e/automation/tests/fixtures/tusker_task_fixtures.py, start_line=1, end_line=120 · 3905 chars back
e2e/automation/tests/fixtures/tusker_task_fixtures.py (100 lines), lines 1-100:
1 import time
2
3 import pytest
4
5 from automation.db.config import Neo4jConnection
6 from automation.models.document_task import DocumentTask
7 from automation.models.inbox import Inbox
8 from automation.models.task import Task
9
10 UPDATE_DUE_BEFORE = "2244-01-02T00:00:00Z"
11 UPDATE_NOTE = "tusker-tasks-update-note"
12
13
14 def _stats_baseline(headers, inbox_id):
15 response = Task(headers).get("stats", params={"inbox": inbox_id})
16 assert response.status_code == 200, f"baseline stats failed: {response.status_code} — {response.text}"
17 stats = response.json()
18 return {
19 "selected": stats["selectedStateCount"],
20 "categories": {item["category"]: item["count"] for item in stats["categoryCounts"] or []},
21 "priorities": {item["priority"]: item["count"] for item in stats["priorityCounts"] or []},
22 }
23
24
25 def _create_task(headers, study_id, user_id, label):
26 title = f"Tusker-Tasks-{label}-{time.time_ns()}"
27 task = DocumentTask(headers).create_upload_task_for_study(study_id, user_id, params={"title": title, "priority": 5})
28 assert task.get("tildaid"), f"task create returned no tildaid: {task}"
29 return task
30
31
32 def _delete_task(task_id):
33 Neo4jConnection().delete_node(node_name="Task", params={"tildaid": task_id})
34
35
36 @pytest.fixture
37 def tusker_inbox_id(test_headers):
38 response = Inb
… (2405 more characters not kept)
26. search_code repo=main, text=tasklib.GetTask(, path_prefix=tusker · 275 chars back
tusker/api/tasks.go
1103: task, err := tasklib.GetTask(r.Context(), tx.DB(), org, taskid, user.Email)
1320: task, err := tasklib.GetTask(r.Context(), tx.DB(), org, curtask.Id, user.Email)
1414: task, err := tasklib.GetTask(r.Context(), tx.DB(), org, taskid, user.Email)
27. search_code repo=main, text=def get_token_user1 · 69 chars back
e2e/automation/tests/fixtures/common.py
251: def get_token_user1():
28. search_code repo=main, text=TEST_MISC, path_prefix=e2e/automation/knowledge · 2421 chars back
e2e/automation/knowledge/org-and-site-authz.md
30: - **The caller is always `TEST_USER` or `TEST_MISC`.** `TEST_USER` creates the SMO as `org_admin` (`get_token`). `TEST_MISC` (`get_token_user1`) is the subject: it is added as an org member, plus a si
31: - **The member-add responses are not checked.** Only `load_request_data_for_org_admin` implicitly checks its `OrgMember.post`, by indexing `.json()[0]`. The non-admin-member, member, staff and site-ad
e2e/automation/knowledge/ai-inbox.md
12: - Unsigned or forged → **403** `Invalid webhook signature`. A token is accepted once per route and must be under 15 minutes old, so every post takes a fresh one. A user token (`TEST_MISC`) is irreleva
27: - A caller who is not a member of the `Organization` header's org → **403** `org_access_denied`, from the authz middleware before the handler. `TEST_MISC` is a member of the AI Teammates org, so the t
e2e/automation/knowledge/visit-activity.md
21: - Authorization is the route middleware: a user not on the study gets 403 with the plain text `you do not have access to this resource`. `TEST_NON_STUDY` is the caller (`TEST_MISC` is a study recruite
e2e/automation/knowledge/tasks.md
113: - **A task the caller cannot see is 500, not 404 or 403**: `tasklib.GetTask` errors (`not found`, or `user is not part of study` for an org member who is not a study actor, such as TEST_MISC) are all
120: - **Authorization:** an org the caller does not belong to is a platform 403 `user with em
… (921 more characters not kept)
29. read_file repo=main, path=e2e/automation/knowledge/tasks.md, start_line=113, end_line=113 · 286 chars back
e2e/automation/knowledge/tasks.md (120 lines), lines 113-113:
113 - **A task the caller cannot see is 500, not 404 or 403**: `tasklib.GetTask` errors (`not found`, or `user is not part of study` for an org member who is not a study actor, such as TEST_MISC) are all `could not find ta
30. read_file repo=main, path=e2e/automation/knowledge/tasks.md, start_line=120, end_line=120 · 286 chars back
e2e/automation/knowledge/tasks.md (120 lines), lines 120-120:
120 - **Authorization:** an org the caller does not belong to is a platform 403 `user with email cannot access organization with alias <alias>` on every route, including the read-only `/categories`. TEST_MISC is a member of
31. read_file repo=main, path=e2e/automation/knowledge/visit-activity.md, start_line=21, end_line=21 · 274 chars back
e2e/automation/knowledge/visit-activity.md (25 lines), lines 21-21:
21 - Authorization is the route middleware: a user not on the study gets 403 with the plain text `you do not have access to this resource`. `TEST_NON_STUDY` is the caller (`TEST_MISC` is a study recruiter).
32. search_code repo=main, text=recruiter, path_prefix=e2e/automation/tests/fixtures · 75 chars back
e2e/automation/tests/fixtures/common.py
327: "study_role": ["recruiter"],
33. search_code repo=main, text=TEST_NON_STUDY, path_prefix=e2e/automation · 1040 chars back
e2e/automation/knowledge/visit-activity.md
21: - Authorization is the route middleware: a user not on the study gets 403 with the plain text `you do not have access to this resource`. `TEST_NON_STUDY` is the caller (`TEST_MISC` is a study recruite
e2e/automation/knowledge/crosite.md
37: The archive guard refuses anyone still on a study team, and the session-scoped `v2_protocol` fixture enrols slots 0-2 on the shared CRO study. `TEST_NON_STUDY` is the one pool entry `sample_team_membe
39: **If `TEST_NON_STUDY` ever gains a study role, every archive test 409s at once.**
e2e/automation/knowledge/careplan-discontinue-and-gates.md
15: | Member of the careplan's org with no study role (`TEST_NON_STUDY`) | 403 | `you do not have access to this resource` |
e2e/automation/knowledge/edc-data-and-queries.md
183: asserts the 403 for `TEST_NON_STUDY` instead. Success paths for the routes the shared protocol cannot drive (edit,
e2e/automation/tests/execsvc/test_careplan_rows.py
e2e/automation/tests/execsvc/test_visit_activity.py
34. read_file repo=main, path=e2e/automation/tests/fixtures/common.py, start_line=300, end_line=360 · 2315 chars back
e2e/automation/tests/fixtures/common.py (403 lines), lines 300-360:
300 {
301 "user_email": os.getenv("TEST_USER"),
302 "org_role": "org_admin,chart_reviewer,finance_view,finance_edit",
303 "study_role": ["crc"],
304 "site_role": ["site_admin"],
305 },
306 {
307 "user_email": os.getenv("TEST_PI"),
308 "org_role": "org_admin",
309 "study_role": ["principal_investigator"],
310 "site_role": ["site_admin"],
311 },
312 {
313 "user_email": os.getenv("TEST_ANALYST"),
314 "org_role": "member",
315 "study_role": ["qa_analyst"],
316 "site_role": ["site_admin"],
317 },
318 {
319 "user_email": os.getenv("TEST_DA"),
320 "org_role": "member",
321 "study_role": ["data_analyst"],
322 "site_role": ["site_admin"],
323 },
324 {
325 "user_email": os.getenv("TEST_MISC"),
326 "org_role": "member",
327 "study_role": ["recruiter"],
328 "site_role": ["site_admin"],
329 },
330 {
331 "user_email": os.getenv("TEST_NON_STUDY", "[email protected]"),
332 "org_role": "member",
333 "study_role": [],
334 "site_role": [],
335 },
336 ]
337
338 yield teamMembers
339
340
341 @pytest.fixture(scope="session")
342 def
… (815 more characters not kept)
What it was shown (build 597, 41.9 KB)
The run
{
"job": "api-tests-master",
"build": 597,
"kind": "api-tests",
"result": "SUCCESS",
"started": "2026-11-15T00:26:03Z",
"tests": 1024,
"failed": 40,
"test_commit": "03f9c2d6b",
"cluster_prepared": {
"mode": "prepare",
"result": "ready",
"product_commit": "f56eb0825"
}
}
services
[
"docsvc",
"execsvc",
"patientsvc",
"schedsvc",
"enrollsvc",
"studiosvc",
"finsvc",
"notifsvc",
"dslsvc",
"authz",
"dashQL",
"dashRsvc",
"regsvc",
"advpsvc",
"workplansvc",
"datasvc",
"payoutsvc",
"tusker",
"authsvc",
"eventsvc",
"ehrsvc",
"docproc",
"studioai",
"sense"
]
The cluster during the run
{
"findings_opened_around_the_run": [],
"long_standing_findings_left_out": 7,
"pods_in_trouble_during_the_run": [
{
"workload": "tilda/chat-agent",
"probe": 1.0,
"first_minutes_after_run_start": 8
}
],
"deploys_during_the_run": [
{
"app": "execsvc",
"minutes_after_run_start": 33,
"image": "",
"by": "automated"
},
{
"app": "studioaisvc",
"minutes_after_run_start": 33,
"image": "",
"by": "automated"
},
{
"app": "docproc",
"minutes_after_run_start": 33,
"image": "",
"by": "automated"
},
{
"app": "docsvc",
"minutes_after_run_start": 33,
"image": "",
"by": "automated"
},
{
"app": "exportsvc",
"minutes_after_run_start": 33,
"image": "",
"by": "automated"
},
{
"app": "tusker",
"minutes_after_run_start": 33,
"image": "",
"by": "automated"
},
{
"app": "dashrsvc",
"minutes_after_run_start": 33,
"image": "",
"by": "automated"
},
{
"app": "dashql",
"minutes_after_run_start": 33,
"image": "",
"by": "automated"
},
{
"app": "notifsvc",
"minutes_after_run_start": 33,
"image": "",
"by": "automated"
},
{
"app": "chat-agent",
"minutes_after_run_start": 33,
"image": "",
"by": "automated"
},
{
"app": "virtual-assistant",
"minutes_after_run_start": 33,
"image": "",
"by": "automated"
},
{
"app": "onboardingsvc",
"minutes_after_run_start": 33,
"image": "",
"by": "automated"
}
]
}
The group
{
"tests": 3,
"suite": "Tasks",
"members": [
{
"test": "automation/tests/tusker/test_tasks.py::TestTasks::test_get_task_stats_unknown_inbox_is_empty",
"pattern": "new",
"meaning": "first seen failing",
"newest_first": "F",
"failing_in_a_row": 1,
"this_error_in_a_row": 1,
"this_error_since_build": 597,
"failing_since_build": 597,
"last_passed_build": null
},
{
"test": "automation/tests/tusker/test_tasks.py::TestTasks::test_update_task_by_member_outside_study_is_rejected[single]",
"pattern": "new",
"meaning": "first seen failing",
"newest_first": "F",
"failing_in_a_row": 1,
"this_error_in_a_row": 1,
"this_error_since_build": 597,
"failing_since_build": 597,
"last_passed_build": null
},
{
"test": "automation/tests/tusker/test_tasks.py::TestTasks::test_update_task_by_member_outside_study_is_rejected[bulk]",
"pattern": "new",
"meaning": "first seen failing",
"newest_first": "F",
"failing_in_a_row": 1,
"this_error_in_a_row": 1,
"this_error_since_build": 597,
"failing_since_build": 597,
"last_passed_build": null
}
]
}
The failure
{
"test": "automation/tests/tusker/test_tasks.py::TestTasks::test_get_task_stats_unknown_inbox_is_empty",
"status": "failed",
"message": "assert [] is None",
"traceback_tail": "automation/tests/tusker/test_tasks.py:91: in test_get_task_stats_unknown_inbox_is_empty\n assert stats[\"categoryCounts\"] is None\nE assert [] is None",
"requests": [
{
"trace_id": "a917e57adadeaacbb6e3e490361fa160",
"method": "GET",
"path": "/api/tasks/stats",
"status": "200",
"error": "None"
}
],
"errors_the_services_logged_for_these_requests": "none: no service logged an error under these requests' trace ids"
}
Console lines about this test
{
"from": "console.log",
"lines": [
"650: ERROR E assert 'could not find organization \"no-such-org-1794704315749\"' in 'no live organization has alias \"no-such-org-1794704315749\"; to resume an archive that did not finish, pass its orgId'",
"651: ERROR E + where 'could not find organization \"no-such-org-1794704315749\"' = <built-in method format of str object at 0x79cb793118e0>('no-such-org-1794704315749')",
"652: ERROR E + where <built-in method format of str object at 0x79cb793118e0> = 'could not find organization \"{}\"'.format",
"653: ERROR _____________ TestTasks.test_get_task_stats_unknown_inbox_is_empty _____________",
"654: INFO automation/tests/tusker/test_tasks.py:91: in test_get_task_stats_unknown_inbox_is_empty",
"655: INFO assert stats[\"categoryCounts\"] is None",
"656: ERROR E assert [] is None",
"657: ERROR ____ TestTasks.test_update_task_by_member_outside_study_is_rejected[single] ____",
"\u2026",
"751: ERROR FAILED automation/tests/onboardingsvc/organization/test_archive_org.py::TestArchiveOrg::test_archive_unknown_alias - assert 'could not find organization \"no-such-org-1794704315749\"' in 'no live organization has alias \"no-such-org-1794704315749\"; to resume an archive that did not finish, pass i",
"752: INFO + where 'could not find organization \"no-such-org-1794704315749\"' = <built-in method format of str object at 0x79cb793118e0>('no-such-org-1794704315749')",
"753: INFO + where <built-in method format of str object at 0x79cb793118e0> = 'could not find organization \"{}\"'.format",
"754: ERROR FAILED automation/tests/tusker/test_tasks.py::TestTasks::test_get_task_stats_unknown_inbox_is_empty - assert [] is None",
"755: ERROR FAILED automation/tests/tusker/test_tasks.py::TestTasks::test_update_task_by_member_outside_study_is_rejected[single] - assert 200 == 500",
"756: INFO + where 200 = <Response [200]>.status_code",
"757: ERROR FAILED automation/tests/tusker/test_tasks.py::TestTasks::test_update_task_by_member_outside_study_is_rejected[bulk] - assert 200 == 500"
]
}
The test's history
{
"pattern": "new",
"meaning": "first seen failing",
"newest_first": "F",
"failing_in_a_row": 1,
"this_error_in_a_row": 1,
"this_error_since_build": 597
}
The test's source
{
"repo": "tildabio/main",
"at": "03f9c2d6b",
"path": "e2e/automation/tests/tusker/test_tasks.py",
"from_line": 85,
"failing_line": 91,
"code": "85 def test_get_task_stats_unknown_inbox_is_empty(self, test_headers):\n86 response = Task(test_headers).get(\"stats\", params={\"inbox\": \"no-such-inbox\"})\n87 \n88 assert response.status_code == 200, f\"Get stats failed: {response.status_code} \u2014 {response.text}\"\n89 stats = response.json()\n90 assert stats[\"selectedStateCount\"] == 0\n91> assert stats[\"categoryCounts\"] is None\n92 assert stats[\"priorityCounts\"] is None\n93 \n94 def test_get_assignable_users_for_task(self, tusker_task):\n95 response = Task(tusker_task[\"headers\"]).get(\"assignment\", params={\"taskid\": tusker_task[\"task_id\"]})\n96 assert response.status_code == 200, f\"Get assignable users failed: {response.status_code} \u2014 {response.text}\"\n97 users = response.json()\n98 \n99 caller = next((user for user in users if user[\"email\"] == USER_EMAIL), None)\n100 assert caller is not None, f\"{USER_EMAIL} is not offered for assignment: {[u['email'] for u in users]}\"\n101 assert \"org_admin\" in caller[\"role\"]\n102 assert caller[\"tildaid\"]\n103 \n104 def test_get_assignable_users_for_category(self, test_headers):\n105 response = Task(test_headers).get(\"assignment\", params={\"category\": TASK_CATEGORY})\n106 assert response.status_code == 200, f\"Get assignable users failed: {response.status_code} \u2014 {response.text}\"\n107 \n108 assert USER_EMAIL in [user[\"email\"] for user in response.json()]\n109 \n110 def test_get_assignable_users_unknown_task(self, test_headers):\n111 response = Task(test_headers).get(\"assignment\", params={\"taskid\": \"no-such-task\"})\n112 \n113 assert response.status_code == 404\n114 assert \"could not find task with passed task ID\" in response.json()[\"message\"]\n115 \n116 def test_get_assignable_users_without_task_or_category(self, test_headers):\n117 response = Task(test_headers).get(\"assignment\")\n118 \n119 assert response.status_code == 400\n120 assert \"must Specify a Category or TaskId\" in response.json()[\"message\"]\n121 \n122 def test_update_task_priority_due_date_assignment_and_note(self, tusker_updated_task):\n123 response = tusker_updated_task[\"response\"]\n124 assert response.status_code == 200, f\"Update task failed: {response.status_code} \u2014 {response.text}\"\n125 assert response.json() == \"Update successful\"\n126 \n127 task = Task(tusker_updated_task[\"headers\"]).get_listed_task(\n128 tusker_updated_task[\"inbox_id\"], tusker_updated_task[\"title\"], tusker_updated_task[\"task_id\"]\n129 )\n130 assert task is not None, \"updated task is no longer listed in the caller's inbox\"\n131 assert task[\"priority\"] == 25\n132 assert task[\"assignment\"] == \"manual\"\n133 assert task[\"due_before\"] == UPDATE_DUE_BEFORE\n134 assert task[\"state\"] == \"ready\"\n135 \n136 def test_get_changelogs_after_update_lists_each_change(self, tusker_updated_task):\n137 assert tusker_updated_task[\"response\"].status_code == 200, tusker_updated_task[\"response\"].text\n138 response = Task(tusker_updated_task[\"headers\"]).get(f\"{tusker_updated_task['task_id']}/changelogs\")\n139 assert response.status_code == 200, f\"Get changelogs failed: {response.status_code} \u2014 {response.text}\"\n140 logs = response.json()\n141 \n142 assert logs[0][\"reason\"] == \"created task\"\n143 assert logs[0][\"operation\"] == \"Create\"\n144 assert logs[0][\"scopeId\"] == tusker_updated_task[\"task_id\"]\n145 update = logs[-1]\n146 assert update[\"type\"] == \"Task Comment\"\n147 assert update[\"operation\"] == \"Update\"\n148 assert update[\"description\"] == UPDATE_NOTE\n149 assert update[\"email\"] == USER_EMAIL\n150 for change in (\"changed priority to low.\", \"changed due date to 2244-01-02.\", \"changed assignment to manual.\"):\n151 assert change in update[\"reason\"], f\"{change!r} missing from reason {update['reason']!r}\"\n152 \n153 def test_get_changelogs_unknown_task(self, test_headers):\n154 response = Task(test_headers).get(\"no-such-task/changelogs\")\n155 "
}
Commits in the window
{
"note": "no last pass and first failure are on record for these tests, so there is no window of commits to look in"
}
The issue as the agent wrote it
**Fix is in:** the automation suite (e2e): the test is wrong.
**What failed:** `assert [] is None`
**The test is wrong**, confidence medium. Found in `api-tests-master` build 597: [run in X-ray](https://xray.tilda.pizza/tests/run/api-tests-master/597).
These tests were added in e0b8dc44d (ENG-8483) and have never passed. They encode stale or wrong expectations.
1) Stats: e2e/automation/tests/tusker/test_tasks.py:91-92 expects `categoryCounts`/`priorityCounts` to be null for an unknown inbox. tusker's `RespondWithJSON` (tusker/internal/util.go:21) marshals through `apijson.Marshal`. Since a90d083b9 (Nov 3, 'Return empty arrays instead of null') that turns nil slices into `[]`, so `[]` is the intended output. knowledge/tasks.md:117 is stale on this point.
2) Outside-study tests (`[single]`, `[bulk]`): they expect 500 'user is not part of study' but get 200. The member is TEST_MISC (`get_token_user1`). The shared study's team fixture (fixtures/common.py:324-329) gives TEST_MISC the study role `recruiter`, so `tasklib.GetTask` finds an actor and does not refuse. TEST_NON_STUDY has no study role and is the likelier user for this case. I did not confirm that the task sits in the shared `data["study"]`, or that TEST_MISC is an actor of it in this run.
The mid-run deploys and the chat-agent pod trouble are not tied to these requests, and the responses are deterministic 200s with no service errors.
**Service:** tusker
**Proposed fix:**
In test_tasks.py:91-92 assert `stats["categoryCounts"] == []` and `stats["priorityCounts"] == []`, and update knowledge/tasks.md:117 to match. For `test_update_task_by_member_outside_study_is_rejected`, call `build_org_header` with a pool user who has no study role (TEST_NON_STUDY, the one the other tests use for 'member with no study role') instead of `get_token_user1`. Then keep the 500 / 'user is not part of study' assertions, and fix the knowledge note that names TEST_MISC as a non-actor.
**Failing tests (3):**
- [automation/tests/tusker/test_tasks.py::TestTasks::test_get_task_stats_unknown_inbox_is_empty](https://xray.tilda.pizza/tests/case/f535a0c276c98b1f) (first time seen)
- [automation/tests/tusker/test_tasks.py::TestTasks::test_update_task_by_member_outside_study_is_rejected[single]](https://xray.tilda.pizza/tests/case/031ec8811708c3f7) (first time seen)
- [automation/tests/tusker/test_tasks.py::TestTasks::test_update_task_by_member_outside_study_is_rejected[bulk]](https://xray.tilda.pizza/tests/case/77bcddc95a10c1d7) (first time seen)
**Error:**
```
assert [] is None
```
The test agent picks this ticket up and opens the pull request.
```yaml
suite: api
feature: fix-test-tasks
find: true
fix: true
target_file: e2e/automation/tests/tusker/test_tasks.py
failing_tests:
- automation/tests/tusker/test_tasks.py::TestTasks::test_get_task_stats_unknown_inbox_is_empty
- automation/tests/tusker/test_tasks.py::TestTasks::test_update_task_by_member_outside_study_is_rejected[single]
- automation/tests/tusker/test_tasks.py::TestTasks::test_update_task_by_member_outside_study_is_rejected[bulk]
acceptance:
- Each test in failing_tests passes on the automation cluster.
- 'No assertion is weakened to make a test pass: the test still checks the behaviour it was written for.'
request: 'Fix existing tests that fail on master. Do not write new coverage.
Error: assert [] is None
Diagnosis: These tests were added in e0b8dc44d (ENG-8483) and have never passed. They encode stale or
wrong expectations.
1) Stats: e2e/automation/tests/tusker/test_tasks.py:91-92 expects `categoryCounts`/`priorityCounts`
to be null for an unknown inbox. tusker''s `RespondWithJSON` (tusker/internal/util.go:21) marshals through
`apijson.Marshal`. Since a90d083b9 (Nov 3, ''Return empty arrays instead of null'') that turns nil slices
into `[]`, so `[]` is the intended output. knowledge/tasks.md:117 is stale on this point.
2) Outside-study tests (`[single]`, `[bulk]`): they expect 500 ''user is not part of study'' but get
200. The member is TEST_MISC (`get_token_user1`). The shared study''s team fixture (fixtures/common.py:324-329)
gives TEST_MISC the study role `recruiter`, so `tasklib.GetTask` finds an actor and does not refuse.
TEST_NON_STUDY has no study role and is the likelier user for this case. I did not confirm that the
task sits in the shared `data["study"]`, or that TEST_MISC is an actor of it in this run.
The mid-run deploys and the chat-agent pod trouble are not tied to these requests, and the responses
are deterministic 200s with no service errors.
Proposed change: In test_tasks.py:91-92 assert `stats["categoryCounts"] == []` and `stats["priorityCounts"]
== []`, and update knowledge/tasks.md:117 to match. For `test_update_task_by_member_outside_study_is_rejected`,
call `build_org_header` with a pool user who has no study role (TEST_NON_STUDY, the one the other tests
use for ''member with no study role'') instead of `get_token_user1`. Then keep the 500 / ''user is not
part of study'' assertions, and fix the knowledge note that names TEST_MISC as a non-actor.'
```
+++ Agent notes
Filed by X-ray's triage agent. Models asked: claude-sonnet-5-5; settled by deep; 34 lookups in the code and its history.
Group `triage:f7f70e59baaf0a` (one issue per root cause).
A wrong verdict can be corrected on the run page in X-ray.
+++