fix audit log container scoping test#1254
Merged
ankurjuneja merged 1 commit intoJul 6, 2026
Merged
Conversation
Contributor
Author
|
@labkey-jeckels do you want to create the same branch in 25.11 as well or just in 25.11 and it will merge forward? |
labkey-jeckels
approved these changes
Jul 6, 2026
labkey-jeckels
left a comment
Contributor
There was a problem hiding this comment.
We've muted the failure in 25.11. Patching in 26.3 is good.
| @@ -0,0 +1,2 @@ | |||
| -- Drop the AuditLog view so targetedms-create.sql (runs after this script) rebuilds it with the fixed recursive CTE. | |||
| SELECT core.fn_dropifexists('AuditLog', 'targetedms', 'VIEW', NULL); | |||
Contributor
There was a problem hiding this comment.
This shouldn't be necessary, though it's harmless. Just the version bump should be enough to trigger the drop/create pair.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
The Skyline audit log "Detailed Info" popup was broken, clicking it returned a 404 for most audit entries. This caused TargetedMSContainerScopingTest to fail.
The cause is a bug in the targetedms.AuditLog database view. It uses a recursive query that's supposed to walk the whole chain of audit entries for a document, but the recursion runs in the wrong direction. As a result, the view only ever returns the first entry in each chain instead of all of them.
The code that renders the detail popup looks up an entry by id, but the entry it needs is the last one in the chain, which the broken view never returns, so the lookup finds nothing and returns a 404.
The bug was introduced in 2022 by #502 (Issue 44507, "Allow audit log entries to belong to multiple runs"). That change flipped the query's starting point from the last entry to the first entry, but left the recursion walking in the old direction, so the two no longer matched. It has been latent ever since (the view definition is identical across 25.7, 25.11, and 26.3) and only surfaced now because the new audit-detail lookup relies on reaching entries the broken view drops.
This fix corrects the recursion direction so the view returns every entry in the chain. It also adds a schema upgrade step to rebuild the view on existing databases.
Related Pull Requests
Changes
JOIN logTree prev ON prev.entryHash = nxt.parentEntryHash. Verified fix returns the full tree (7516/7516 entries; both terminal entries reachable), so retrieve() resolves them.