Skip to content

feat(memory-server): add generic task system columns and migration#248

Merged
Hyperkid123 merged 1 commit into
OpenShift-Fleet:masterfrom
Hyperkid123:feat/RHCLOUD-48376
Jun 17, 2026
Merged

feat(memory-server): add generic task system columns and migration#248
Hyperkid123 merged 1 commit into
OpenShift-Fleet:masterfrom
Hyperkid123:feat/RHCLOUD-48376

Conversation

@Hyperkid123

@Hyperkid123 Hyperkid123 commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stage 1 of the generic task system migration (RHCLOUD-48376, parent epic RHCLOUD-48375).

Additive only — no columns removed, no behavior changed, no API changes. The bot keeps working on old columns unaware of the new ones.

What's in this PR

  • Schema: Adds external_key, source_type, source_url, artifacts columns to 6 tables (tasks, bot_status, bot_instances, cycles, slack_notifications, memories). All nullable, no constraints yet.
  • Migration script (m001_generic_tasks.py): Idempotent backfill that copies jira_keyexternal_key, sets source_type = 'jira', constructs source_url, and builds artifacts JSONB array from pr_number/pr_url + metadata.prs[] with URL deduplication.
  • 10 migration tests covering: column existence, simple task, single PR, multi-repo PRs, overlap dedup, GitLab MR type, other tables backfill, idempotency, old columns untouched, source URL format.

What this does NOT change

  • No API changes (Stage 2)
  • No tool signature changes (Stage 2)
  • No model changes (Stage 2)
  • No CLAUDE.md instruction changes (Stage 4)
  • No column drops (Stage 5)

Test plan

  • CI pipeline: all 16 migration tests pass (6 existing + 10 new) against Postgres sidecar
  • Existing tests unaffected (schema changes are additive with ADD COLUMN IF NOT EXISTS)
  • Migration is idempotent (running twice produces same result)
  • Old columns untouched after backfill

@Hyperkid123 Hyperkid123 force-pushed the feat/RHCLOUD-48376 branch 2 times, most recently from ba2b5ce to ce623d8 Compare June 16, 2026 13:51
"""Migration 001: Add generic task system columns and backfill from jira_key.

Additive only — no columns removed, no constraints changed.
Idempotent — safe to run multiple times (skips rows where external_key is already set).

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.

👍


SCHEMA_PATH = Path(__file__).parent.parent / "schema.sql"

JIRA_BASE_URL = "https://issues.redhat.com/browse"

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: should probably pull from an env var like other vars below, not blocking though.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good call — updated to read from the JIRA_URL env var (required, no fallback). Already configured in deploy/template.yaml. Tests set it via os.environ.setdefault and the Tekton pipeline now passes it too.

RHCLOUD-48376

Stage 1 of the generic task system migration (RHCLOUD-48375).
Adds external_key, source_type, source_url, and artifacts columns
to all relevant tables. Includes idempotent backfill script that
copies jira_key values and builds artifacts JSONB from PR data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Hyperkid123 Hyperkid123 merged commit d5a31a7 into OpenShift-Fleet:master Jun 17, 2026
6 checks passed
@Hyperkid123 Hyperkid123 deleted the feat/RHCLOUD-48376 branch June 17, 2026 07:34
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