Skip to content

docs: add agent skill for datafusion-ffi crate patterns#22327

Open
timsaucer wants to merge 5 commits into
apache:mainfrom
timsaucer:feat/ffi-skill
Open

docs: add agent skill for datafusion-ffi crate patterns#22327
timsaucer wants to merge 5 commits into
apache:mainfrom
timsaucer:feat/ffi-skill

Conversation

@timsaucer
Copy link
Copy Markdown
Member

@timsaucer timsaucer commented May 18, 2026

Which issue does this PR close?

None.

Rationale for this change

When writing FFI code, there are a variety of established patterns that it is important to follow. This includes, but is not limited to, things like ensuring we do not make FFI struct changes on patch releases and ensuring we are following best practices for checking round trip trait implementations. The goal of this PR is to add an agent skill to aid both developers and code reviewers to find issues before they make it into the code base.

What changes are included in this PR?

  • Add an agent skill.
  • Update the AGENTS.md file to explain where to find this skill.

Are these changes tested?

Yes, I have run the skill and it has already identified gaps in the current implementation. Issues are opened for current gaps and linked back to this PR for originating them.

Are there any user-facing changes?

None

Introduces `.ai/skills/` as the repository-wide location for
tool-agnostic agent skills and lands a first skill, `datafusion-ffi`,
that captures the crate's required wrapper patterns and flags known
gaps where trait default methods are not forwarded across the FFI
boundary.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@timsaucer timsaucer added documentation Improvements or additions to documentation development-process Related to development process of DataFusion labels May 18, 2026
@github-actions github-actions Bot removed documentation Improvements or additions to documentation development-process Related to development process of DataFusion labels May 18, 2026
timsaucer and others added 3 commits May 18, 2026 08:34
`Arc<dyn Trait>` erases override-vs-default information, so the
producer side cannot use `Option<fn>` to signal "trait default is in
effect". Always populate the fn pointer; dynamic dispatch already
picks override-or-default. Reserve `Option<fn>` for slots gated by an
explicit constructor argument like `FFI_TableProvider::new`'s
`can_support_pushdown_filters`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`FFI_TableProvider::supports_filters_pushdown` is the only `Option<fn>`
slot in `datafusion/ffi/src/`. Earlier wording made it sound like a
general template; correct the skill so contributors do not introduce
new optional fn pointers without an explicit capability flag and a
real reason to skip the FFI hop.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Splits the testing guidance into two clearly-named tracks: in-process
unit tests in `src/<mod>.rs` (use `mock_foreign_marker_id` to force
the foreign branch, run on every `cargo test`) and cross-library
integration tests in `tests/ffi_*.rs` gated by the
`integration-tests` feature (libloading-load the crate's own cdylib
to exercise the real FFI symbol path). Adds a "which tests does my
change need" table that makes integration tests mandatory for any
`#[repr(C)]` layout change, since that is exactly the bug class
in-process tests cannot catch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the inline gap snapshot with links to issues apache#22328-apache#22337,
one per wrapper with a current coverage gap. Removes the "already
complete" list, which would have silently masked regressions whenever
an upstream trait gained a new defaulted method.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@timsaucer timsaucer marked this pull request as ready for review May 18, 2026 15:47
@timsaucer timsaucer added documentation Improvements or additions to documentation development-process Related to development process of DataFusion ffi Changes to the ffi crate labels May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

development-process Related to development process of DataFusion documentation Improvements or additions to documentation ffi Changes to the ffi crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants