Skip to content

Geo Primary Verification API: GET api/v4/admin/data_management/:model

Why are we doing this work

This work will be behind feature flag geo_primary_verification_view

We are building a view for customers to manage their instance's data and verify primary data integrity for Geo Improve primary verification experience (&16554)

important: This endpoint should be marked as experimental or beta until this work is complete to avoid issues with deprecations or removals as we explore what is needed.

note: The proposed endpoint may be changed based on decisions on the routing

What is needed in this change

This change is focused on creating an endpoint that is able to return a list of models based on the passed in :model parameter. We will address ?query parameters in Geo Primary Verification API: GET `api/v4/admin... (#537710 - closed)

Example response

important: This is very much a POC and could end up needing more/less than this response

{
  "id": "4",
  "modelClass": "Project",
  "createdAt": "2025-03-10T19:15:13Z",
  "file_size": "181"
  "links": [ // Inspired by https://gitlab.com/gitlab-org/gitlab/-/issues/521274
    { "type": "view_model", "text": "View project", link: "https://gitlab.com/gitlab-org/gitlab-test" },
    { "type": "model_docs", "text": "Project docs", link: "https://docs.gitlab.com/user/project/organize_work_with_projects" },
    { "type": "troubleshooting", "text": "Troubleshooting docs: Missing repository", link: "https://docs.gitlab.com/administration/geo/replication/troubleshooting/common/#failed-checksums-on-primary-site" }
  ],
  "addlInfo": [ // model specific information that is presented in key/value pairs for the frontend
    { "key": "value" },
    { "key": "value" }
  ],
  // Geo Specific Information
  "checksum": "1395a9bd59ff0e7d2207bd9cde6b67ee4a2f56fd",
  "checksumMismatch": "df65f2a4ee76b6edc9db7022d7e0ff95db9a5931",
  "lastChecksum": "2025-04-23T15:34:06Z",
  "checksumState": "FAILED",
  "checksumRetryCount": 3,
  "checksumRetryAt": "2025-04-23T15:38:06Z"
  "checksumFailure:" "Project cannot be checksummed because it does not exist"
}

NB: checksumMismatch (relates to the registry, not accessible from the primary), links and addlInfo from the above won't be included in the MVC. There are follow-up issues to discuss and define how best to include this data.

Relevant links

Implementation plan

Roighly, this works starts with the following:

  1. Add a new Grape DSL class called DataManagement in ee/lib/api;
  2. Use the same inclusions as GeoSites, but simplify authentication to be admin only;
  3. Add the base route /data_management to render the list of the first model;
  4. Add a model_name route param and the GET route:
      route_param :model_name, type: String, desc: 'The name of the model being managed' do
        # Example request:
        #   GET /data_management/:model_name
        desc 'Get a list of model data' do
          summary 'Retrieve data about the passed model'
          success code: 200, model: EE::API::Entities::Model
          failure [
            { code: 400, message: '400 Bad request' },
            { code: 401, message: '401 Unauthorized' },
            { code: 403, message: '403 Forbidden' },
            { code: 404, message: '404 GeoSite Not Found' }
          ]
          tags %w[geo_sites]
        end
        get do
          # Find a way to get the model from the :model_name parameter
          model = IDynamicallyFindAModel.model_from_name(params[:model_name])
          not_found!(params[:model_name]) unless model

          present model, with: EE::API::Entities::Model
        end
  1. Add the EE::API::Entities::Model class to return information from the example response above.
Edited by Chloe Fons