[BUG FIX] [MER-4055] Fix section update after re-adding page earlier removed from curriculum#6283
[BUG FIX] [MER-4055] Fix section update after re-adding page earlier removed from curriculum#6283andersweinstein wants to merge 16 commits intomasterfrom
Conversation
AI Review — securityNo issues found |
AI Review — performanceFull revision structs are loaded unnecessarilyfile: lib/oli/delivery/sections/updates.ex Major update now always does an extra full publication scanfile: lib/oli/delivery/sections/updates.ex |
AI Review — elixirFull revision rows loaded unnecessarily in missing-resource queryfile: lib/oli/delivery/sections/updates.ex Test can crash with unclear failure if expected child is missingfile: test/oli/sections_test.exs |
Because missing resources arise from instructor manually restoring previously removed pages to the curriculum, we expect the size of this set to be small (in most cases empty), so current simpler code should be acceptable.
Scoping this reconciliation to only PublicationDiff additions would miss |
|
This scares me a bit. I think we need to ensure that there is specifically a unit or scenario test somewhere (and if there isn't one, create it) that clearly demonstrates these operations:
Assert that B is added but A remains removed from section
|
darrensiegel
left a comment
There was a problem hiding this comment.
See additional tests that we need
The implementation passes the first test as is for the following reason: So although A is detected as a missing resource in this case and (temporarily) restored to section_resources, the existing three-way merge logic does not add it to curriculum in this situation. After merge, the provisionally added row gets culled once again as unreachable since not in curriculum. But the second case would require more work to support:
Basically we would need some way to persist the information that A was removed from section even after A is removed from project and published to handle the case where A is added back into project and published. Otherwise code has no way to detect that there was a prior remix removal of A that needs to take precedence. This would require new database support, most naturally a table to remember remix-removed resources. (could also add column to flag removed section resources, but then removed resources would have to be filtered in queries where appropriate) |
PrivSignal ReportTop-level result:
Links: artifact bundle
Reason EventsNone Sample Of All EventsNone |
|
Preview deployed to: https://pr-6283.plasma.oli.cmu.edu |
|
Added test for Darren's case 1. Case 2 we are allowing to fail rather than add new database support to handle it. |
This PR fixes MER-4055, where a page removed from curriculum would disappear from a section after a publication
update, but later re-adding that same page to the curriculum and applying a subsequent publication update would
not make it reappear in student delivery.
The root cause was in section update processing, so it could affect both automatically pushed ("force push")
updates and manually applied section updates.When a page became unreachable, its section_resource could be
culled from the section. If that same page was later reintroduced, the update logic did not recreate the missing
section_resource, so delivery still had nothing to render even though the page was back in the authoring project
and publication. This PR updates the section update flow to recreate missing section resources for resources
present in the new publication before reconciling hierarchy, which allows reintroduced pages to appear again in
sections.
This branch retains an authoring-side safeguard committed in an earlier PR: when a deleted page is reattached
to a container, the code now restores its deleted flag. That is not the primary fix for MER-4055, but it remains a
reasonable defensive improvement for exceptional case of admin page recovery workflows.
Testing:
section update, re-add the same page, publish and apply the next update, and confirm it reappears in delivery.