icgc-argo / icgc-argo/program-service
UpdateProgram is setting values to 0 or empty when no value is provided
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3
- Forks
- 0
- Avg merge
- 14h 34m
- Merged PRs (30d)
- 2
Description
Describe the bug
When calling the UpdateProgram GRPC service, any field in the input Program object that is left empty (name={} instead of name={value=""}) causes that value in the Program to be set to 0 or "".
This means that to update a single field we need to call GetProgram from Program-Service, provide all the values we want to stay the same, and update the ones we want to change. There should be no need for the client to provide the values that are not changing.
Steps To Reproduce
Steps to reproduce the behaviour:
- Call UpdateProgram with the following body :
{
"program": {
"short_name": {
"value": "{{ShortName of a program you don't mind losing data from}}"
},
"description": {
},
"name": {
},
"membership_type": {
},
"commitment_donors": {
},
"submitted_donors": {
},
"genomic_donors": {
},
"website": {
"value": "Hello"
},
"institutions": {
},
"countries": {
"value": "Hello"
},
"regions": {
},
"cancer_types": [
],
"primary_sites": [
]
}
}
- Call GetProgram for the same program (or check database)
- All values of the program are now empty.
Expected behaviour
No changes to the program from before.
Note: I didn't test the above because I don't want to wipe anything, but I hope that illustrates the problem. That should be a valid message body indicating no change to those fields.
Note 2: There is no object wrapper on PrimarySite or CancerType, so there is no way to indicate we don't want to change those. We will also need to modify the message structure to put those in a {value:[]} structure if we want to support this behaviour in UpdateProgram.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the UpdateProgram and GetProgram entry points and the Program message definition. Reproduce the handling of omitted fields, including PrimarySite and CancerType, and compare it with the expected no-change behavior. Done means omitted fields retain their existing values while explicitly supplied values can still be updated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, java
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100