Commit e068761
committed
fix(mcp): one normalization for the card and the fingerprint
Two more on #55, both mine, both the same root cause: I hardened one function and
left its sibling, then left a comment describing the property I had removed.
1. describeMcpLaunch still threw on a truthy non-array `args`.
launchFingerprint learned to tolerate it; the card kept doing
`(s.args || []).map(...)` and threw `TypeError: .map is not a function` — in the
helper that renders a SECURITY CONSENT CARD. A string `env` did not throw but
was arguably worse: it enumerated character indices, so the card asked the user
to trust `0=e 1=v 2=i 3=l`. Rendering nonsense on a consent prompt is worse than
rendering nothing.
My "never throws on a malformed entry" test only covered `args: null`, which is
why it passed while the real malformed shape crashed. Extended, and verified the
new cases reproduce the exact TypeError against the old code.
2. The comment above launchFingerprint contradicted the implementation.
It said a malformed args/env "must not fingerprint the same as an absent one".
The code collapses both to null, and the tests assert the collapse — I corrected
the test in the previous round and left the comment that motivated it. Now the
doc states the conservative semantics and why they are safe: normalizeServer
rejects those shapes long before the gate, so neither is reachable, and the
command itself always differentiates.
Fixed structurally rather than pointwise: both now read launchMaterial(), one
canonical normalization. This is the third divergence in this file between two
places implementing the same rule, and a shared helper is the only version that
cannot drift again. A test pins that the card reports the fingerprint that will
actually be stored.
61 mcpConfig cases; 23 suites, 0 failures.1 parent b6d5e1c commit e068761
2 files changed
Lines changed: 69 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
514 | 514 | | |
515 | 515 | | |
516 | 516 | | |
517 | | - | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
518 | 536 | | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
531 | 549 | | |
532 | 550 | | |
533 | 551 | | |
| |||
560 | 578 | | |
561 | 579 | | |
562 | 580 | | |
563 | | - | |
564 | | - | |
565 | | - | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
566 | 586 | | |
567 | 587 | | |
568 | 588 | | |
569 | | - | |
570 | | - | |
| 589 | + | |
| 590 | + | |
571 | 591 | | |
572 | 592 | | |
573 | 593 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
762 | 762 | | |
763 | 763 | | |
764 | 764 | | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
765 | 796 | | |
766 | 797 | | |
767 | 798 | | |
0 commit comments