code: def check_permission_actions_are_documented():
      from datasette.plugins import pm
  
      content = (
          pathlib.Path(__file__).parent.parent
          / "docs"
          / "authentication.rst"
      ).read_text()
      permissions_re = re.compile(r"\.\. _permissions_([^\s:]+):")
      documented_permission_actions = set(
          permissions_re.findall(content)
      ).union(UNDOCUMENTED_PERMISSIONS)
  
      def before(hook_name, hook_impls, kwargs):
          if hook_name == "permission_allowed":
              datasette = kwargs["datasette"]
              assert kwargs["action"] in datasette.permissions, (
                  "'{}' has not been registered with register_permissions()".format(
                      kwargs["action"]
                  )
                  + " (or maybe a test forgot to do await ds.invoke_startup())"
              )
              action = kwargs.get("action").replace("-", "_")
              assert (
                  action in documented_permission_actions
              ), "Undocumented permission action: {}, resource: {}".format(
                  action, kwargs["resource"]
              )
  
      pm.add_hookcall_monitoring(
          before=before,
          after=lambda outcome, hook_name, hook_impls, kwargs: None,
      )
  
imports: import asyncio
  import httpx
  import os
  import pathlib
  import pytest
  import pytest_asyncio
  import re
  import subprocess
  import tempfile
  import time
  import trustme
label_desc: Use image node_id 8 for calling a global function with example usage: check_permission_actions_are_documented() without return types