Skip to content

feat: Echo + Epistemic effect inference (ADR-0009 D1+D2, slices 1+2)#41

Merged
hyperpolymath merged 2 commits into
mainfrom
claude/dazzling-albattani-ubS9r
Jun 18, 2026
Merged

feat: Echo + Epistemic effect inference (ADR-0009 D1+D2, slices 1+2)#41
hyperpolymath merged 2 commits into
mainfrom
claude/dazzling-albattani-ubS9r

Conversation

@hyperpolymath

@hyperpolymath hyperpolymath commented Jun 18, 2026

Copy link
Copy Markdown
Owner

(b) effect inference — slices 1+2 (additive, non-breaking). Implements the inference half of ADR-0009 — both graded function effects.

Echo effect (D1) — echo::function_echo(body) -> Echo

The Echo grade a function body induces, as the join of its statements' echoes: addition-only assignment → Safe; reverse/reversible blocks → their block echo (classify_stmts); control flow → join of sub-bodies. Reuses the existing idempotent Echo::join; the block-level classify_stmts becomes the body-aggregate special case. Telling test: reverse { x += x } in a body → the function is Neutral.

Epistemic effect (D2) — epistemic::function_epistemic(func) -> Epistemic

The dual axis (what a function reveals about its inputs), lattice Opaque ⊑ Partial ⊑ Transparent, join = worst-case revelation. v1 inference (conservative): grade by the worst-case revelation across the function's output expressions (return/print) — an output that is a parameter → Transparent, one referencing a parameter → Partial, one independent → Opaque; no outputs → Opaque. Refine on use, per ADR-0009.

Scope

Inference only — neither grade is yet stored in FunctionDecl/TypeAnnotation::Function or joined across FunctionCalls. That call-resolution + type-wiring is the next (more invasive) slice. Kept additive so it can't destabilise the build.

10 tests (4 echo + 6 epistemic); clippy -D warnings clean; #[forbid(unsafe_code)]. No unwrap_or (avoids Hypatia's dangerous-default rule).

Next: wire the (echo, epi) row into function types + call resolution; then mechanise in JtvEcho.lean; then number-systems.

https://claude.ai/code/session_01BJmfoz1ZS1Pejy9LLMY742

…lice 1)

The inference half of Echo-as-a-first-class-function-effect: function_echo
computes the Echo grade a function body induces, as the join of its statements'
echoes. Addition-only data assignments are Safe; reverse/reversible blocks
contribute their block echo (classify_stmts); control flow joins its sub-bodies.
Lifts the block-level classify_stmts to a whole function body.

Additive and non-breaking: it does not yet store the grade in the type or resolve
FunctionCall grades (a later slice with a function-echo environment). 4 tests;
clippy -D warnings clean.

https://claude.ai/code/session_01BJmfoz1ZS1Pejy9LLMY742
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 51 issues detected

Severity Count
🔴 Critical 0
🟠 High 25
🟡 Medium 26
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

…-0009 D2)

The second graded function effect from ADR-0009: the Epistemic axis (what a
function reveals about its inputs). Epistemic lattice Opaque <= Partial <=
Transparent, join = worst-case revelation, mirroring Echo. Inference (v1,
conservative): grade a function by the worst-case revelation across its OUTPUT
expressions (return/print) -- an output that IS a parameter is Transparent, one
referencing a parameter is Partial, one independent is Opaque; no outputs =>
Opaque. Refine on use, per ADR-0009.

Additive new module; 6 tests; clippy -D warnings clean.

https://claude.ai/code/session_01BJmfoz1ZS1Pejy9LLMY742
@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 51 issues detected

Severity Count
🔴 Critical 0
🟠 High 25
🟡 Medium 26
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 hyperpolymath changed the title feat(echo): function_echo — Echo as a function effect (ADR-0009 slice 1) feat: Echo + Epistemic effect inference (ADR-0009 D1+D2, slices 1+2) Jun 18, 2026
@hyperpolymath
hyperpolymath marked this pull request as ready for review June 18, 2026 01:54
@hyperpolymath
hyperpolymath merged commit a8f5483 into main Jun 18, 2026
30 checks passed
@hyperpolymath
hyperpolymath deleted the claude/dazzling-albattani-ubS9r branch June 18, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants