Skip to content

Commit d8d4ca3

Browse files
authored
feat(schemas): namespace the case task (#1845)
`task` was claimed by three apps: planninq, pipelinq and this one. They share `description`, `priority` and `status` — what any task-shaped record carries, and nothing that identifies the record. planninq's project task is the largest and keeps the bare slug; pipelinq's became `crmTask`. WHAT THE SUITE FOUND THAT THE GREP DID NOT. The rename reached the descriptors, the config-key map and every store call on the first pass, and the suite still failed six times — twice for the same reason in two different places. KpiAggregationService::ids() and DemoCaseloadGateway::schemaIds() each build a LOCAL array keyed 'task' and hand it round as $ids['task']. Renaming the readers without the builders left $ids['caseTask'] resolving to null, which surfaced as a TypeError on a nullable argument three frames away, in a class that never mentions the slug. Then PHPStan caught the declared array shapes still saying `task: string` after the builders moved. Neither would ever appear in `grep -rn "'task'"`-shaped triage as a schema reference: the array key is not the slug, it is just spelled like it. This is the first rename tonight where the escaped sites were STRUCTURAL rather than lexical. tests/e2e/ci-seed.sh names the slug in its required-schema list and moved with it — that list is checked after the import and exits BEFORE Playwright, so a miss reports every spec as not run rather than as a failure. Decoys left alone: `itemType` in WorkQueueService and the `type` key in CaseReassignmentService, BulkReassignModal, taskApi and dashboardHelpers, all row labels for mixed lists. Full suite: 3,045 tests, 18,012 assertions, exit 0. phpcs, phpstan, psalm exit 0.
1 parent 937f1e6 commit d8d4ca3

44 files changed

Lines changed: 172 additions & 84 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/Repair/RenameCollidingSchemaSlugs.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ class RenameCollidingSchemaSlugs implements IRepairStep {
6969
*/
7070
private const RENAMES = [
7171
'supplierInvoice' => ['to' => 'caseSupplierInvoice', 'with' => 'shillinq'],
72+
// The case task. `task` was claimed by three apps and they share only
73+
// `description`, `priority` and `status`. planninq's project task is the
74+
// largest and keeps the bare slug; pipelinq took crmTask.
75+
'task' => ['to' => 'caseTask', 'with' => 'planninq, pipelinq'],
7276
];
7377

7478
/**

lib/Service/DemoCaseloadGateway.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function __construct(
6565
/**
6666
* The register and schema ids the demo caseload reads and writes.
6767
*
68-
* @return array{register: string, case: string, task: string, caseType: string, statusType: string} The ids.
68+
* @return array{register: string, case: string, caseTask: string, caseType: string, statusType: string} The ids.
6969
*
7070
* @throws RuntimeException When the app is not configured against a register yet.
7171
*
@@ -75,7 +75,7 @@ public function schemaIds(): array {
7575
$ids = [
7676
'register' => $this->config(key: 'register'),
7777
'case' => $this->config(key: 'case_schema'),
78-
'task' => $this->config(key: 'task_schema'),
78+
'caseTask' => $this->config(key: 'task_schema'),
7979
'caseType' => $this->config(key: 'case_type_schema'),
8080
'statusType' => $this->config(key: 'status_type_schema'),
8181
];

lib/Service/DemoCaseloadReport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function buckets(?DateTimeImmutable $now = null): array {
9292
$tasks = $this->gateway->findMany(
9393
objectService: $objectService,
9494
registerId: $ids['register'],
95-
schemaId: $ids['task'],
95+
schemaId: $ids['caseTask'],
9696
filters: []
9797
);
9898

lib/Service/DemoCaseloadSeedDataService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ private function createTasks(
257257
$id = $this->gateway->create(
258258
objectService: $objectService,
259259
registerId: $ids['register'],
260-
schemaId: $ids['task'],
260+
schemaId: $ids['caseTask'],
261261
data: $this->taskPayload(taskSeed: $taskSeed, caseId: $caseId, now: $now)
262262
);
263263

lib/Service/KpiAggregationService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ private function countCases(array $ids, array $filters): int {
192192
* @return int The count.
193193
*/
194194
private function countTasks(array $ids, array $filters): int {
195-
return $this->countObjects(ids: $ids, schema: $ids['task'], filters: $filters);
195+
return $this->countObjects(ids: $ids, schema: $ids['caseTask'], filters: $filters);
196196
}//end countTasks()
197197

198198
/**
@@ -450,13 +450,13 @@ private function toArray(mixed $object): array {
450450
/**
451451
* The register and schema ids these metrics read.
452452
*
453-
* @return array{register: string, case: string, task: string}|null The ids, or null when unconfigured.
453+
* @return array{register: string, case: string, caseTask: string}|null The ids, or null when unconfigured.
454454
*/
455455
private function ids(): ?array {
456456
$ids = [
457457
'register' => $this->appConfig->getValueString(Application::APP_ID, 'register', ''),
458458
'case' => $this->appConfig->getValueString(Application::APP_ID, 'case_schema', ''),
459-
'task' => $this->appConfig->getValueString(Application::APP_ID, 'task_schema', ''),
459+
'caseTask' => $this->appConfig->getValueString(Application::APP_ID, 'task_schema', ''),
460460
];
461461

462462
if (in_array('', $ids, true) === true) {

lib/Service/Settings/SchemaSlugMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class SchemaSlugMap {
4848
public const SLUG_TO_CONFIG_KEY = [
4949
'catalog' => 'catalogus_schema',
5050
'case' => 'case_schema',
51-
'task' => 'task_schema',
51+
'caseTask' => 'task_schema',
5252
'status' => 'status_schema',
5353
'statusRecord' => 'status_record_schema',
5454
'role' => 'role_schema',

lib/Service/Settings/SchemaSlugResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function __construct(
9999
* and dropping the fallback would blank all three.
100100
*
101101
* @param object $schemaMapper The OpenRegister SchemaMapper.
102-
* @param string $slug The schema slug, e.g. 'task'.
102+
* @param string $slug The schema slug, e.g. 'caseTask'.
103103
*
104104
* @return object|null The live schema, or null when the slug does not resolve.
105105
*

lib/Service/Support/JsonEncodedStringProperties.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class JsonEncodedStringProperties {
8686
'notificationChannel' => ['filters'],
8787
'objection' => ['attachments'],
8888
'resultType' => ['sourceDateArchiveProcedure'],
89-
'task' => ['checklist'],
89+
'caseTask' => ['checklist'],
9090
'workflowTemplate' => ['nodePositions', 'steps', 'transitions'],
9191
];
9292

lib/Settings/dossiq_mock_register.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13112,8 +13112,8 @@
1311213112
}
1311313113
}
1311413114
},
13115-
"task": {
13116-
"slug": "task",
13115+
"caseTask": {
13116+
"slug": "caseTask",
1311713117
"x-openregister-notifications": {
1311813118
"taskAssigned": {
1311913119
"trigger": {
@@ -22676,7 +22676,7 @@
2267622676
{
2267722677
"@self": {
2267822678
"register": "dossiq",
22679-
"schema": "task",
22679+
"schema": "caseTask",
2268022680
"slug": "task-voorbeeld-title-1-1",
2268122681
"id": "fab148e2-e14d-45ca-a0c2-58073d5e59b3"
2268222682
},
@@ -22695,7 +22695,7 @@
2269522695
{
2269622696
"@self": {
2269722697
"register": "dossiq",
22698-
"schema": "task",
22698+
"schema": "caseTask",
2269922699
"slug": "task-voorbeeld-title-2-2",
2270022700
"id": "10d3503b-1077-45db-8516-ae4719f1a40f"
2270122701
},
@@ -22714,7 +22714,7 @@
2271422714
{
2271522715
"@self": {
2271622716
"register": "dossiq",
22717-
"schema": "task",
22717+
"schema": "caseTask",
2271822718
"slug": "task-voorbeeld-title-3-3",
2271922719
"id": "0d4e9a65-535b-4ef8-bd93-453713b8fa78"
2272022720
},

lib/Settings/dossiq_register.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,8 +1848,8 @@
18481848
},
18491849
"searchable": true
18501850
},
1851-
"task": {
1852-
"slug": "task",
1851+
"caseTask": {
1852+
"slug": "caseTask",
18531853
"x-openregister-notifications": {
18541854
"taskAssigned": {
18551855
"trigger": {
@@ -9230,7 +9230,7 @@
92309230
"documentType",
92319231
"decisionType",
92329232
"case",
9233-
"task",
9233+
"caseTask",
92349234
"role",
92359235
"result",
92369236
"statusRecord",

0 commit comments

Comments
 (0)