Skip to content

fix(acl): make the domain classes that s2-create-acl-domains generates compare and serialize as the plugin's - #16968

Open
borinquenkid wants to merge 1 commit into
7.0.xfrom
fix/acl-generated-domains-equality-7.0.x
Open

borinquenkid wants to merge 1 commit into
7.0.xfrom
fix/acl-generated-domains-equality-7.0.x

Conversation

@borinquenkid

Copy link
Copy Markdown
Member

Fixes #15927 (reported by DamsoftDevelopers; a merge to 7.0.x does not close it, so it is closed by hand once the merge-ups land).

The reporter's cause: the domain classes that s2-create-acl-domains copies into an application come from templates, and the templates did not have what the plugin's own domain classes have. AclObjectIdentity had no @EqualsAndHashCode(includes = 'objectId', callSuper = true), so a generated copy compared equal to another with a different objectId: the equality of its base class (AbstractAclObjectIdentity) covers only the class, the parent, the owner and entriesInheriting. The ACL services look ACLs up by that equality, so after a restart a list of more than one object could fail with NotFoundException: Unable to find ACL information for object identity. The other three templates had the same gap: no @EqualsAndHashCode, and none of the four implemented Serializable.

Change: the four templates declare the same @EqualsAndHashCode includes, Serializable and serialVersionUID as the domain classes of the plugin (className; sid and principal; identity, order, sid, mask, granting and the audit flags; objectId with callSuper). Their own toString is kept. s2-create-acl-domains does not overwrite a class that already exists, so the page of the script in the guide now says what to add to a copy generated earlier.

Test: a new GeneratedAclDomainsSpec (the module had no unit tests; it uses the testing support the module already declares) renders each real template, compiles it under another name and checks equality, hashCode and Serializable, including that two identities with different objectId are not equal. All four fail without the change, as run in the repo; with it they pass. CodeNarc and rat are clean. CI is off (no ci).

Not covered: a running application with a generated copy; the spec checks the classes the templates produce, not the script's rendering.

Two of the three reviewers (matrei, codeconsole, jdaugherty), as 7.0.x is released.

https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL

…s compare and serialize as the plugin's

The templates of AclClass, AclSid, AclEntry and AclObjectIdentity had no @EqualsAndHashCode and did not implement
Serializable, unlike the plugin's own domain classes. A generated copy compared by identity, and a generated
AclObjectIdentity compared equal to another with a different objectId, because the equality of its base class ignores
objectId. The ACL services look ACLs up by that equality, so an object whose ACL exists failed with a NotFoundException.

The templates now declare the same equality and serialVersionUID as the domain classes. GeneratedAclDomainsSpec renders each
template, compiles it and checks equality, hashCode and Serializable. The script does not overwrite an existing class, so
the documentation of s2-create-acl-domains says what to add to a copy generated earlier.

Fixes #15927

Claude-Session: https://claude.ai/code/session_01Dmki4RzWwreEC2GkkyFnvL
Copilot AI balanced review requested due to automatic review settings November 13, 2026 03:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@jamesfredley jamesfredley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The generated classes compare and serialize the same way as the plugin's classes. Existing plugin classes are unchanged.

@testlens-app

testlens-app Bot commented Nov 16, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: c49d2e5
▶️ Tests: 49805 executed
⚪️ Checks: 91/91 completed


Learn more about TestLens at testlens.app/docs.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants