Commit 64f28dc
authored
[MCP]Fixed CLI bug in
## Why make this change?
When updating an entity with a command like: `dab update Incident
--fields.name "Id" --fields.description "Unique Key"`, the existing
`primary-key` flag on Id was being changed to `false`even though no
`primary-key` option was specified.
This change removes that surprise so primary-key metadata only changes
when explicitly requested.
## What is this change?
- Adjusts the entity update logic so that:
1. If the user does not provide any fields.primary-key option, existing
primary-key flags for fields mentioned in fields.name are preserved.
2. If the user does provide fields.primary-key, those true/false values
are still applied positionally to the corresponding fields exactly as
before.
- Adds a regression test that:
1. Starts from a config where Id is already a primary key.
2. Runs an update that only changes the description for Id via
`fields.name` and `fields.description`.
3. Verifies that the description changes and the primary-key flag on Id
remains true.
## How was this tested?
- [ ] Integration Tests
- [x] Unit Tests
1. Existing CLI unit tests for entity update.
2. New regression test that validates `primary-key` is preserved when
only the field description is updated.
## Sample Request(s)
- To demonstrate the fixed behavior:
1. Initial state: Id is configured as a primary key on the entity.
2. Command: `dab update Incident --fields.name "Id" --fields.description
"Unique Key 2"`
3. Result after this change:
4. The description for Id becomes “Unique Key 2”.
5. The primary-key flag for Id stays true.
- To explicitly change primary keys (still supported):
1. Set Id as primary key:
` dab update Incident --fields.name "Id" --fields.primary-key true`
2. Clear Id as primary key:
`dab update Incident --fields.name "Id" --fields.primary-key false`fields.primary-key updation when using update entity command. (#3077)1 parent 9025bb3 commit 64f28dc
2 files changed
Lines changed: 91 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1100 | 1100 | | |
1101 | 1101 | | |
1102 | 1102 | | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
1103 | 1189 | | |
1104 | 1190 | | |
1105 | 1191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1747 | 1747 | | |
1748 | 1748 | | |
1749 | 1749 | | |
| 1750 | + | |
1750 | 1751 | | |
1751 | 1752 | | |
1752 | 1753 | | |
| |||
1757 | 1758 | | |
1758 | 1759 | | |
1759 | 1760 | | |
1760 | | - | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
1761 | 1765 | | |
1762 | 1766 | | |
1763 | 1767 | | |
| |||
0 commit comments