Skip to content

Update OCaml stubs - #9568

Closed
mszabo-wikia wants to merge 1 commit into
meta:masterfrom
mszabo-wikia:update-ocaml-stubs
Closed

mszabo-wikia wants to merge 1 commit into
meta:masterfrom
mszabo-wikia:update-ocaml-stubs

Conversation

@mszabo-wikia

@mszabo-wikia mszabo-wikia commented Jan 7, 2025 •

Copy link
Copy Markdown
Contributor

The OSS OCaml stubs under src/stubs have become out of sync with the code referencing them.

Update the stubs to match.

Split from #9564.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. (Because this pull request was imported automatically, there will not be any future comments.)

Comment thread hphp/hack/src/stubs/dune
(rule
(target remote_old_decls_ffi.ml)
(action
(copy# ../facebook/remote_old_decls/stubs/remote_old_decls_ffi.ml remote_old_decls_ffi.ml)))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alternatively if upgrading to Dune 3.17.0+ is fine, there's a file-available macro.

@Wilfred

Wilfred commented Jan 9, 2025

Copy link
Copy Markdown
Contributor

Could you run ocamlformat and update the PR?

@mszabo-wikia

Copy link
Copy Markdown
Contributor Author

Done, also added ocamlformat as an OSS dep in #9573.

@Wilfred

Wilfred commented Jan 14, 2025

Copy link
Copy Markdown
Contributor

The sandcastle module looks wrong, I'm seeing a compile error:

Error: Library sandcastle is defined twice:
- hack/src/utils/facebook/dune:6
- hack/src/stubs/dune:171

@mszabo-wikia

Copy link
Copy Markdown
Contributor Author

Yeah, looks like the OSS stub will need to be included conditionally in non-fbsource builds only. I'll see what I can do, there are some preexisting examples for this.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@mszabo-wikia has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@mszabo-wikia has updated the pull request. You must reimport the pull request before landing.

@Wilfred

Wilfred commented Jan 24, 2025

Copy link
Copy Markdown
Contributor

FWIW this isn't passing our CI still:

Error: Library sandcastle is defined twice:
[...]
hphp/hack/facebook/redirect/dune_build/.dune/default/hack/src/stubs/sandcastle/dune:1
- hack/src/utils/facebook/dune:6

@mszabo-wikia

Copy link
Copy Markdown
Contributor Author

Yeah, the exclusion logic is definitely wrong. I'll look into this, thanks!

@mszabo-wikia

Copy link
Copy Markdown
Contributor Author

@Wilfred Sorry about the delay, finally had some time to take a look at this.

I think it will be necessary to rename the internal sandcastle library to sandcastle_fb as part of this patch. This is because src/stubs/sandcastle/dune now defines a shimmed sandcastle library that will either point to the internal library in fbsource builds or the stubbed version defined in src/stubs/dune in OSS builds, but this requires the internal version to have a different name from the shim, hence the suffix. This seems to be the pattern used for every stubbed internal OCaml library in the project.

Let me know if you have any questions!

@muglug muglug left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This worked for us, with three lines changed

Comment thread hphp/hack/src/stubs/state_loader_lwt.ml Outdated
~ignore_hh_version:_
~opts:_ =
let get_project_metadata ~repo:_ ~ignore_hh_version:_ ~opts:_ =
failwith "Not implemented"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs to return Lwt.return (Error ("Not implemented", Telemetry.create ())) for the IDE integration to work.

Otherwise the init_with_find call terminates execution.

Comment thread hphp/hack/src/stubs/state_loader_lwt.ml Outdated
~ignore_hh_version:_
~saved_state_type:_ =
let load ~ssopt:_ ~progress_callback:_ ~watchman_opts:_ ~ignore_hh_version:_ =
failwith "Not implemented"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs to return Lwt.return (Error "Not implemented") for the IDE integration to work

Comment thread hphp/hack/src/stubs/state_loader_lwt.ml Outdated
files_changed: Saved_state_loader.changed_files;
}

let load ~project_metadata:_ ~threshold:_ ~root:_ = failwith "Not implemented"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs to return Error "Not implemented" for IDE integration to work — otherwise the init_with_fetch call terminates execution.

@mszabo-wikia

Copy link
Copy Markdown
Contributor Author

This worked for us, with three lines changed

Thanks! Updated this branch now.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@mszabo-wikia has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@mszabo-wikia has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@mszabo-wikia has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@mszabo-wikia has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@mszabo-wikia has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@mszabo-wikia has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@mszabo-wikia has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@mszabo-wikia has updated the pull request. You must reimport the pull request before landing.

@meta-codesync

meta-codesync Bot commented Dec 10, 2025

Copy link
Copy Markdown
Contributor

@vassilmladenov has imported this pull request. If you are a Meta employee, you can view this in D67915401. (Because this pull request was imported automatically, there will not be any future comments.)

@meta-codesync

meta-codesync Bot commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

@vassilmladenov merged this pull request in 72a8742.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been reverted by 0ff6066.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants