Commit 7d45299
authored
feat(cli): add --fail-if-modified to hub push (finos#2760)
* feat(cli): add --fail-if-modified to hub push
Introduces a shared, key-order-insensitive content comparison
(`canonicalEqual` in @finos/calm-shared) and uses it to add a strict,
non-bumping `--fail-if-modified` mode to `calm hub push` for
architecture, pattern and standard documents:
- brand-new mapping -> created at 1.0.0 (unchanged behaviour)
- exists + unchanged -> skipped (no new version, file left as-is)
- exists + modified -> push fails
Default behaviour (auto-bump) is unchanged. The comparison helper is
shared so it can be reused by other push paths without duplication.
Claude-Session: https://claude.ai/code/session_01QiHAHdi4d4mCoy4wku5s2v
* fix(cli): correct hub push --fail-if-modified comparison and extend to control docs
Addresses review feedback on the strict-push comparison:
- Normalise the local document the same way Hub stores it (rewriting the
$id to the latest version and applying default fields via
updateDocumentMetadata) before comparing, so a version-only difference
(e.g. another committer auto-bumped Hub) or an absent `description` no
longer reports a false "has changed".
- Guard against an empty/unreadable latest-version body: surface a clear
"could not read" error instead of silently reporting "has changed".
- Point users at --change-type in the modified-document error message.
- Extend --fail-if-modified to `control-requirement` and
`control-configuration` push (same normalise-and-compare model).
- Add Commander argv wiring tests so the flag plumbing is covered.
Claude-Session: https://claude.ai/code/session_01QiHAHdi4d4mCoy4wku5s2v8 files changed
Lines changed: 443 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
784 | 784 | | |
785 | 785 | | |
786 | 786 | | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
787 | 812 | | |
788 | 813 | | |
789 | 814 | | |
| |||
1087 | 1112 | | |
1088 | 1113 | | |
1089 | 1114 | | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
1090 | 1127 | | |
1091 | 1128 | | |
1092 | 1129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
466 | 469 | | |
467 | 470 | | |
468 | 471 | | |
| |||
476 | 479 | | |
477 | 480 | | |
478 | 481 | | |
| 482 | + | |
479 | 483 | | |
480 | 484 | | |
481 | 485 | | |
482 | 486 | | |
483 | 487 | | |
484 | 488 | | |
485 | 489 | | |
486 | | - | |
| 490 | + | |
| 491 | + | |
487 | 492 | | |
488 | 493 | | |
489 | 494 | | |
| |||
496 | 501 | | |
497 | 502 | | |
498 | 503 | | |
| 504 | + | |
499 | 505 | | |
500 | 506 | | |
501 | 507 | | |
| |||
504 | 510 | | |
505 | 511 | | |
506 | 512 | | |
| 513 | + | |
507 | 514 | | |
508 | 515 | | |
509 | 516 | | |
| |||
516 | 523 | | |
517 | 524 | | |
518 | 525 | | |
| 526 | + | |
519 | 527 | | |
520 | 528 | | |
521 | 529 | | |
| |||
524 | 532 | | |
525 | 533 | | |
526 | 534 | | |
| 535 | + | |
527 | 536 | | |
528 | 537 | | |
529 | 538 | | |
| |||
534 | 543 | | |
535 | 544 | | |
536 | 545 | | |
| 546 | + | |
537 | 547 | | |
538 | 548 | | |
539 | 549 | | |
540 | 550 | | |
541 | 551 | | |
542 | | - | |
| 552 | + | |
| 553 | + | |
543 | 554 | | |
544 | 555 | | |
545 | 556 | | |
| |||
550 | 561 | | |
551 | 562 | | |
552 | 563 | | |
| 564 | + | |
553 | 565 | | |
554 | 566 | | |
555 | 567 | | |
556 | 568 | | |
557 | 569 | | |
558 | | - | |
| 570 | + | |
| 571 | + | |
559 | 572 | | |
560 | 573 | | |
561 | 574 | | |
| |||
0 commit comments