Commit b624f83
committed
fix(comses): language heuristic + tighter read default
Two bugs caught by live end-to-end smoke test in Claude Code:
1. search_comses returned language=null for every result. Real COMSES
search responses don't include releaseLanguages on nested releases —
that field only lives on /releases/{v}/?format=json. Added a cheap
text-heuristic (scan title + description + tags for "netlogo",
"python", "mesa", etc.) as a fallback. Honest: returns None when no
hint is present; the authoritative language is on get_comses_model.
2. read_comses_files default max_total_bytes=200_000 blew past the MCP
harness's per-response token budget on a single 57KB .nlogo file
(JSON-escaped strings balloon ~25%). Dropped default to 50_000 with
a docstring note that larger pulls should pass the value explicitly.
2 new tests: direct unit test of _language_hint_from_text, and an
integration test proving search_comses still populates language when
releaseLanguages is absent (real-API shape).
87 tests pass, lint + mypy clean.1 parent 25a12b7 commit b624f83
2 files changed
Lines changed: 95 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
482 | 484 | | |
| 485 | + | |
| 486 | + | |
483 | 487 | | |
484 | 488 | | |
485 | 489 | | |
| |||
501 | 505 | | |
502 | 506 | | |
503 | 507 | | |
504 | | - | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
505 | 516 | | |
506 | 517 | | |
507 | | - | |
508 | 518 | | |
509 | 519 | | |
510 | 520 | | |
| |||
518 | 528 | | |
519 | 529 | | |
520 | 530 | | |
521 | | - | |
522 | 531 | | |
523 | 532 | | |
524 | 533 | | |
525 | 534 | | |
526 | 535 | | |
527 | 536 | | |
528 | 537 | | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
529 | 569 | | |
530 | 570 | | |
531 | 571 | | |
| |||
890 | 930 | | |
891 | 931 | | |
892 | 932 | | |
893 | | - | |
| 933 | + | |
894 | 934 | | |
895 | 935 | | |
896 | 936 | | |
| |||
912 | 952 | | |
913 | 953 | | |
914 | 954 | | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
919 | 960 | | |
920 | 961 | | |
921 | 962 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1004 | 1004 | | |
1005 | 1005 | | |
1006 | 1006 | | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
0 commit comments