Skip to content

[TAN-7137] Add scheduled publication status transitions#13608

Open
adessy wants to merge 20 commits intomasterfrom
TAN-7137/project-publication-back-end
Open

[TAN-7137] Add scheduled publication status transitions#13608
adessy wants to merge 20 commits intomasterfrom
TAN-7137/project-publication-back-end

Conversation

@adessy
Copy link
Copy Markdown
Contributor

@adessy adessy commented Apr 9, 2026

Changelog

For translators

TODOs

  • Rework retry policy for ProcessScheduledPublicationTransitionsJob
  • Implement strategies to mitigate the risk of accessing the raw status by mistake (maybe a Rubocop cop?)

@notion-workspace
Copy link
Copy Markdown

@adessy adessy force-pushed the TAN-7137/project-publication-back-end branch from 927443e to 1bbbf45 Compare April 9, 2026 12:36
@cl-dev-bot
Copy link
Copy Markdown
Collaborator

cl-dev-bot commented Apr 9, 2026

Warnings
⚠️

The changelog is empty. What should I put in the changelog?

Messages
📖 Notion issue: TAN-7137
📖

Run the e2e tests

📖 Check translation progress

Generated by 🚫 dangerJS against 7c872fb

@adessy adessy force-pushed the TAN-7137/project-publication-back-end branch from 1bbbf45 to fd8ecda Compare April 14, 2026 08:50
adessy added 13 commits April 16, 2026 16:05
…cation

Add columns, validations, and effective status computation for scheduling future publication status transitions. Scopes and predicates reflect the effective status immediately when the scheduled time passes.
Background job that materializes scheduled publication status transitions.
When a schedule is set via project or folder update, the `SideFx` service enqueues `ProcessScheduledPublicationTransitionJob` with `wait_until: scheduled_at`.
…ct publication_status column references

Many places queried admin_publications.publication_status directly in SQL joins and where clauses. These bypass the effective status computation and wouldn't account for scheduled transitions whose time has passed.
Store the scheduling user in a new `scheduled_by_id` column on admin_publications instead of passing it as a job argument. This lets us materialize the status transition from other places too, such as a sweep job that recovers failed scheduled transitions, or a controller that needs to handle edge cases when the publication status is changed after `scheduled_at` has passed but before the materialization job has run.
           When an admin modifies or deletes a project after scheduled_at has passed but before the job ran, the SideFx service now runs the transition synchronously first. This ensures side effects like activity logs, emails, and first_published_at are recorded before the admin's operation proceeds.
…jects

Projects that were scheduled to publish and whose publish date has already passed are now protected from moderator deletion, even if the materialization job hasn't run yet.
…llers

The ProcessScheduledPublicationTransitionsJob (plural) now sweeps through all due transitions by default, but you can also target a specific one by passing an admin_publication.

Moved synchronous materialization out of SideFx services and into controllers, right before assign_attributes. This sidesteps conflicts from unpersisted changes and avoids infinite recursion.

Also added the job to hourly_jobs.rake as a safety net.
@adessy adessy force-pushed the TAN-7137/project-publication-back-end branch from fd8ecda to 4c6cbbe Compare April 16, 2026 14:05
adessy added 3 commits April 20, 2026 10:24
Only expose `scheduled_status` and `scheduled_at` attributes to moderators and admins.
@adessy adessy force-pushed the TAN-7137/project-publication-back-end branch from f63bd3a to 388cdeb Compare April 20, 2026 11:18
adessy added 4 commits April 22, 2026 13:08
# Conflicts:
#	back/app/services/side_fx_project_service.rb
#	back/db/structure.sql
Moving the logic that auto-sets `scheduled_by` since it felt a bit hidden in the side fx service, plus refactoring parameter extraction in the controllers.
When filter_by is not provided, nil.in? returns false, so no scope is built. The ordering method then crashes with PG::UndefinedColumn because it references a column from a JOIN that was never applied.
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