dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
865 stars 467 forks source link

UVE: Investigate `fireRule` query param in Page API #29849

Closed fmontes closed 2 weeks ago

fmontes commented 2 months ago

Task description

As a dotCMS developer, I need to research how the ⁠fireRule query param works in the Page API because it is not functioning as expected. This will help me determine if there is a bug in the system or if there is a misunderstanding on how to use this parameter effectively.

The ⁠fireRule query params enable dotCMS implementers to render personalized pages in their headless web apps, providing a customized user experience based on page rules.

https://github.com/user-attachments/assets/9dedbfa2-3f93-4f3f-b0b3-4062ad6a7595

Acceptance Criteria

External Links

Assumptions & Initiation Needs

Quality Assurance Notes & Workarounds

N/A

valentinogiardino commented 2 weeks ago

Research work

After thoroughly reviewing the documentation, debugging the code, and testing various scenarios, I have concluded that the fireRule query parameter is functioning as expected, despite some documentation discrepancies and potential misunderstandings on my part. I have documented my findings in detail in this document.

Regarding the Behavior in the Ticket Video

The issue shown in the ticket video occurs because the user is running dotCMS on a local instance without a public IP address. In this setup, the method to retrieve the user's location or country based on their IP address fails, preventing the rule condition from being met, which stops the associated action from firing.

As outlined in the investigation report, It's also important to note that the Persona assignment action sets the persona in the visitor's session. This explains why, if we call the Page API twice in succession—once with fireRules=true and once without—it returns the same persona in both cases, reflecting the last persona that was set.

Video

https://github.com/user-attachments/assets/df587b90-fe2f-4c9b-8a01-9cc1ecfd3ce6