2026-10-15-anonymous-activity-detail.md 3.9 KB

Anonymous Activity Detail Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Allow anonymous users to enter and browse mini-program activity details, requiring login only when they invoke identity-dependent actions.

Architecture: The backend detail endpoint accepts an optional user and the service treats a missing user as anonymous. The mini-program removes entry-time gates and uses one reusable action guard for detail interactions.

Tech Stack: Java 8, Spring MVC, MyBatis, JUnit 4, Vue 3/uni-app, Node test runner

Spec: docs/superpowers/specs/2026-10-15-anonymous-activity-detail-design.md

Global Constraints

  • Anonymous users must be able to load, scroll, expand, and leave activity details without a login prompt.
  • Identity-dependent actions must stop and open the existing login flow when no valid session exists.
  • Existing authenticated permissions and write-operation authentication remain unchanged.

Review Focus

  • Missing token: detail data loads and no automatic login modal opens.
  • Expired local session: action guard treats it as logged out even if a stale token exists.
  • Valid token: action executes without an extra prompt.
  • Anonymous detail SQL: null user ID does not accidentally match signup rows.
  • Login completion: detail is refreshed to show the signed-in user's state.

Task 1: Anonymous backend activity details

Files:

  • Modify: ../happytree/happytree-app/src/main/java/com/ringzle/controller/core/AppActivityController.java
  • Modify: ../happytree/happytree-sys/src/main/java/com/ringzle/modules/core/service/impl/ActivityServiceImpl.java
  • Test: ../happytree/happytree-sys/src/test/java/com/ringzle/modules/core/service/impl/ActivityServiceAnonymousDetailTest.java

Interfaces:

  • Consumes: optional AppUserEntity user from the existing argument resolver.
  • Produces: ActivityService.getAppInfoById(Long, AppUserEntity) supports user == null.

  • [ ] Write service tests proving anonymous lookup passes null user ID and skips user-specific permission queries, while authenticated lookup retains permission checks.

  • [ ] Run the targeted tests and verify the anonymous case fails with a null dereference.

  • [ ] Remove the controller's mandatory-login annotation and make the service null-safe.

  • [ ] Run the targeted test and full happytree-sys suite in Docker Maven.

  • [ ] Commit the backend change.

Task 2: Anonymous mini-program browsing and guarded actions

Files:

  • Create: common/utils/auth-session.js
  • Modify: components/pages/nonprofitActivety/index.vue
  • Modify: pagesHome/activityDetail.vue
  • Test: tests/activity-detail-login-gate.test.js

Interfaces:

  • Consumes: hasValidSession() based on token and expiration storage.
  • Produces: activity-card navigation without login and requireLogin(action) for identity-dependent detail interactions.

  • [ ] Write behavior tests for anonymous card navigation, passive detail loading, guarded actions, expired sessions, valid sessions, and post-login refresh.

  • [ ] Run the new test and verify it fails for the existing entry-time gates.

  • [ ] Implement the session helper, remove entry-time prompts, and wrap identity-dependent actions with the reusable guard.

  • [ ] Run the new test and all mini-program Node tests.

  • [ ] Commit the mini-program change.

Task 3: Cross-repository verification

Files:

  • Verify only; no planned production changes.

Interfaces:

  • Consumes: anonymous backend details and guarded mini-program actions from Tasks 1 and 2.
  • Produces: verified build/test evidence for handoff.

  • [ ] Compile the backend app module with Docker Maven and run all backend tests.

  • [ ] Run all mini-program Node tests and inspect both repository diffs.

  • [ ] Record any deviations and complete final review.