Skip to content

fix: ready to publish filter to apply only if all children are ready as well - #62

Open
maikschneider wants to merge 1 commit into
masterfrom
fix-ready2publish-filter
Open

fix: ready to publish filter to apply only if all children are ready as well#62
maikschneider wants to merge 1 commit into
masterfrom
fix-ready2publish-filter

Conversation

@maikschneider

@maikschneider maikschneider commented May 10, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes
    • Improved the accuracy of the "ready to publish" filter to ensure only records meeting publication readiness criteria are processed when managing workspace records with missing overlay information.

Review Change Stack

… publish as well

(cherry picked from commit 3672925939c0717186697b27ffe6d0c8d3a6e594)
@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown

Walkthrough

The pull request modifies the modifyAllRecords() method in AbstractBackendController to implement stricter filtering when the onlyReadyToPublish flag is active. For live records whose workspace overlay is missing, collected child references are now filtered to include only those with t3ver_stage equal to WORKSPACE_STAGE_READY_TO_PUBLISH. If no such references exist after filtering, the parent record is discarded. This narrows the publication scope to ensure only workspace-ready child records are included.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: filtering child references by workspace stage in the onlyReadyToPublish filter logic.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-ready2publish-filter

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@maikschneider
maikschneider marked this pull request as ready for review May 10, 2026 16:28

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Classes/Controller/AbstractBackendController.php (1)

837-846: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Cached _referencesToPublish is now a filtered subset, leaking into downstream consumers.

Storing only the ready-stage children under _referencesToPublish means the cache no longer represents "all workspace-modified children" — it now represents "ready children only" whenever the onlyReadyToPublish filter is active. Two downstream callers reuse this cached value via $record['_referencesToPublish'] ?? $this->collectReferencesToPublish($record):

  • addWorkspaceMetadata() (Line 892): the workspace state badge / referencesToPublish exposed to the view will hide non-ready modified children for live parents whenever the filter is active. The status text (childrenModified) and the t3ver_stage aggregation at Line 897-900 will also be derived from the filtered subset, making the live parent always look like "all children ready" even when it has additional modified children that are not yet ready.
  • onlyOfflineRecords branch (Line 858): if both filters are toggled on, this branch inherits the pre-filtered subset instead of the full set.

Consider keeping the full result cached and only using the filtered subset for the gating decision, e.g.:

♻️ Proposed fix
                     if ($this::WORKSPACE_ID > 0 && !is_array($vRecord)) {
                         $childRefs = $this->collectReferencesToPublish($record);
                         $readyChildRefs = array_values(array_filter(
                             $childRefs,
                             fn (array $ref): bool => $ref['t3ver_stage'] === self::WORKSPACE_STAGE_READY_TO_PUBLISH
                         ));
-                        if ($readyChildRefs !== []) {
-                            $record['_referencesToPublish'] = $readyChildRefs;
-                        } else {
+                        if ($readyChildRefs === []) {
                             $record = null;
                             continue;
                         }
+                        $record['_referencesToPublish'] = $childRefs;
                     } else {

If the intent really is to surface only the ready children to the view when this filter is active, please confirm — otherwise the metadata/state computed in addWorkspaceMetadata() will silently change for live parents under this filter.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Classes/Controller/AbstractBackendController.php` around lines 837 - 846, The
cached $record['_referencesToPublish'] is being overwritten with only-ready
children, leaking a filtered subset into downstream consumers; change the logic
in the block that builds $readyChildRefs so that you still cache the full set
returned by collectReferencesToPublish($record) (or a new variable like
$allChildRefs) and use a separate filtered variable (e.g. $readyChildRefs) only
for the gating decision that checks WORKSPACE_STAGE_READY_TO_PUBLISH; update
references in addWorkspaceMetadata() and the onlyOfflineRecords branch to
continue reading the unfiltered cached key ($record['_referencesToPublish'])
while using the filtered $readyChildRefs only to decide whether to mark/skip the
record when the onlyReadyToPublish filter is active.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@Classes/Controller/AbstractBackendController.php`:
- Around line 837-846: The cached $record['_referencesToPublish'] is being
overwritten with only-ready children, leaking a filtered subset into downstream
consumers; change the logic in the block that builds $readyChildRefs so that you
still cache the full set returned by collectReferencesToPublish($record) (or a
new variable like $allChildRefs) and use a separate filtered variable (e.g.
$readyChildRefs) only for the gating decision that checks
WORKSPACE_STAGE_READY_TO_PUBLISH; update references in addWorkspaceMetadata()
and the onlyOfflineRecords branch to continue reading the unfiltered cached key
($record['_referencesToPublish']) while using the filtered $readyChildRefs only
to decide whether to mark/skip the record when the onlyReadyToPublish filter is
active.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2642448e-1744-44d4-ac40-3cb3329c0713

📥 Commits

Reviewing files that changed from the base of the PR and between be05239 and c156b5d.

📒 Files selected for processing (1)
  • Classes/Controller/AbstractBackendController.php

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