Automated reopen: keep recurrence_noted when the workflow has no Closed -> Open (#126) #131

Merged
jared merged 1 commits from auto-reopen-no-transition into development 2026-11-28 23:23:31 -05:00
Owner

Closes #126.

Background

#128 (on prod since #129) handled most of #126. Automated reports now reopen a ticket closed inside AUTO_REOPEN_WINDOW_DAYS, even though prod's Workflow Designer requires admin + comment for Closed -> Open. But #128 also removed recurrence_noted entirely. The decision comment keeps one case: a workflow with no Closed -> Open transition at all is a deliberate "never reopen" setup.

Change

  • Closed -> Open exists, whatever it requires: reopen to Open (reopened). Same as #128. People still need what the workflow says.
  • No Closed -> Open transition: the ticket stays Closed and the response is recurrence_noted. No notification is sent.
    • Reports run hourly, and this path is what posted 2,110 "could not be reopened" comments before #123. So it now leaves one note per closed period; later reports while the ticket stays Closed only write the audit row.
    • The audit row still feeds the recurrence counts in the history comment.
    • Two concurrent reports can't both post the note: lockByHash holds the ticket row FOR UPDATE.
  • The helpers are AutoTicketService::reopenConfigured() and recurrenceNotedSince(). The README documents the rule and the recurrence_noted action again.

Prod is unchanged: it has an active Closed -> Open (admin + comment), so reports inside the window keep reopening.

Tests

The end-to-end script from #124 was run against a local stack with a throwaway DB and synthetic data, in three workflow configurations:

Mode Closed -> Open Result
prod admin + comment (as on prod) 43/43 pass, inside the window -> reopened, audit row says the workflow was skipped
open no requirements 43/43 pass, reopened
none no transition 46/46 pass: recurrence_noted, stays Closed, one note, the second report adds no note, both reports audited, history counts include the noted reports

phpcs (.phpcs.xml) is clean. The dev server logged no PHP warnings.

🤖 Generated with Claude Code

Closes #126. ## Background #128 (on prod since #129) handled most of #126. Automated reports now reopen a ticket closed inside `AUTO_REOPEN_WINDOW_DAYS`, even though prod's Workflow Designer requires admin + comment for Closed -> Open. But #128 also removed `recurrence_noted` entirely. The [decision comment](https://code.lotusguild.org/LotusGuild/tinker_tickets/issues/126#issuecomment-7196) keeps one case: a workflow with **no** Closed -> Open transition at all is a deliberate "never reopen" setup. ## Change - **Closed -> Open exists, whatever it requires:** reopen to Open (`reopened`). Same as #128. People still need what the workflow says. - **No Closed -> Open transition:** the ticket stays Closed and the response is `recurrence_noted`. No notification is sent. - Reports run hourly, and this path is what posted 2,110 "could not be reopened" comments before #123. So it now leaves **one note per closed period**; later reports while the ticket stays Closed only write the audit row. - The audit row still feeds the recurrence counts in the history comment. - Two concurrent reports can't both post the note: `lockByHash` holds the ticket row `FOR UPDATE`. - The helpers are `AutoTicketService::reopenConfigured()` and `recurrenceNotedSince()`. The README documents the rule and the `recurrence_noted` action again. **Prod is unchanged:** it has an active Closed -> Open (admin + comment), so reports inside the window keep reopening. ## Tests The end-to-end script from #124 was run against a local stack with a throwaway DB and synthetic data, in three workflow configurations: | Mode | Closed -> Open | Result | |---|---|---| | `prod` | admin + comment (as on prod) | 43/43 pass, inside the window -> `reopened`, audit row says the workflow was skipped | | `open` | no requirements | 43/43 pass, `reopened` | | `none` | no transition | 46/46 pass: `recurrence_noted`, stays Closed, one note, the second report adds no note, both reports audited, history counts include the noted reports | phpcs (`.phpcs.xml`) is clean. The dev server logged no PHP warnings. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jared added 1 commit 2026-11-28 23:20:42 -05:00
Automated reopen: keep recurrence_noted when the workflow has no Closed -> Open (#126)
Lint / JS (eslint) (push) Successful in 23s
Lint / PHP (phpcs PSR-12) (push) Successful in 42s
Lint / PHP requirements (version + extensions) (push) Successful in 36s
Lint / Deploy (push) Skipped
Lint / Notify on failure (push) Skipped
Lint / PHP (phpcs PSR-12) (pull_request) Successful in 34s
Lint / JS (eslint) (pull_request) Successful in 15s
Lint / PHP requirements (version + extensions) (pull_request) Successful in 1m2s
Lint / Deploy (pull_request) Skipped
Lint / Notify on failure (pull_request) Skipped
Security / PHP Security (semgrep) (push) Successful in 2m15s
Security / PHP Security (semgrep) (pull_request) Successful in 1m55s
6133cbacc9
#128 made automated reports reopen a ticket closed inside the reopen
window regardless of the Workflow Designer's admin/comment requirements,
and dropped recurrence_noted entirely. The #126 decision keeps one case:
a workflow with no Closed -> Open transition at all is a deliberate
"never reopen" setup, so the ticket stays Closed and the response is
recurrence_noted.

That path is what posted 2,110 "could not be reopened" comments before
#123, so it now leaves one note per closed period; later reports while
the ticket stays Closed only write the audit row (which still feeds the
recurrence counts). No notification is sent when nothing reopened.

Prod has an active Closed -> Open (admin + comment), so prod behaviour
is unchanged: reports inside the window reopen.

Closes #126

Co-Authored-By: Claude Opus 5.5 <[email protected]>
jared scheduled this pull request to auto merge when all checks succeed 2026-11-28 23:22:46 -05:00
jared merged commit 8168f70f3d into development 2026-11-28 23:23:31 -05:00
jared deleted branch auto-reopen-no-transition 2026-11-28 23:23:32 -05:00
Sign in to join this conversation.