Skip to content

Rename agent.workspaces_agent_config to unversioned_latest_workspaces_agent_config

Zhaochen Li requested to merge zl/494682 into master

Issue - Prevent accidental usage of un-versioned worksp... (#494682 - closed)

What does this MR do and why?

We need to come up with a plan to avoid misuse of the latest agent config from the workspace model.

I.e., normally, we should NEVER use agent.workspaces_agent_config.some_field, because we normally always want to retrieve the versioned field instead, via workspaces.workspaces_agent_config. The only place we need to directly refer to agent.workspaces_agent_config is in the Workspace model itself, and even there only in the hook and validation logic which directly relates to the versioning logic itself.

This is important, because incorrect behavior can be easily introduced if we don't guard against it. Here's another recent example of it almost happening: !166343 (comment 2132939264)

MR acceptance checklist

  • update agent's association to unversioned_latest_workspaces_agent_config
  • a big comment above the has_one association explaining why the name is non-standard, and linking to the documentation on versioning.
  • update all reference to the association

Screenshots or screen recordings

Tested locally with this branch, and everything looks fine, and no issue raised during our major flow

Screenshot_2024-10-15_at_2.28.52_PM

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Zhaochen Li

Merge request reports

Loading