chore(agent): remove dead artifact-revision & cloud-deployment models (phase B)
After phase A removed the old client task layer, AgentArtifactRevision and AgentCloudDeployment became unreferenced (their only consumers — the deleted heicode_task_create/project_artifacts/artifact_edits/cloud_deploy — are gone). Removed the structs + their AutoMigrate entries. Existing tables are left in place (harmless, no model) and can be dropped later if desired. Option B teardown: kept the shared platform backend still used by the web console / runtime callbacks (admin /api/agent/*, approvals, leases, callbacks, AgentArtifact, sk-snapshots, withDisplayStatus). Build + controller/model/router tests green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
package model
|
||||
|
||||
// AgentArtifactRevision stores client-submitted local edits to a project
|
||||
// artifact as monotonic revisions (unified spec §12.7). Manager is the owner of
|
||||
// the accepted-revision baseline; Runtime reads new revisions via Manager.
|
||||
type AgentArtifactRevision struct {
|
||||
Id int `gorm:"primaryKey" json:"id"`
|
||||
ArtifactID string `gorm:"type:varchar(128);index" json:"artifact_id"`
|
||||
DeploymentID string `gorm:"type:varchar(64);index" json:"deployment_id"`
|
||||
UserID string `gorm:"type:varchar(64);index" json:"user_id"`
|
||||
Revision int `gorm:"index" json:"revision"`
|
||||
ProjectRevision int `json:"project_revision"`
|
||||
Source string `gorm:"type:varchar(64)" json:"source"`
|
||||
BaseContentHash string `gorm:"type:varchar(128)" json:"base_content_hash"`
|
||||
ContentHash string `gorm:"type:varchar(128)" json:"content_hash"`
|
||||
ChangeSummary string `gorm:"type:varchar(512)" json:"change_summary"`
|
||||
CreatedBy string `gorm:"type:varchar(64)" json:"created_by"`
|
||||
Status string `gorm:"type:varchar(32)" json:"status"`
|
||||
PayloadJSON string `gorm:"type:text" json:"-"`
|
||||
CreatedAtMs int64 `gorm:"bigint;index" json:"created_at"`
|
||||
}
|
||||
|
||||
func (AgentArtifactRevision) TableName() string {
|
||||
return "agent_artifact_revisions"
|
||||
}
|
||||
|
||||
func InsertAgentArtifactRevision(r *AgentArtifactRevision) error {
|
||||
return DB.Create(r).Error
|
||||
}
|
||||
|
||||
func ListAgentArtifactRevisions(artifactID string) ([]AgentArtifactRevision, error) {
|
||||
var rows []AgentArtifactRevision
|
||||
err := DB.Where("artifact_id = ?", artifactID).Order("revision asc, id asc").Find(&rows).Error
|
||||
return rows, err
|
||||
}
|
||||
|
||||
// LatestAgentArtifactRevision returns the highest-revision row for an artifact.
|
||||
func LatestAgentArtifactRevision(artifactID string) (AgentArtifactRevision, bool) {
|
||||
var row AgentArtifactRevision
|
||||
if err := DB.Where("artifact_id = ?", artifactID).Order("revision desc, id desc").First(&row).Error; err != nil {
|
||||
return AgentArtifactRevision{}, false
|
||||
}
|
||||
return row, true
|
||||
}
|
||||
|
||||
// LatestAcceptedRevisionForDeployment returns the newest accepted revision
|
||||
// across all of a deployment's artifacts. This is the baseline a follow-up
|
||||
// /messages or /execute consumes (unified spec §12.7, gap P1-3).
|
||||
func LatestAcceptedRevisionForDeployment(deploymentID string) (AgentArtifactRevision, bool) {
|
||||
var row AgentArtifactRevision
|
||||
if err := DB.Where("deployment_id = ? AND status = ?", deploymentID, "accepted").
|
||||
Order("created_at_ms desc, id desc").First(&row).Error; err != nil {
|
||||
return AgentArtifactRevision{}, false
|
||||
}
|
||||
return row, true
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package model
|
||||
|
||||
// AgentCloudDeployment is the Manager-side control-plane record for deploying a
|
||||
// project_folder artifact to a cloud target (unified spec §18). Manager owns
|
||||
// validation/approval/credential-resolution/audit; actual provisioning is
|
||||
// executed by a Deploy Worker (not yet connected — records sit in a requested/
|
||||
// waiting state until a worker picks them up).
|
||||
type AgentCloudDeployment struct {
|
||||
Id int `gorm:"primaryKey" json:"id"`
|
||||
DeployRunID string `gorm:"type:varchar(64);uniqueIndex" json:"deployment_run_id"`
|
||||
DeploymentID string `gorm:"type:varchar(64);index" json:"deployment_id"`
|
||||
UserID string `gorm:"type:varchar(64);index" json:"user_id"`
|
||||
ArtifactID string `gorm:"type:varchar(128)" json:"artifact_id"`
|
||||
ArtifactRevision int `json:"artifact_revision"`
|
||||
Target string `gorm:"type:varchar(32);index" json:"target"`
|
||||
Environment string `gorm:"type:varchar(32)" json:"environment"`
|
||||
Region string `gorm:"type:varchar(64)" json:"region"`
|
||||
ResourceBindingID int `json:"resource_binding_id"`
|
||||
Status string `gorm:"type:varchar(32);index" json:"status"`
|
||||
URL string `gorm:"type:varchar(512)" json:"url"`
|
||||
PayloadJSON string `gorm:"type:text" json:"-"`
|
||||
CreatedAtMs int64 `gorm:"bigint;index" json:"created_at"`
|
||||
UpdatedAtMs int64 `gorm:"bigint" json:"updated_at"`
|
||||
}
|
||||
|
||||
func (AgentCloudDeployment) TableName() string {
|
||||
return "agent_cloud_deployments"
|
||||
}
|
||||
|
||||
func InsertAgentCloudDeployment(r *AgentCloudDeployment) error {
|
||||
return DB.Create(r).Error
|
||||
}
|
||||
|
||||
func ListAgentCloudDeploymentsByDeployment(deploymentID string) ([]AgentCloudDeployment, error) {
|
||||
var rows []AgentCloudDeployment
|
||||
err := DB.Where("deployment_id = ?", deploymentID).Order("id desc").Find(&rows).Error
|
||||
return rows, err
|
||||
}
|
||||
|
||||
func GetAgentCloudDeployment(deployRunID string, userID string) (AgentCloudDeployment, bool) {
|
||||
var row AgentCloudDeployment
|
||||
if err := DB.Where("deploy_run_id = ? AND user_id = ?", deployRunID, userID).First(&row).Error; err != nil {
|
||||
return AgentCloudDeployment{}, false
|
||||
}
|
||||
return row, true
|
||||
}
|
||||
@@ -324,8 +324,6 @@ func migrateDB() error {
|
||||
&AgentDeployment{},
|
||||
&AgentCallbackEvent{},
|
||||
&AgentArtifact{},
|
||||
&AgentArtifactRevision{},
|
||||
&AgentCloudDeployment{},
|
||||
&AgentSKSnapshot{},
|
||||
// V2 device-binding: X25519 keypair the Manager uses for ECDH
|
||||
// body decryption. See model/server_key.go.
|
||||
|
||||
Reference in New Issue
Block a user