36267 publishing api include scheduled bundles in apiv1publishing#36275
36267 publishing api include scheduled bundles in apiv1publishing#36275hassandotcms wants to merge 6 commits into
Conversation
…36267) Introduce the data-layer support for surfacing bundles that were pushed with a future publish date but not yet picked up by PublisherQueueJob — they live in publishing_queue (non-null publish_date) with no publishing_queue_audit row. - PublishAuditStatus.Status: append SCHEDULED with a negative sentinel code (-1) that is never persisted and cannot collide with real status codes (1-18). - PublisherAPI/PublisherAPIImpl: add countScheduledBundleIds(filter) and getScheduledBundleIds(limit, offset, filter). Criterion mirrors the legacy Queue tab (publish_date IS NOT NULL, excludes drafts) plus NOT EXISTS an audit row. asset_count from queue rows; environment_count via correlated subquery to avoid multiplying the asset count.
…#36267) Surface the SCHEDULED tier through the existing publishing endpoints rather than a new endpoint. The list endpoint now unions two sources — the synthetic SCHEDULED tier (read from publishing_queue) and the audit tier — as a contiguous block so cross-source pagination and the total count stay exact. - PublishingResource.listPublishingJobs: merge scheduled + audit with contiguous -tier paging; strip SCHEDULED before querying the audit table; ?status=SCHEDULED alone returns no audit rows (not all). Status @parameter doc updated. - getPublishingJobDetails: a bundle with no audit row falls through to a synthesized SCHEDULED detail (target environments/endpoints listed with null status) instead of 404. - purgePublishingJobs: reject ?status=SCHEDULED explicitly (audit-based bulk purge would silently match nothing); points at per-bundle DELETE to cancel. - AbstractPublishingJobView / AbstractPublishingJobDetailView: add nullable scheduledPublishDate so the future run time is not overloaded onto createDate. - PublishingJobsHelper: toScheduledJobView / toScheduledJobDetailView build views from the queue/bundle tables without an audit history pojo. - openapi.yaml regenerated.
Add coverage to PublishingResourceIntegrationTest using the real push path
(saveBundleAssets + publishBundleAssets with a future date, no audit row):
- scheduled bundle visible with status SCHEDULED and queue/bundle-sourced fields
- ?status=SCHEDULED returns only the scheduled tier; mixed SCHEDULED,SUCCESS works
- pagination total equals the union of the audit and scheduled tiers
- GET /{id} returns a SCHEDULED detail instead of 404
- DELETE /{id} cancels and removes the bundle from the scheduled tier
- transition: once an audit row appears it leaves SCHEDULED for WAITING_FOR_PUBLISHING
- parity guardrail: legacy getQueueBundleIds and ?status=SCHEDULED agree
|
Claude finished @hassandotcms's task in 1m 44s —— View job Rollback Safety Analysis
Result: Pull Request Unsafe to Rollback
Scope of this review: Checked against all categories (C-1 through C-4, H-1 through H-8, M-1 through M-4). No database migrations, Elasticsearch mapping changes, bundle XML format changes, or OSGi interface breaks were detected. The only rollback-unsafe category is M-3 above. |
🤖 Bedrock Review —
|
|
Semgrep found 7
The method identified is susceptible to injection. The input should be validated and properly If this is a critical or high severity finding, please also link this issue in the #security channel in Slack. |
getScheduledBundleIds preferred publishing_bundle.publish_date over publishing_queue.publish_date. The queue value is authoritative — it is what PublisherQueueJob acts on and what the legacy Queue tab displayed — and the bundle-row date can be stale or null (the v1 push sets both equal, but the legacy AJAX push and low-level queueing write only the queue). When the two diverged, scheduledPublishDate (and the list view) showed the wrong date and disagreed with the detail endpoint, which already reads the queue value. Swap the COALESCE precedence to publishing_queue.publish_date first. Fixes the failing PublishingResourceIntegrationTest#test_scheduledBundle_visibleWithScheduledStatus.
…es-in-apiv1publishing
🤖 Bedrock Review —
|
|
Pull Request Unsafe to Rollback!!!
|
| /** | ||
| * Coerces a DotConnect result value to a Date (JDBC returns java.sql.Timestamp), or null. | ||
| */ | ||
| private static Date asDate(final Object value) { |
There was a problem hiding this comment.
There's a com.dotmarketing.util.DateUtil class in core. Please move this method to that class of check if the method already exists there.
| /** | ||
| * Coerces a DotConnect result value (Number or numeric String) to an int, defaulting to 0. | ||
| */ | ||
| private static int asInt(final Object value) { |
There was a problem hiding this comment.
There's a com.dotmarketing.util.NumberUtil class in core. Please move this method to that class of check if the method already exists there.
…36267) Address review feedback (jcastro-dotcms): relocate the asInt/asDate coercion helpers out of PublishingJobsHelper into the shared utility classes. - NumberUtil.asInt(Object) and DateUtil.asDate(Object) added (additive; no existing method of that name, no signature collision). - PublishingJobsHelper now calls them; the private copies are removed. Behavior is identical — pure relocation, no functional change.
🤖 Bedrock Review —
|
Include scheduled bundles in GET /api/v1/publishing (resolves #36267)
Problem
/api/v1/publishing only reads publishing_queue_audit. Bundles pushed with a future publish date have no audit row until the cron picks them up, so they were invisible to the API (the legacy JSP Queue tab showed them by reading publishing_queue directly).
Change
Surface those bundles through the existing endpoints as a new SCHEDULED status — no new endpoint.
env count via correlated subquery.
mixed filters work.
Tests
Integration tests in PublishingResourceIntegrationTest using the real push path: visibility/status, status filter (single + mixed), pagination total, detail-not-404, delete-cancels, transition to WAITING_FOR_PUBLISHING once an audit row appears, and a legacy-getQueueBundleIds-vs-API parity check.