Commit 17ff486
committed
When two Membership entities canonicalised to the same `personId__orgId`
the second one was silently dropped, so the duplicate that survived was
non-deterministic and the alternative `org:role` value (e.g. `Ph.D
Student` vs `PhD Student` for the same person at the same org) was lost
or — when both still leaked through — appeared twice in the JSON-LD
output. Reported by rmfranken in #30 / #34.
Replace the "first wins, drop the rest" sweep with a per-canonical-id
buffer that fuses the group:
- `org:role`: drop nulls, then if all surviving roles normalise to the
same value (lowercase + strip dots + collapse whitespace) keep the
longest variant (`Ph.D Student` survives over `PhD Student`); if the
surviving roles disagree after normalisation, pick the one attached
to the entry with the most-recent `time:hasEnd` (fallback
`time:hasBeginning`) per the task list in #34.
- `time:hasBeginning`: earliest non-null value across the group.
- `time:hasEnd`: latest non-null value across the group.
- All other fields fall back to the first entry, which preserves the
agent's identifier/uuid choices.
A warning is emitted whenever a group of >1 collapses so the merge is
visible in the run audit trail.
Inline tests cover the issue's exact example (Ph.D vs PhD with identical
dates → single output with `Ph.D Student`), career progression
(`PhD Student 2013-2018` + `Postdoc 2018-2020` → `Postdoc 2013-2020`),
and the single-membership passthrough.
Existing reconciliation/membership test suite stays green (71/71).
1 parent 3c7465f commit 17ff486
1 file changed
Lines changed: 82 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1296 | 1296 | | |
1297 | 1297 | | |
1298 | 1298 | | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
1299 | 1345 | | |
1300 | 1346 | | |
1301 | 1347 | | |
1302 | 1348 | | |
1303 | 1349 | | |
1304 | 1350 | | |
1305 | | - | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
1306 | 1355 | | |
1307 | 1356 | | |
1308 | | - | |
1309 | 1357 | | |
1310 | 1358 | | |
1311 | 1359 | | |
| |||
1333 | 1381 | | |
1334 | 1382 | | |
1335 | 1383 | | |
1336 | | - | |
1337 | | - | |
1338 | | - | |
1339 | 1384 | | |
1340 | 1385 | | |
1341 | 1386 | | |
| |||
1363 | 1408 | | |
1364 | 1409 | | |
1365 | 1410 | | |
1366 | | - | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
1367 | 1443 | | |
1368 | 1444 | | |
1369 | 1445 | | |
| |||
0 commit comments