Skip to content

hy-check(buildable): validate call arity and reject non-callable symbols on strings (fixes #4184) - #4264

Open
dextermos-dev wants to merge 3 commits into
limitlessprojects:mainfrom
dextermos-dev:fix-strings-call-arity-and-non-callable-symbols-4184
Open

dextermos-dev wants to merge 3 commits into
limitlessprojects:mainfrom
dextermos-dev:fix-strings-call-arity-and-non-callable-symbols-4184

Conversation

@dextermos-dev

Copy link
Copy Markdown
Contributor

Summary & Root Cause (Soundness / Row 13 BUILDABLE)

Fixes #4184.

Under GUARANTEES.md Row 13 (BUILDABLE), any program accepted by hy-check with verdict Accept must compile cleanly under standard Go's toolchain (go build).

Previously, invocations of curated strings package symbols bypassed member call arity verification, and package types (builder, reader, replacer) were accepted as function call targets, leading to downstream go build failures (cannot call non-function strings.<Type>, not enough arguments in call to strings.<Func>, too many arguments in call to strings.<Func>). Furthermore, existing PR #4185 is non-mergeable due to conflicts and omitted type rejection and contained arity discrepancies.

Technical Solution

  1. Package Member Validation (buildable.rs):

    • Dispatched pkg == "strings" && self.lookup_kind(pkg).is_none() to check_strings_package_call.
    • Rejects non-callable package types (builder, reader, replacer) fail-closed with HYB-E1002.
    • Enforces exact call arity aligned with standard Go 1.26.9 specification:
      • 1 argument: clone, fields, title, to_lower, to_title, to_upper, trim_space, new_reader.
      • 2 arguments: compare, contains, contains_any, contains_func, contains_rune, count, cut, cut_prefix, cut_suffix, equal_fold, fields_func, has_prefix, has_suffix, index, index_any, index_byte, index_func, index_rune, join, last_index, last_index_any, last_index_byte, last_index_func, map, repeat, split, split_after, to_lower_special, to_title_special, to_upper_special, to_valid_utf8, trim, trim_func, trim_left, trim_left_func, trim_prefix, trim_right, trim_right_func, trim_suffix.
      • 3 arguments: split_n, split_after_n, replace_all.
      • 4 arguments: replace.
  2. Complete Unit Test Coverage (tests/strings_call_buildable_soundness.rs):

    • 5 test functions covering all reject paths (types, arity mismatches across unary, binary, ternary, and 4-argument functions) and verifying clean acceptance with 0 diagnostics on valid function calls and symbol references.
    • Clean pass: 5 passed / 0 failed in 0.01s.
  3. Tree Integrity:

    • Clean tree directly rebased on Session 171 upstream main (56539008), zero example degradation, zero merge conflicts (Mergeable: True).

Settlement Wallet

Settlement Wallet: 0x8366bCe3a2D379De7656D7A67015789FaF999f20

@github-actions github-actions Bot added the bot:land-candidate Shepherd: fresh, gate-clean, verifiable (set from classify()) label Nov 9, 2026
@dextermos-dev
dextermos-dev force-pushed the fix-strings-call-arity-and-non-callable-symbols-4184 branch from b513c19 to 61d7460 Compare November 9, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:land-candidate Shepherd: fresh, gate-clean, verifiable (set from classify())

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hy-check(buildable): foreign package strings call arity bypass and non-callable member rejection (Row 13 BUILDABLE, HYB-E1002)

1 participant