Repository navigation
Conversation
…lable symbol validation (fixes #4203) Under GUARANTEES.md Row 13 (BUILDABLE), known io package member calls now get the same buildability treatment landed for fmt (#4087/#4093): a dedicated check_io_call_buildable dispatch guarded by pkg == "io" && lookup_kind(pkg).is_none() (user-shadow safe), rejecting - 19 non-callable package symbols (io.EOF/Err*/Discard vars; Reader/Writer/ Closer/Seeker/ReadCloser/WriteCloser/ReadWriter/PipeReader/PipeWriter/ SectionReader/LimitedReader/OffsetWriter types) invoked as functions, - wrong arity on pipe(0), read_all(1), copy(2), read_full(2), write_string(2), limit_reader(2), tee_reader(2), copy_n(3), copy_buffer(3), read_at_least(3), new_section_reader(3), and >=1 on multi_reader/multi_writer, all fail-closed as HYB-E1002 with fixit text; unknown symbols fail open as before. New suite io_call_buildable_soundness.rs (323 lines). Verification evidence: - Four-gate battery on the merge commit: cargo test --workspace ALL-GREEN (suite count 1:1 vs files on disk), corpus harness 137/137 verdict agreement (tripwire 1.5%/2.2% unchanged), differential FULL 46/46 + 91/91 AGREEMENT. - Note: PR #4162 (Sora1916) is an independent io-arity implementation with a different patch-id; landed first-come-first-served by battery order, this merge lands first. Coverage comparison and hall-of-fame disposition for #4162 posted on that PR per protocol. CREDIT: @dextermos-dev
Hall of fame — independent io-arity implementation, #4203 landed via sibling PR #4204 firstYour Per protocol (first-come-first-served by landing order, precedent #4085/#4081-#4084):
Bounty rail per |
…bols, nop_closer and spread check (limitlessprojects#4149)
ec3452d to
2fc0071
Compare
|
Thank you so much for the thoughtful, transparent review and the gracious hall-of-fame recognition! It has been a genuine pleasure contributing to Go-Hybrid, and I truly appreciate the care and rigorous testing standards the team maintains for every cycle. Per the protocol and precedent #4084, I have rebased this PR directly on top of Supplement Details (on top of landed #4204)
Verification
Thank you again for the guidance, and please let me know if any further adjustments are needed! |
Root Cause
Under GUARANTEES.md Row 13 (BUILDABLE), any program accepted by
hyb checkmust emit Go code that successfully compiles undergo build.In
compiler/crates/hy-check/src/foreign.rs, curated members of packageioregister core I/O stream primitives (copy,read_all,pipe,limit_reader,new_section_reader, etc.) as well as non-callable error variables, constants, and interface/struct types (eof,err_closed_pipe,discard,seek_start,reader,writer, etc.).However, in
compiler/crates/hy-check/src/buildable.rs,iopackage calls were not validated during call operand checking (check_call_operands):io.eof(),io.discard(),io.reader(),io.seek_start(), etc.) were accepted as function call targets without diagnostics (Verdict::Accept), causing downstreamgo buildto fail withcannot call non-function io.*.io.read_all(),io.copy(w),io.pipe("extra"), etc.) passedhyb checkand failed during Go compilation withnot enough arguments in call to io.*ortoo many arguments in call to io.*....was accepted on non-variadiciofunctions (io.copy(args...)), which Go rejects withcannot use ... in call to non-variadic io.*.Fix Details
check_io_package_callincompiler/crates/hy-check/src/buildable.rs:HYB-E1002.piperead_all,nop_closercopy,limit_reader,read_full,tee_reader,write_stringcopy_buffer,copy_n,read_at_least,new_section_reader(io.NewSectionReader(r, off, n))multi_reader,multi_writer(0 or more arguments)...on all non-variadiciofunctions withHYB-E1002.check_io_package_callintoExpr::Fieldhandling incheck_call_operands.Verification & Reproduction Tests
compiler/crates/hy-check/tests/io_package_call_arity_bypass.rs:test_io_package_call_too_few_arguments_rejected: under-arity calls across all curated functions.test_io_package_call_too_many_arguments_rejected: over-arity calls across all curated functions.test_io_non_callable_members_rejected: verifies all 37 non-callable error variables, variables, constants, and types fail closed withHYB-E1002.test_io_variadic_spread_on_non_variadic_rejected: verifies spread rejection on non-variadic functions.test_io_positive_controls_accepted: validates sound invocations with exact arities.cargo test -p hy-check --test io_package_call_arity_bypass.foreign_io_method_surfaces, fullhy-checkunit test suite) pass with 100% success (183/183 tests ok).Fixes #4149