Skip to content

refactor: De-duplicate produces_output onto the canonical capture_shape helper#507

Merged
zharinov merged 1 commit into
masterfrom
refactor/dedup-produces-output
Jun 21, 2026
Merged

refactor: De-duplicate produces_output onto the canonical capture_shape helper#507
zharinov merged 1 commit into
masterfrom
refactor/dedup-produces-output

Conversation

@zharinov

Copy link
Copy Markdown
Member

Summary

  • produces_output had two copies of the same logic: a shared public one in capture_shape.rs and a private one inside the type-inference pass.
  • Delete the private copy and make inference call the shared one.

Why

produces_output decides whether a capture adds real data to the output. It controls two things that must match: the TypeScript types we generate and the JSON the VM emits. If they disagree, the output is type-unsound (#420). capture_shape.rs is meant to be the single place this logic lives, so the inference pass shouldn't keep its own copy that can drift.

Notes

Both copies were already identical, so this is a pure refactor with no behavior change.

…pe helper

## Summary
- Delete the private `produces_output` copy in the type-inference pass (`infer.rs`)
  and call the canonical `capture_shape::produces_output` instead.
- Repoint both inference call sites to pass the `TypeContext` explicitly, since the
  free function takes it as an argument rather than reading it from `self`.

## Why
`produces_output` decides whether a capture contributes real data to the output, so
it drives both the generated TypeScript types and the JSON the VM emits — the two
must agree or the output is type-unsound (#420). `capture_shape.rs` is the single
source of truth for exactly this; the inference pass carried a logically identical
private duplicate that could silently drift. Behavior is unchanged.
@zharinov
zharinov enabled auto-merge (squash) June 21, 2026 18:45
@zharinov
zharinov merged commit ef3f5d3 into master Jun 21, 2026
4 checks passed
@zharinov
zharinov deleted the refactor/dedup-produces-output branch June 21, 2026 18:46
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.

1 participant