Skip to content

feat(entities) Adds change provider entity and mysql backed store for it#44

Merged
behinddwalls merged 11 commits into
mainfrom
manjari/entities
Feb 24, 2026
Merged

feat(entities) Adds change provider entity and mysql backed store for it#44
behinddwalls merged 11 commits into
mainfrom
manjari/entities

Conversation

@manjari25
Copy link
Copy Markdown
Contributor

@manjari25 manjari25 commented Feb 23, 2026

Summary

feat(entities) Adds change provider entity and mysql backed store for it

Why?

This sets up change provider entity and its corresponding sql store. This will be used by various workflows in the orchestrator to get information about changes going through the system.

What?

  • Add a ChangeProvider entity
  • Add a ChangeProviderStore - the mysql store that backs this entity

Test Plan

Issues

Stack

  1. @ feat(entities) Adds change provider entity and mysql backed store for it #44
  2. feat(entities) Adds batch entity and batch sql schema #46
  3. feat(entities) Adds batch dependent entity and sql schema #47
  4. feat(entities) Adds build entity and sql schema #48
  5. feat(entities) Adds speculation tree entity and sql schema #49

Comment thread entity/change_provider.go
@@ -0,0 +1,19 @@
package entity

type ChangeProvider struct {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plz comment the struct itself

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread entity/change_provider.go Outdated
ID string
// Queue is the name of the queue processing the land request.
// This is defined in the configuration and should be unique within the system.
Queue string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not needed here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Comment thread entity/change_provider.go Outdated
ChangeProviderID string
// Metadata is the interesting data from the change provider that we want to store.
// This is a freeform JSON object.
Metadata map[string]any
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be [string]string to avoid ambiguity at the storage level and conversion errors?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment thread entity/change_provider.go Outdated
Metadata map[string]any
// Version is the version of the object. It is used for optimistic locking.
// Versioning starts at 1 and is incremented for each change to the object.
Version int32
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok to keep for now, not sure if we expect changes to this? I thought it should be fully immutable, unless we want to update data from the PRs periodically...

Copy link
Copy Markdown
Contributor Author

@manjari25 manjari25 Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this - version is not needed for this entity.

@@ -0,0 +1,9 @@
CREATE TABLE IF NOT EXISTS change_provider (
id VARCHAR(255) NOT NULL,
queue VARCHAR(255) NOT NULL,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

queue is likely not needed, we have request id incorporating it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

}

// Create creates a new change provider from a request. Returns ErrAlreadyExists if the entry already exists.
func (s *changeProviderStore) Create(ctx context.Context, request entity.Request) error {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to make ChangeProvider entity created by the app layer, and db layer is only to store or retrieve

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed this signature already.

Get(ctx context.Context, id string) (entity.ChangeProvider, error)

// Create creates a new change provider.
Create(ctx context.Context, request entity.Request) error
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto on above, storage layer store should in general not be aware of any entity other than the one it materializes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed this signature already.

@manjari25 manjari25 changed the title (entities) Adds change provider entity and mysql backed store for it feat (entities) Adds change provider entity and mysql backed store for it Feb 23, 2026
@manjari25 manjari25 changed the title feat (entities) Adds change provider entity and mysql backed store for it feat(entities) Adds change provider entity and mysql backed store for it Feb 23, 2026
@manjari25 manjari25 requested a review from sbalabanov February 23, 2026 22:56
return &changeProviderStore{db: db}
}

// Get retrieves a change provider by ID. Returns ErrNotFound if the change provider is not found.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it needs to retrieve all of the changes associated with the request? Also in the order specified in the request.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it has to be an array or a separate entity

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@manjari25 manjari25 requested a review from sbalabanov February 23, 2026 23:19
@@ -0,0 +1,7 @@
CREATE TABLE IF NOT EXISTS change_provider (
id VARCHAR(255) NOT NULL,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we call it request_id

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sqid :)
also in the Requests table :)

Comment thread extension/storage/mysql/change_provider_store.go
// to be the same as the request to which it belongs. The caller is repsonsible
// for inspecting and mapping the result of this function to the
// order of changes within the original request.
//
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: empty line

@behinddwalls behinddwalls marked this pull request as ready for review February 24, 2026 00:52
@behinddwalls behinddwalls requested review from a team as code owners February 24, 2026 00:52
@behinddwalls behinddwalls merged commit 3c25a2f into main Feb 24, 2026
1 check failed
manjari25 added a commit that referenced this pull request Feb 24, 2026
## Summary
feat(entities) Adds batch entity and batch sql schema

## Why?
<!-- Why is this change necessary? What is the motivation or
justification? -->
This sets up batch entity and its corresponding sql schema. This
establishes the core concept of a batch that will be used through the
system.

## What?
* Add a `Batch` entity
* Add `batch` mysql schema
* Note: `BatchStore` in upcoming PR

## Test Plan


## Issues


## Stack
1. #44
1. @ #46
1. #47
1. #48
1. #49
manjari25 added a commit that referenced this pull request Feb 24, 2026
## Summary
feat(entities) Adds batch dependent entity and sql schema


## Why?
<!-- Why is this change necessary? What is the motivation or
justification? -->
This sets up batch dependent entity and its corresponding sql schema.
This helps make reverse look ups for batch dependencies easier
throughout the system.

## What?
* Add a `BatchDependent` entity
* Add `batch_dependent` mysql schema
* Note: `BatchDependentStore` in upcoming PR

## Test Plan


## Issues


## Stack
1. #44
1. #46
1. @ #47
1. #48
1. #49
@sbalabanov
Copy link
Copy Markdown
Contributor

It seems that the comment about retrieveing an array of changes (or at least change ids) was not addressed?
Each request may specify more than one changeid, like in a case of stacked diffs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants