Repository: OpenAssetIO/OpenAssetIO (language: python)

Issue:
Conform public/protected methods in `Manager` and `Host`
## What/Why

[This](https://github.com/TheFoundryVisionmongers/OpenAssetIO/pull/23#discussion_r718576482) comment raised a good point. Some methods that we see as being "only used internally by the API middleware" are just marked `@protected` in Doxygen. Others are explicitly protected via [single underscore](https://github.com/OpenAssetIO/OpenAssetIO/blob/5a5fa8b2dbdd81c1e4ab82c23f4ca03d1be06067/src/openassetio-core/include/openassetio/hostApi/Manager.hpp#L1834).

We should be consistent about this, and use single underscore for any api-internal methods to avoid confusion.

## Acceptance Criteria

- The public API does not leak any methods/classes that are for middleware use only. Anything public can be used at will by host/manager integrators.
- Internal methods are excluded from the public documentation build.
Conform public/protected methods in `Manager` and `Host`
## What/Why

[This](https://github.com/TheFoundryVisionmongers/OpenAssetIO/pull/23#discussion_r718576482) comment raised a good point. Some methods that we see as being "only used internally by the API middleware" are just marked `@protected` in Doxygen. Others are explicitly protected via [single underscore](https://github.com/OpenAssetIO/OpenAssetIO/blob/5a5fa8b2dbdd81c1e4ab82c23f4ca03d1be06067/src/openassetio-core/include/openassetio/hostApi/Manager.hpp#L1834).

We should be consistent about this, and use single underscore for any api-internal methods to avoid confusion.

## Acceptance Criteria

- The public API does not leak any methods/classes that are for middleware use only. Anything public can be used at will by host/manager integrators.
- Internal methods are excluded from the public documentation build.


Discussion / hints:
Looks like the only one in use here now is `Manager._interface` which is only used by a test case to check a `Manager` instance holds exactly the right interface instance.

The use of `@protected` in `Manager.hpp` seems erroneous.


Looks like the only one in use here now is `Manager._interface` which is only used by a test case to check a `Manager` instance holds exactly the right interface instance.

The use of `@protected` in `Manager.hpp` seems erroneous.



Fix patch:
diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml
index 669452f22..d774ebd1d 100644
--- a/.github/workflows/code-quality.yml
+++ b/.github/workflows/code-quality.yml
@@ -57,7 +57,7 @@ jobs:
           python -m pip install -r resources/build/linter-requirements.txt
 
       - name: Check Python formatting
-        run: black --config src/openassetio-python/pyproject.toml --check .
+        run: black --config src/openassetio-python/pyproject.toml --check --diff .
 
   # Note: in order to keep an `actions/cache` cache up to date, we must
   # use the approach detailed in
diff --git a/src/openassetio-core/include/openassetio/hostApi/Manager.hpp b/src/openassetio-core/include/openassetio/hostApi/Manager.hpp
index c1d78d558..708d97a2e 100644
--- a/src/openassetio-core/include/openassetio/hostApi/Manager.hpp
+++ b/src/openassetio-core/include/openassetio/hostApi/Manager.hpp
@@ -185,15 +185,14 @@ class OPENASSETIO_CORE_EXPORT Manager final {
    * applicable) once initialized.
    *
    * The behavior of calling initialize() on an already initialized
-   * Manager should be a no-op, but if an error was raised
-   * previously, then initialization will be re-attempted.
+   * Manager is to re-initialize the manager with any updated settings
+   * that are provided. If an error was raised previously, then
+   * initialization will be re-attempted.
    *
    * @note This must be called prior to any entity-related calls or
    * an Exception will be raised.
    *
    * @note This method may block for extended periods of time.
-   *
-   * @protected
    */
   void initialize(InfoDictionary managerSettings);
 
@@ -1824,17 +1823,6 @@ class OPENASSETIO_CORE_EXPORT Manager final {
 
   /// @}
 
-  /**
-   * @private
-   * Nothing to see here, this is working around an entertaining
-   * situation in our Python -> C++ migration, whereby can't
-   * expose the full Python Manager API if we make it in C++.
-   */
-  // NOLINTNEXTLINE(readability-identifier-naming)
-  [[nodiscard]] managerApi::ManagerInterfacePtr _interface() const;
-  // NOLINTNEXTLINE(readability-identifier-naming)
-  [[nodiscard]] managerApi::HostSessionPtr _hostSession() const;
-
  private:
   explicit Manager(managerApi::ManagerInterfacePtr managerInterface,
                    managerApi::HostSessionPtr hostSession);
diff --git a/src/openassetio-core/src/hostApi/Manager.cpp b/src/openassetio-core/src/hostApi/Manager.cpp
index b1fc6b2f8..f1cb051fc 100644
--- a/src/openassetio-core/src/hostApi/Manager.cpp
+++ b/src/openassetio-core/src/hostApi/Manager.cpp
@@ -530,9 +530,6 @@ std::vector<std::variant<BatchElementError, EntityReference>> hostApi::Manager::
   return result;
 }
 
-managerApi::ManagerInterfacePtr Manager::_interface() const { return managerInterface_; }
-managerApi::HostSessionPtr Manager::_hostSession() const { return hostSession_; }
-
 }  // namespace hostApi
 }  // namespace OPENASSETIO_CORE_ABI_VERSION
 }  // namespace openassetio
diff --git a/src/openassetio-python/cmodule/src/hostApi/ManagerBinding.cpp b/src/openassetio-python/cmodule/src/hostApi/ManagerBinding.cpp
index 8ce2ccaa0..ea9b5f98c 100644
--- a/src/openassetio-python/cmodule/src/hostApi/ManagerBinding.cpp
+++ b/src/openassetio-python/cmodule/src/hostApi/ManagerBinding.cpp
@@ -331,8 +331,5 @@ void registerManager(const py::module& mod) {
             return self.register_(entityReferences, entityTraitsDatas, publishingAccess, context);
           },
           py::arg("entityReference"), py::arg("entityTraitsData").none(false),
-          py::arg("publishAccess"), py::arg("context").none(false))
-      // @todo Remove one C++ API matches Python, and we remove ManagerFactory.py
-      .def("_interface", &Manager::_interface)
-      .def("_hostSession", &Manager::_hostSession);
+          py::arg("publishAccess"), py::arg("context").none(false));
 }


Test patch:
diff --git a/src/openassetio-python/tests/package/hostApi/test_manager.py b/src/openassetio-python/tests/package/hostApi/test_manager.py
index 9c7bfd407..801944bb1 100644
--- a/src/openassetio-python/tests/package/hostApi/test_manager.py
+++ b/src/openassetio-python/tests/package/hostApi/test_manager.py
@@ -51,13 +51,6 @@
 
 
 class Test_Manager_init:
-    def test_interface_returns_the_constructor_supplied_object(
-        self, mock_manager_interface, a_host_session
-    ):
-        # pylint: disable=protected-access
-        a_manager = Manager(mock_manager_interface, a_host_session)
-        assert a_manager._interface() is mock_manager_interface
-
     def test_when_constructed_with_ManagerInterface_as_None_then_raises_TypeError(
         self, a_host_session
     ):