Repository navigation
feat: FFI Python/native audit, #728 rows, and break-even (#737) - #1352
Merged
Merged
Conversation
Add the remaining #737 slice on top of the stable buffer ABI: an executable C/Python/native crossing catalog, harness rows for scalar, batched, and zero-copy crossings, and live break-even measurements. Co-authored-by: Abhishek Shivakumar <[email protected]>
boundary_audit.flow must list before buffer_handoff.flow so the package snapshot walker matches the recorded expect files. Co-authored-by: Abhishek Shivakumar <[email protected]>
This was referenced Oct 6, 2026
Closed
godofecht
added a commit
that referenced
this pull request
Oct 7, 2026
main gained runtime/ffi_scalar, ffi_batch and ffi_buffer (#1352) after this branch was cut, so --check-runtime-natives failed on the rebase. Each twin makes the same noinline call from C, so flow_vs_native is the cost of the Flow side of the crossing. Also rewords four sentences in runtime-primitive-attribution.md that the prose lint rejects.
godofecht
added a commit
that referenced
this pull request
Oct 7, 2026
main gained runtime/ffi_scalar, ffi_batch and ffi_buffer (#1352) after this branch was cut, so --check-runtime-natives failed on the rebase. Each twin makes the same noinline call from C, so flow_vs_native is the cost of the Flow side of the crossing. Also rewords four sentences in runtime-primitive-attribution.md that the prose lint rejects.
This was referenced Oct 7, 2026
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 #737
Intent
Linked issue or roadmap item: #737 (remaining slice after merged #1347).
Implement the leftover acceptance work: a Python/native-library boundary audit, #728 harness rows for FFI crossings, and break-even measurements on real C crossings. The stable zero-copy buffer ABI from #1347 is unchanged.
Overlap check
Overlap / dependency notes:
#1347 already landed the C
FlowFfiBufferABI. Open PRs (#1348, #1346, #1345, #1332–#1325, #1268, #1267, #1265) are RT-safe/codegen/cache/affine/startup work and do not implement this audit.Evidence
Baseline before this change:
On
a1b62114,docs/language/ffi-buffer.mdmarked the Python/native audit and #728 suite out of scope.bench_harnesshad no FFI workload directories. Break-even guidance was a guessed “fewer than 1000 elements” comment.Targeted proof that exercises the changed behaviour:
Why that proof would detect the old failure or regression:
The catalog test fails if a compatible C/Python/native handoff is classified as an O(n) copy, or if pywheel silently accepts a buffer. The break-even program fails if
try_borrowcopies the pointer or the explicit copy path does not move payload bytes. The scripts test fails if the audit page is missing fromdocs/nav.jsonor a #728 row is absent.Repository gate(s) run:
./flow test-lang tests/lang/test_ffi_boundary_audit.flow— pass./flow test-lang tests/lang/test_ffi_buffer.flow— pass./flow runof the five new harness rows — pass./flow tool tests/scripts/ffi_boundary.flow— pass./flow tool wiki_nav— pass./flow tool python_ratchet— pass./flow tool scripts/check_pkg_parity.flow— ffi cases pass after golden refresh; remaininginstall-git-bad-tagis an unrelated git warning on this hostGenerated/bootstrap state, if any:
None.
compiler/srcwas not edited.Risk
Compatibility, performance, security, lifetime, backend, or release implications:
Additive
ffipackage exports (ffi_crossing_class, PEP 3118 mapping,ffi_breakeven_batch). No compiler or bootstrap C change. No new Python files.docs/project/Questions.mdupdated if this needs a language-design decision.Compatibility
docs/project/CHANGELOG.md.flow pythonstill refuses pointer/span/array; that is documented, not changed. Zero-copy Python arrays continue to use the C ABI through ctypes / PEP 3118.Agent handoff
Cursor cloud agent.
flow pythonbuffer-protocol export remains future work (documented in the audit); it is not required for the #737 acceptance criteria.