Skip to content

feat(api): adds Resource persistence model and migration#278

Open
eLRuLL wants to merge 1 commit into
mainfrom
adr001/resource-model
Open

feat(api): adds Resource persistence model and migration#278
eLRuLL wants to merge 1 commit into
mainfrom
adr001/resource-model

Conversation

@eLRuLL
Copy link
Copy Markdown
Member

@eLRuLL eLRuLL commented Apr 29, 2026

Description

Introduces the initial persistence layer for the resource control-plane architecture.

Changes included:

  • Add Resource model in core/models.py.
  • Add migration core/migrations/0039_resource.py to create the Resource table.

Resource includes:

  • Required scope: project
  • Core state: kind, phase
  • Control-plane payloads: desired_spec, observed_state, external_ref
  • Reconciliation metadata: error_message, retry_count
  • Links to existing entities from a reverse foreign key.
  • Timestamps: created, updated

This PR is intentionally persistence-only:

  • No dispatch/reconciler behavior changes
  • No API contract changes
  • No backfill/migration strategy logic yet

Issue

  • _N/A

Checklist before requesting a review

  • I have performed a self-review of my code.
  • My code follows the style guidelines of this project.
  • I have made corresponding changes to the documentation. (not required for this persistence-only step)
  • New and existing tests pass locally with my changes. (could not run here due missing local Django runtime in this environment)
  • If this change is a core feature, I have added thorough tests. (not applicable in this persistence-only PR)
  • If this change affects or depends on the behavior of other estela repositories, I have created pull requests with the relevant changes in the affected repositories. (not applicable)
  • I understand that my pull request may be closed if it becomes obvious or I did not perform all of the steps above.

@eLRuLL eLRuLL requested review from erick-GeGe and joaquingx April 29, 2026 04:18
Comment thread estela-api/core/models.py
@@ -0,0 +1,140 @@
# Generated by Django 3.1.14 on 2026-04-28 15:35
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.

There will be a conflict with this migration in #275, we need to coordinate it.

Comment thread estela-api/core/models.py
Comment on lines +509 to +511
class Resource(models.Model):
KIND_OPTIONS = [
(ResourceKind.SPIDER_JOB, "Spider Job"),
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.

Will be good to add a str

Comment thread estela-api/core/models.py
Comment on lines +543 to +546
desired_spec = models.JSONField(
default=dict,
help_text="Desired resource spec managed by the control plane.",
)
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.

e.g. spiderjob which kind of desired_spec should have, the same for observed_state ?

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.

2 participants