Repository navigation
fix(hy-check): foreign packages url and sort call arity bypass and non-callable member rejection (Row 13 BUILDABLE) - #4201
Conversation
…url and sort packages
…ity and non-callable member checks
Automated review — gate FAIL predicted by probe (positive controls violate declared-not-used)Screened
That rule is pre-existing main discipline (buildable.rs:9328), so this test will fail with ~4×HYB-E1002 on the merge commit — the arm isn't even involved.
Fix (suite-only): add |
Automated review round 2 — gate FAIL (one unrepresentable case remains:
|
Landed — merge
|
| Gate | Result |
|---|---|
| Merge gate | conflict resolved via documented union-splice (assertions green) |
cargo test --workspace |
3218 passed / 0 failed (+6 = your suite's test count exactly); 490 suites = 490 Running lines (1:1) |
| corpus harness | 139/139, tripwire not fired (verdict-level 2/139, threshold ~25%) |
| differential loop | FULL AGREEMENT — accept 47/47 + reject 92/92 |
Protocol followed: merge --no-ff with hand-written credit commit (verification evidence + in-merge disclosure + CREDIT: @tmclaos), pushed, git ls-remote origin main == local HEAD asserted.
Bounty: per BOUNTY.md / discussion #295 rail — checker hardening on M5-curated foreign packages (url/sort arity + non-callable rejection), logged under this PR number.
CREDIT: @tmclaos
…ty) into fix-4218-hex-arity
Summary
Fixes a soundness and buildability bug under Row 13 of
GUARANTEES.md(BUILDABLE) where foreign package member invocations on curated packagesurl(net/url) andsortbypassed argument arity validation and accepted non-callable types as function call targets.Previously,
resolve.rsverified that members exist inforeign::is_curated_package_member, butbuildable.rsomitted call-site arity checks for both packages. As a result:url.url(),url.values(),url.userinfo(),sort.interface(),sort.int_slice()) were accepted with 0 diagnostics byhyb check, causing downstreamgo buildto fail withcannot call non-function.url.parse()with 0 args,url.user_password("user")with 1 arg,sort.ints()with 0 args) passedhyb checkwith 0 diagnostics, causing downstreamgo buildto fail withnot enough arguments in call to....Fix
In
compiler/crates/hy-check/src/buildable.rs:check_url_package_callto reject non-callable struct types (url,values,userinfo,error,escape_error,invalid_host_error) and validate arities forparse,parse_request_uri,query_escape,query_unescape,path_escape,path_unescape,user,user_password, andjoin_path.check_sort_package_callto reject non-callable interface and type definitions (interface,int_slice,float64_slice,string_slice) and enforce exact parameter counts forints,strings,float64s,slice,search, and related algorithms.Collector::check_exprwhen resolving foreign package calls.Verification & Tests
Added
compiler/crates/hy-check/tests/url_and_sort_package_call_arity_bypass.rscovering:url_non_callable_types_rejected_e1002(url.url(),url.values(),url.userinfo()->HYB-E1002)url_arity_mismatch_rejected_e1002(url.parse(),url.query_escape(),url.user_password("a"),url.join_path()->HYB-E1002)url_valid_calls_accepted(valid calls pass with 0 diagnostics)sort_non_callable_types_rejected_e1002(sort.interface(),sort.int_slice()->HYB-E1002)sort_arity_mismatch_rejected_e1002(sort.ints(),sort.strings(),sort.search()->HYB-E1002)sort_valid_calls_accepted(valid calls pass with 0 diagnostics)All tests pass cleanly.
Settlement
0xAF9192689F02C02A513983Def82113290360Bb6B(USDC on Base network)