Review: feat: add Postgres trigger to bump projects.updated_at

review-1344-2026-06-06-v2 Review

review ready

Verdict: READY

Template Completeness

  • [x] Type -- Feature
  • [x] Lineage -- Standalone, discovered during project sort debugging
  • [x] Repo -- ldraney/paldocs
  • [x] User Story -- present and well-formed
  • [x] Context -- thorough, explains DDL ownership change
  • [x] File Targets -- 3 modify/create targets, 1 do-not-touch target
  • [x] Acceptance Criteria -- 9 criteria
  • [x] Test Expectations -- 4 manual tests + 1 run command
  • [x] Constraints -- 5 constraints including shared DB safety
  • [x] Checklist -- present
  • [x] Related -- 4 references including arch note and story note

Traceability

  • [x] story:project-pages label -- present on board item
  • [x] story note verified -- story-paldocs-project-pages exists in pal-e-docs, references issue #13 in its scope list
  • [x] arch:rails-db label -- present on board item
  • [x] arch note verified -- arch-rails-db exists in pal-e-docs, documents DDL ownership conventions
  • [x] Forgejo issue -- ldraney/paldocs#13, open
Minor note: The project-paldocs user-stories section still says "No user-story notes created yet" despite story-paldocs-project-pages existing. This is a housekeeping item, not a blocker for this ticket.

File Targets

  • [x] db/migrate/YYYYMMDD_add_project_activity_trigger.rb -- NEW FILE. The db/migrate/ directory does not yet exist (only db/seeds.rb present). Agent will need to create the directory. Consistent with the DDL ownership change described in the ticket.
  • [x] bin/docker-entrypoint -- verified exists. Currently skips migrations with comment "Shared database -- Rails does not manage migrations." Agent must update to run db:migrate before exec.
  • [x] docs/data-model.md -- verified exists. Currently states "No db/schema.rb or db/migrate/ in this repo" in the Shared Database section. Agent must update to document the trigger and DDL ownership change.
  • [x] app/controllers/projects_controller.rb -- verified DO NOT TOUCH. Sort query Project.order(updated_at: :desc) is already correct on line 3.

Repo Placement

OK. Issue filed on ldraney/paldocs, all file targets are in ldraney/paldocs. Single-repo change.

Dependencies

  • #14 (infra spike) -- referenced in Related as documenting the entrypoint pattern. Currently in_progress on the board. This ticket modifies bin/docker-entrypoint to add db:migrate. If #14 also modifies the entrypoint, there could be a merge conflict, but both changes are additive. Not a hard blocker -- the changes are compatible.
  • #12 (render project page note content) -- sibling ticket in story:project-pages, currently in next_up. No code overlap.

Acceptance Criteria

All 9 criteria are testable. The migration reversibility criterion is verifiable with bin/rails db:migrate:down. The manual tests are clear. The "Python pal-e-docs layer is unaffected" criterion is verifiable by writing a note via MCP after deploy.
One note: "Projects index sorts by actual activity after deploy" is an integration criterion that depends on the trigger actually firing in production. This is reasonable for a 3-point ticket.

Blast Radius

Low. The trigger is DB-level and transparent to both Rails and Python. The only controller using updated_at sort is ProjectsController#index. No other models or controllers reference project ordering. The trigger fires only on notes table INSERT/UPDATE, which is the primary write path from pal-e-docs.
No similar "stale updated_at" pattern found in other models -- this is specific to the projects/notes parent-child relationship.

Decomposition Assessment

3 file targets in 1 repo, 9 acceptance criteria. The criteria count is above 5 but the work is tightly scoped -- one migration file, one entrypoint line, one doc update. Estimated agent time: 3-4 minutes. No decomposition needed.

Recommendation

No action needed. Ticket is well-scoped and ready for implementation.