Open namespace for preprocessor commands automatically?

I am looking at the following project. It seems like it would be cool to port it to OCaml 5, and the authors have had difficulties with the transition, apparently because of the tight integration with internals of the toplevel.

When I try to build the following project, I get an error in the file src/core/shell.ml saying that in the following code,

type exec_request =
  {
    exec_code : string [@key "code"];
    exec_silent : bool [@key "silent"];
    exec_store_history : bool [@key "store_history"];
    exec_user_expr : Json.t [@key "user_expressions"];
    exec_allow_stdin : bool [@key "allow_stdin"] [@default true];
    exec_stop_on_error : bool [@key "stop_on_error"] [@default false];
  } [@@deriving yojson]
[@@yojson.allow_extra_fields]

there are unbound values string_of_yojson, bool_of_yojson, etc.

Clearly the macro system is resolving these annotations into calls from these functions in the ppx_yojson_conv_lib library, which cannot be found.

If I add open Ppx_yojson_conv_lib.Yojson_conv at the top of the file, the problem is fixed.

To me, this makes sense. We cannot access names that are not in scope.

My question is, how did the original author get this to compile in the first place without opening these namespaces? Is there something in the deriving libraries, or a configuration setting in dune etc., that would allow you to automatically open certain namespaces globally throughout a project?

I understand you’re asking how did that file compile before this change, right? I did some “spelunking”.

If we check the commit for the “git blame” prior to that change, we see it was using ppx_yojson_conv 0.14.0. And if we check the README for ppx_yojson_conv 0.14.0 we find the answer:

Note that Yojson-converters for primitive types are brought into scope automatically. The ppx rewriter adds the following prefix at the top of implementations open! Ppx_yojson_conv_lib.Yojson_conv.Primitives

This behaviour was changed for ppx_yojson_conv 0.16.0, now it must be opened manually.

Thank you very much, that clears things up a lot. I did not know the ppx extension could do that.
Also, I apologize for posting the wrong link and imposing the unnecessary work of figuring out what I meant there, I see now that I was on an older branch which had not yet incorporated these changes.