Skip to content

[Refactor] Unify Automation Results inbox persistence - #2563

Draft
roomote-roomote[bot] wants to merge 1 commit into
developfrom
refactor/results-inbox-persistence-2ntp42gfplrdp
Draft

[Refactor] Unify Automation Results inbox persistence#2563
roomote-roomote[bot] wants to merge 1 commit into
developfrom
refactor/results-inbox-persistence-2ntp42gfplrdp

Conversation

@roomote-roomote

Copy link
Copy Markdown
Contributor

​Created by Roomote. View the task or mention @roomote-roomote for follow-up asks.

What changed

  • Made automation_results the canonical persistence and lifecycle model for both reports and suggestions.
  • Moved suggestion producers and Results inbox list, count, accept, ignore, and clear operations onto the canonical model.
  • Added a migration that backfills existing suggestion results and temporarily synchronizes the retained work_items compatibility columns in both directions for N-1 rollback safety.
  • Added focused migration, producer, ordering, visibility, count, and lifecycle coverage.

Why this change was made

The Results inbox exposed one item contract but implemented every lifecycle operation across two tables. Consolidating the model prevents report and suggestion behavior from drifting while preserving safe rollback to the previous release.

Impact

There is no intended user-facing behavior change. Results retain the same visibility, priority ordering, deduplication, accept/ignore, clear-all, and task-launch behavior, with one canonical persistence path and an explicit temporary rollback bridge.

@roomote-community

roomote-community Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

1 issue outstanding. See task

  • packages/db/drizzle/0086_tearful_power_pack.sql:4 Deleting a source task/work item leaves its canonical suggestion result visible in the Results inbox.

Reviewed a743b97

ALTER TABLE "automation_results" ADD COLUMN "source_work_item_id" uuid;--> statement-breakpoint
ALTER TABLE "automation_results" ADD COLUMN "kind" text DEFAULT 'report' NOT NULL;--> statement-breakpoint
ALTER TABLE "automation_results" ADD COLUMN "title" text;--> statement-breakpoint
ALTER TABLE "automation_results" ADD CONSTRAINT "automation_results_source_work_item_id_work_items_id_fk" FOREIGN KEY ("source_work_item_id") REFERENCES "public"."work_items"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint

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.

work_items.source_task_id cascades on task deletion, so existing suggestion inbox entries disappeared with their backing work item. This new FK instead nulls the canonical row's reference, leaving it unread and visible in Results after the source task/work item is deleted. Use ON DELETE CASCADE for the suggestion-result link (or explicitly delete the canonical row) to preserve the previous lifecycle.

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.

1 participant