Skip to content

Wire up six unregistered functions#23

Merged
pigri merged 2 commits into
masterfrom
wire-missing-functions
Jun 9, 2026
Merged

Wire up six unregistered functions#23
pigri merged 2 commits into
masterfrom
wire-missing-functions

Conversation

@pigri

@pigri pigri commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Six functions were implemented in the fork but not actually usable. Five had complete implementations (with tests) sitting in engine/src/functions/ that were never declared in mod.rs — so they were never compiled, exported, or registered. ends_with was exported from the engine but had no FFI dispatch arm.

This wires all of them in.

Function Gap before FFI name
upper orphaned file upper
to_string orphaned file to_string
remove_query_args orphaned file remove_query_args
json_lookup_string orphaned file lookup_json_string
json_lookup_integer orphaned file lookup_json_integer
ends_with exported, not FFI-registered ends_with

The JSON lookups register under Cloudflare's canonical names (lookup_json_string / lookup_json_integer), matching their own test names; the modules were just named in reverse.

Changes

  • Declare + export the five modules in functions/mod.rs and engine/src/lib.rs.
  • Register all six in the FFI add_function dispatch (ffi/src/lib.rs).
  • Promote serde_json from a dev-dependency to a regular dependency of the engine — the JSON lookup implementations use it at runtime (non-test code), so the crate failed to build outside cargo test until this change.
  • Drop two now-unused test-only imports surfaced once these files started compiling.

Test plan

  • RUSTFLAGS=-D warnings cargo build --all-targets clean
  • cargo clippy --all-targets -- -D clippy::all clean
  • cargo +nightly fmt --check clean
  • cargo test — all pass (engine lib 210 → 238, the +28 being the newly compiled functions' tests)

pigri added 2 commits June 9, 2026 12:08
Five complete function implementations existed on disk but were never
declared in functions/mod.rs, so they were uncompiled, unexported, and
unregistered: upper, to_string, remove_query_args, json_lookup_string,
json_lookup_integer. ends_with was exported from the engine but had no
FFI dispatch arm.

- Declare + export the five modules in functions/mod.rs and engine lib.rs
- Register all six in the FFI add_function dispatch (JSON lookups use the
  Cloudflare names lookup_json_string / lookup_json_integer)
- Promote serde_json from dev-dependency to a regular dependency, since
  the JSON lookup implementations use it at runtime
- Drop now-unused test-only imports surfaced by compiling these files
@pigri pigri merged commit 8ad9c71 into master Jun 9, 2026
8 checks passed
@pigri pigri deleted the wire-missing-functions branch June 9, 2026 11:13
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