Skip to content

Follow-up from "Create DesiredConfigFetcher and ConfigToApplyBuilder in RemoteDevelopment::WorkspaceOperations::Reconcile::Output"

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

The following discussion from !194727 (merged) should be addressed:

  • @cwoolley-gitlab started a discussion:

    issue (bug): There is an existing problem with the workspace_agentk_states factory, which was missed in the original MR Create workspace_agentk_states table (!190027 - merged) • Ashvin Sharma • 18.1 (which I did not review).

    It was writing raw JSON string to the field:

        desired_config do
          RemoteDevelopment::FixtureFileHelpers.read_fixture_file('example.desired_config.json')
        end

    ...rather than parsing and writing the Array object:

        desired_config do
          Gitlab::Json.parse(RemoteDevelopment::FixtureFileHelpers.read_fixture_file("example.desired_config.json"))
        end

    This was not caught, for two reasons:

    1. because that MR also did not adequately test this field in the it "has correct associations from factory" do example:
         it "has correct associations from factory" do
            expect(workspace_agentk_state.workspace).to eq(workspace)
            expect(workspace_agentk_state.project).to eq(project)
          end

    I've now improved the spec in my patch, to catch this and drive the fix.

    1. The workspaces factory was not updated to properly populate the association for workspace_agentk_state (and test it and its validity in its it "has correct associations from factory" do example. I've also updated this in my patch.

    It looks like there are similar problems/omissions with many of the other Workspace domain model specs/factories. We should open a follow-up issue to revisit all of these and make them consistent and correct.

Edited by 🤖 GitLab Bot 🤖