feat(typechecker): carrier-aware Echo gate — float locals soundly reject (ADR-0010)#46
Merged
Merged
Conversation
…ect (ADR-0010) Closes the float-locals soundness gap flagged in ADR-0010: the Safe-only reverse gate now consults the carrier of the target variable, including float LOCALS. The Echo admissibility check runs at the reverse-block site inside check_control_stmt, where self.env already holds the INFERRED types of params and prior local assignments (locals carry no annotation, but `x = 2.5` records x : Float in the env). So check_echo_admissible / check_echo_admissible_with_residue now build a CarrierEnv from self.env (numeric Type -> BasicType; non-numeric and not-yet-inferred Any omitted -> default Int = Safe) and classify via echo::classify_stmts_in_env. Effect: * `reverse { x += v }` over a float local (or param) is correctly REJECTED under Safe-only -- float reverse-add is lossy (Neutral), was wrongly Safe-admitted before. * `reversible { x += v } -> tok` over a float still ADMITTED -- the token retains the rounding residue (Neutral admissible with residue). * int/rational/complex/symbolic/hex/binary unchanged (Safe). Contained change: no reordering, no new inference pass -- the inferred type env is already populated at the gate. 4 typechecker tests (float carrier rejected; inferred-float-local rejected end-to-end; int contrast ok; float reversible-tok admitted). Whole-suite check: nothing relied on float reverse{} being accepted, so the stricter rule breaks no existing test/example. ADR-0010 + STATE.a2ml updated: slice landed; remaining minor corner noted (carrier-awareness inside reversible-if branches). cargo fmt + clippy clean; 127 lib tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BJmfoz1ZS1Pejy9LLMY742
🔍 Hypatia Security ScanFindings: 51 issues detected
View findings[
{
"reason": "No test directory or test files found",
"type": "no_tests",
"file": "/home/runner/work/julia-the-viper/julia-the-viper",
"action": "flag",
"rule_module": "honest_completion",
"severity": "high",
"deduction": 20
},
{
"reason": "Issue in secret-scanner.yml",
"type": "missing_workflow",
"file": "secret-scanner.yml",
"action": "create",
"rule_module": "workflow_audit",
"severity": "high"
},
{
"reason": "Issue in scorecard.yml",
"type": "scorecard_wrapper_missing_job_permissions",
"file": "scorecard.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "high"
},
{
"reason": "unwrap() without prior check -- DoS via panic (10 occurrences, CWE-754)",
"type": "unwrap_without_check",
"file": "/home/runner/work/julia-the-viper/julia-the-viper/crates/jtv-core/benches/interpreter_bench.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "high"
},
{
"reason": "unwrap() without prior check -- DoS via panic (6 occurrences, CWE-754)",
"type": "unwrap_without_check",
"file": "/home/runner/work/julia-the-viper/julia-the-viper/crates/jtv-core/benches/parser_bench.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "high"
},
{
"reason": "Js.Array2 deprecated -- use Array (3 occurrences)",
"type": "deprecated_api",
"file": "/home/runner/work/julia-the-viper/julia-the-viper/vscode-extension/src/Extension.res",
"action": "search_replace",
"rule_module": "migration_rules",
"severity": "high"
},
{
"reason": "Js.Promise deprecated -- use Promise (2 occurrences)",
"type": "deprecated_api",
"file": "/home/runner/work/julia-the-viper/julia-the-viper/vscode-extension/src/Extension.res",
"action": "module_replace",
"rule_module": "migration_rules",
"severity": "medium"
},
{
"reason": "Belt.Array deprecated -- use Array (30 occurrences)",
"type": "deprecated_api",
"file": "/home/runner/work/julia-the-viper/julia-the-viper/packages/jtv-analyzer/src/Main.res",
"action": "module_replace",
"rule_module": "migration_rules",
"severity": "high"
},
{
"reason": "Belt.Option deprecated -- use Option (2 occurrences)",
"type": "deprecated_api",
"file": "/home/runner/work/julia-the-viper/julia-the-viper/packages/jtv-analyzer/src/Main.res",
"action": "module_replace",
"rule_module": "migration_rules",
"severity": "medium"
},
{
"reason": "Js.Array2 deprecated -- use Array (7 occurrences)",
"type": "deprecated_api",
"file": "/home/runner/work/julia-the-viper/julia-the-viper/packages/jtv-analyzer/src/Main.res",
"action": "search_replace",
"rule_module": "migration_rules",
"severity": "high"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
hyperpolymath
marked this pull request as ready for review
June 18, 2026 07:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the float-locals soundness gap that ADR-0010 explicitly flagged as required-next. The Safe-only
reverse {}gate now consults the carrier of the target variable — including float locals, not just annotated params.cargo fmt/clippyclean; 127 lib tests + all integration suites pass.The fix (contained — no surgery)
Echo admissibility is checked at the reverse-block site inside
check_control_stmt, and at that pointself.envalready holds the inferred types of params and prior local assignments. Locals carry no annotation, butx = 2.5recordsx : Floatin the env. Socheck_echo_admissible/check_echo_admissible_with_residuenow build aCarrierEnvfromself.env(numericType → BasicType; non-numeric and not-yet-inferredAnyomitted → defaultInt/Safe) and classify viaecho::classify_stmts_in_env.No reordering, no new inference pass — the env is already populated at the gate.
Effect
reverse { x += v }(Safe-only)reversible { x += v } -> tokSo float reversal is correctly routed to the token policy rather than wrongly Safe-admitted.
Tests & safety
x = 2.5thenreverse { x += 1.0 }); int contrast ok; floatreversible … -> tokadmitted.reverse {}being accepted, so the stricter (correct) rule breaks nothing.Docs
ADR-0010 §Status/§Consequences/§Open updated (slice landed; the one remaining minor corner — carrier-awareness for plain assignments nested inside reversible-
ifbranches — is noted). STATE.a2ml records the landing.🤖 Generated with Claude Code
https://claude.ai/code/session_01BJmfoz1ZS1Pejy9LLMY742
Generated by Claude Code