Skip to content

docs: AGENTS.md claims inline FFI::cdef declarations but the code loads ffi/zvec_ffi_php.h at runtime #203

Description

@s2x

Finding (from #192 follow-up)

AGENTS.md (FFI-Specific Rules) states: Inline C declarations in FFI::cdef() — do not load the .h file at runtime. — but the code does exactly the opposite.

Evidence

  • src/ZVec.php:76-87FFI::cdef(trim($headerContent), $libPath) where $headerContent comes from file_get_contents of ffi/zvec_ffi_php.h (pre-existing on main, verified).
  • ffi/zvec_ffi_php.h is the runtime-loaded header — any FFI signature change must update it in sync with ffi/zvec_ffi.h (see related sync-check gap).

Impact

Contributors following AGENTS.md may edit only ffi/zvec_ffi.h and miss the runtime-loaded header, producing a runtime TypeError (or ABI crash) instead of a build failure.

Suggested fix

Update the AGENTS.md FFI-Specific Rules section to document the actual mechanism (runtime cdef from ffi/zvec_ffi_php.h) and call out that both ffi/zvec_ffi.h and ffi/zvec_ffi_php.h must be kept in sync with ffi/zvec_ffi.cc.

Found during #192 implementation; verified by subagent review (CONFIRMED; no duplicate among all 105 issues).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions