Skip to content

enhancement: guard against drift between ffi/zvec_ffi.h and ffi/zvec_ffi_php.h (duplicated declarations) #204

Description

@s2x

Finding (from #192 follow-up)

ffi/zvec_ffi.h and ffi/zvec_ffi_php.h contain duplicated function declarations. The latter is the one loaded at runtime by FFI::cdef() (src/ZVec.php:76-87); the former documents/holds the same ABI. There is no check that they stay in sync.

Evidence

  • ffi/zvec_ffi.h:331-334 vs ffi/zvec_ffi_php.h:253-256 — identical zvec_collection_fetch declarations, maintained by hand (both had to be updated for fetch(): expose includeVector + mirror upstream nullable normalization #192).
  • Drift currently surfaces only as a runtime TypeError (arg count mismatch) or an ABI-level crash when a stale/short declaration shifts argument registers (e.g. an out-param read from the wrong register).

Suggested scope

  • A build-time or CI check that extracts function signatures from both headers and diffs them (script or unit test), or
  • generate ffi/zvec_ffi_php.h from ffi/zvec_ffi.h (single source of truth), or
  • at minimum: a comment in both headers warning they must be changed together.

Possibly related to closed #83 (SMELL-002) — checked, not a duplicate.

Found during #192 code review; verified by subagent review (CONFIRMED).

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions