Skip to content

Commit c44dd1b

Browse files
jens-kuertenJens Kürtenclaude
authored
Feat: add reviewers field to release-check events (#50)
Add reviewers: list[Subject] to PartReleaseCheckData and DocumentReleaseCheckData, populated for express releases so consumers know who was assigned to review before the release proceeds. Subject (subject_id + subject_type) is promoted from actions.start_workflow to a shared csfunctions.subject module, since it's now used by both actions and events. Co-authored-by: Jens Kürten <jens.kuerten@contact-software.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 5c9e982 commit c44dd1b

7 files changed

Lines changed: 91 additions & 17 deletions

File tree

‎csfunctions/actions/start_workflow.py‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,10 @@
22

33
from pydantic import BaseModel, Field
44

5+
from ..subject import Subject
56
from .base import ActionNames, BaseAction
67

78

8-
class Subject(BaseModel):
9-
subject_id: str = Field(..., description="ID of the subject, eg. a role name or personalnummer")
10-
subject_type: Literal["Person", "PCS Role", "Common Role"] = Field(
11-
..., description="Type of the subject: Person, PCS Role or Common Role"
12-
)
13-
14-
159
class TaskConfiguration(BaseModel):
1610
task_id: str = Field(..., description="Identifier for the task")
1711
responsible: Subject | None = Field(default=None, description="Responsible subject for the task")

‎csfunctions/events/document_release_check.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from pydantic import BaseModel, Field
44

55
from csfunctions.objects import Document, Part
6+
from csfunctions.subject import Subject
67

78
from .base import BaseEvent, EventNames
89
from .dialog_data import DocumentReleasedDialogData
@@ -12,6 +13,10 @@ class DocumentReleaseCheckData(BaseModel):
1213
documents: list[Document] = Field(..., description="List of documents that will be released.")
1314
parts: list[Part] = Field(..., description="List of parts that belong to the documents")
1415
dialog_data: DocumentReleasedDialogData
16+
reviewers: list[Subject] = Field(
17+
default_factory=list,
18+
description="List of reviewers assigned to the release. Only populated for express releases.",
19+
)
1520

1621

1722
class DocumentReleaseCheckEvent(BaseEvent):

‎csfunctions/events/part_release_check.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from pydantic import BaseModel, Field
44

55
from csfunctions.objects import Document, Part
6+
from csfunctions.subject import Subject
67

78
from .base import BaseEvent, EventNames
89
from .dialog_data import PartReleasedDialogData
@@ -12,6 +13,10 @@ class PartReleaseCheckData(BaseModel):
1213
parts: list[Part] = Field(..., description="List of parts that will be released.")
1314
documents: list[Document] = Field(..., description="List of documents that are referenced by the parts.")
1415
dialog_data: PartReleasedDialogData
16+
reviewers: list[Subject] = Field(
17+
default_factory=list,
18+
description="List of reviewers assigned to the release. Only populated for express releases.",
19+
)
1520

1621

1722
class PartReleaseCheckEvent(BaseEvent):

‎csfunctions/subject.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from typing import Literal
2+
3+
from pydantic import BaseModel, Field
4+
5+
6+
class Subject(BaseModel):
7+
subject_id: str = Field(..., description="ID of the subject, eg. a role name or personalnummer")
8+
subject_type: Literal["Person", "PCS Role", "Common Role"] = Field(
9+
..., description="Type of the subject: Person, PCS Role or Common Role"
10+
)

‎docs/reference/events.md‎

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ Be aware that the document is not released yet and the release might still be ab
5454

5555
**DocumentReleaseCheckEvent.data:**
5656

57-
| Attribute | Type | Description |
58-
| ----------- | ------------------------------------- | ------------------------------------------- |
59-
| documents | list[[Document](objects.md#document)] | List of documents that will be released. |
60-
| parts | list[[Part](objects.md#part)] | List of parts that belong to the documents. |
61-
| dialog_data | DocumentReleaseDialogData | Contents of the dialog. |
57+
| Attribute | Type | Description |
58+
| ----------- | ------------------------------------- | -------------------------------------------------------------------------------- |
59+
| documents | list[[Document](objects.md#document)] | List of documents that will be released. |
60+
| parts | list[[Part](objects.md#part)] | List of parts that belong to the documents. |
61+
| dialog_data | DocumentReleaseDialogData | Contents of the dialog. |
62+
| reviewers | list[Subject] | List of reviewers assigned to the release. Only populated for express releases. |
6263

6364
**DocumentReleaseCheckDialogData:**
6465

@@ -67,6 +68,13 @@ Be aware that the document is not released yet and the release might still be ab
6768
| cdbprot_remark | str \| None | Remark |
6869
| cdb_ec_id | str \| None | Engineering Change ID |
6970

71+
**Subject:**
72+
73+
| Attribute | Type | Description |
74+
| ------------ | ---- | ------------------------------------------------------------------ |
75+
| subject_id | str | ID of the subject, e.g. a role name or "personalnummer" |
76+
| subject_type | str | Type of the subject. Can be "Person", "PCS Role" or "Common Role" |
77+
7078
## DocumentReleasedEvent
7179
`csfunctions.events.DocumentReleasedEvent`
7280

@@ -364,11 +372,12 @@ Be aware that the part is not released yet and the release might still be aborte
364372

365373
**PartReleaseCheckEvent.data:**
366374

367-
| Attribute | Type | Description |
368-
| ----------- | ------------------------------------- | ---------------------------------------------------- |
369-
| parts | list[[Part](objects.md#part)] | List of parts that will released. |
370-
| documents | list[[Document](objects.md#document)] | List of documents that belong to the released parts. |
371-
| dialog_data | PartReleaseDialogData | Contents of the dialog. |
375+
| Attribute | Type | Description |
376+
| ----------- | ------------------------------------- | -------------------------------------------------------------------------------- |
377+
| parts | list[[Part](objects.md#part)] | List of parts that will released. |
378+
| documents | list[[Document](objects.md#document)] | List of documents that belong to the released parts. |
379+
| dialog_data | PartReleaseDialogData | Contents of the dialog. |
380+
| reviewers | list[Subject] | List of reviewers assigned to the release. Only populated for express releases. |
372381

373382
**PartReleaseCheckDialogData:**
374383

@@ -377,6 +386,13 @@ Be aware that the part is not released yet and the release might still be aborte
377386
| cdbprot_remark | str \| None | Remark |
378387
| cdb_ec_id | str \| None | Engineering Change ID |
379388

389+
**Subject:**
390+
391+
| Attribute | Type | Description |
392+
| ------------ | ---- | ------------------------------------------------------------------ |
393+
| subject_id | str | ID of the subject, e.g. a role name or "personalnummer" |
394+
| subject_type | str | Type of the subject. Can be "Person", "PCS Role" or "Common Role" |
395+
380396

381397
## PartReleasedEvent
382398
`csfunctions.events.PartReleasedEvent`

‎docs/release_notes.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ hide:
33
- toc
44
---
55

6+
### Version 0.27.0
7+
- Feat: Add reviewers field to PartReleaseCheckEvent and DocumentReleaseCheckEvent, populated for express releases
8+
69
### Version 0.26.0
710
- Feat: Extend all multi-language object fields with Japanese (ja) and Chinese (zh) variants
811

‎json_schemas/request.json‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7413,6 +7413,14 @@
74137413
},
74147414
"dialog_data": {
74157415
"$ref": "#/$defs/DocumentReleasedDialogData"
7416+
},
7417+
"reviewers": {
7418+
"description": "List of reviewers assigned to the release. Only populated for express releases.",
7419+
"items": {
7420+
"$ref": "#/$defs/Subject"
7421+
},
7422+
"title": "Reviewers",
7423+
"type": "array"
74167424
}
74177425
},
74187426
"required": [
@@ -11137,6 +11145,14 @@
1113711145
},
1113811146
"dialog_data": {
1113911147
"$ref": "#/$defs/PartReleasedDialogData"
11148+
},
11149+
"reviewers": {
11150+
"description": "List of reviewers assigned to the release. Only populated for express releases.",
11151+
"items": {
11152+
"$ref": "#/$defs/Subject"
11153+
},
11154+
"title": "Reviewers",
11155+
"type": "array"
1114011156
}
1114111157
},
1114211158
"required": [
@@ -11263,6 +11279,31 @@
1126311279
"title": "PartReleasedEvent",
1126411280
"type": "object"
1126511281
},
11282+
"Subject": {
11283+
"properties": {
11284+
"subject_id": {
11285+
"description": "ID of the subject, eg. a role name or personalnummer",
11286+
"title": "Subject Id",
11287+
"type": "string"
11288+
},
11289+
"subject_type": {
11290+
"description": "Type of the subject: Person, PCS Role or Common Role",
11291+
"enum": [
11292+
"Person",
11293+
"PCS Role",
11294+
"Common Role"
11295+
],
11296+
"title": "Subject Type",
11297+
"type": "string"
11298+
}
11299+
},
11300+
"required": [
11301+
"subject_id",
11302+
"subject_type"
11303+
],
11304+
"title": "Subject",
11305+
"type": "object"
11306+
},
1126611307
"Workflow": {
1126711308
"properties": {
1126811309
"object_type": {

0 commit comments

Comments
 (0)