Repository navigation
fix(strr-api+strr-examiner-web): count provisionally approved renewals as approved, and keep older ones in Review Renew (REGBACKLOG-391) - #1969
Conversation
…he 409 check and /todos (REGBACKLOG-391) A renewal in PROVISIONAL_REVIEW, or in one of its NOC statuses, has already extended the registration, but the 409 check treated it as in progress. It refused the host's next renewal with RENEWAL_ALREADY_IN_PROGRESS, whenever that one was submitted, while /todos still offered Renew. - Add RENEWAL_APPROVED_STATES (including the provisional statuses), RENEWAL_DECLINED_STATES and RENEWAL_FINISHED_STATES; the 409 check now refuses a new renewal only while another is in neither list - /todos hides Renew while a renewal is in progress, whenever it was submitted, matching the 409 check, or once a renewal submitted in this window is approved, provisionally or in full - Bump strr-api to 0.3.50
There was a problem hiding this comment.
🟡 Changes recommended
A new renewal draft or auto-approved renewal can hide an older unresolved provisional renewal from the examiner’s review queue; the queue query needs correction and regression coverage.
1 open issue
What changed in this PR
Updates renewal eligibility so provisional approvals no longer block the next renewal cycle, aligning /todos with the API conflict check.
Changes:
- Shares approved, declined, and finished renewal status lists.
- Updates conflict checks and todo visibility, with regression tests.
- Bumps
strr-apito 0.3.50.
| File | Description |
|---|---|
strr-api/tests/unit/resources/test_renewal_window_api.py |
Tests conflicts across renewal statuses. |
strr-api/tests/unit/resources/test_renewal_todos_api.py |
Expands status and window coverage. |
strr-api/tests/unit/resources/test_registrations.py |
Uses an approved prior-year renewal. |
strr-api/src/strr_api/services/application_service.py |
Defines shared renewal status lists. |
strr-api/src/strr_api/resources/registrations.py |
Updates Renew todo visibility. |
strr-api/src/strr_api/resources/application.py |
Allows renewals after provisional approval. |
strr-api/src/strr_api/models/application.py |
Updates conflict-query parameter terminology. |
strr-api/pyproject.toml |
Bumps API version to 0.3.50. |
Review effort: Balanced
| finished_status_values = tuple(s.value for s in RENEWAL_FINISHED_STATES) | ||
| conflicting = ApplicationModel.find_non_terminal_renewal_for_payment_account( | ||
| account_id, registration_id, terminal_status_values | ||
| account_id, registration_id, finished_status_values |
There was a problem hiding this comment.
You're right. Now that a provisionally approved renewal no longer blocks the next one, the newer renewal became the "latest application", and the queue only looked at that one.
_review_renew_condition now matches a registration with no registration-level decider when any of its renewals is in PROVISIONAL_REVIEW or PROVISIONALLY_APPROVED with no decider, so an older renewal awaiting review stays in the queue whatever is filed after it.
I added test_search_registrations_review_renew_keeps_older_provisional_renewal_after_newer_renewal, which covers a newer DRAFT and a newer AUTO_APPROVED renewal; it fails on the old query and passes now.
Fixed in new commit.
I've created this ticket for that: https://hous-hpb.atlassian.net/browse/REGBACKLOG-501 |
…ue (REGBACKLOG-391) Now that a provisionally approved renewal no longer blocks the next one, a newer renewal (even a draft) became the registration's latest application and hid the older renewal from reviewRenew=true. The queue now matches a registration with no registration-level decider when any of its renewals is in PROVISIONAL_REVIEW or PROVISIONALLY_APPROVED with no decider. Adds a regression test for an older provisional renewal followed by a newer DRAFT or AUTO_APPROVED renewal.
Jacky-Pham
left a comment
There was a problem hiding this comment.
Can we keep Review Renew on the Examiner row when an older renewal is pending review and a newer one is approved?
Yes, that makes sense, but the case is rare. The rule that only one renewal can be open at a time is no longer strict. With this PR, a renewal in PROVISIONAL_REVIEW counts as finished, so it doesn't block the next renewal. What stops the next renewal now is the renewal window. Here's how two renewals can exist side by side:
Even so, the dashboard should match the filter. Otherwise, a row that the "Review Renew" filter returns would be labelled "Approved", or carry a draft's label. But this raises a question: If an older provisional renewal is still unreviewed when the next cycle starts, should it stay in the review queue at all? If no then both the filter and the label should drop it. I ran a query in Prod. Your case isn't theoretical. About 95 registrations show it today. They aren't caused by a year-long review backlog, though. They're caused by unfinished renewals left on top of the one awaiting review. However, https://hous-hpb.atlassian.net/browse/REGBACKLOG-494 will delete the duplicate draft renewals and https://hous-hpb.atlassian.net/browse/REGBACKLOG-495 will clean up early payment-due renewals with unpaid invoices. |
What do you guys think? I'll commit a change to make the row label match the filter that's already on this PR. If we decide to "drop it" instead then the API filter and the label would need to be changes in a follow-up commit. |
… review (REGBACKLOG-391) The dashboard row showed Review Renew only when the latest application was a renewal in the provisional review queue. Now that a provisionally approved renewal doesn't block the next one, a newer renewal (draft, unpaid, or approved) hid an older one still awaiting review, so the row was labelled Approved or "-" even though the reviewRenew filter returned it. - isReviewRenew now uses the same rule as the API's reviewRenew filter: no registration-level decider, and any renewal in PROVISIONAL_REVIEW or PROVISIONALLY_APPROVED with no decider. The Renewal badge follows it. - strr-examiner-web goes to 0.2.75.
| return false | ||
| } | ||
| const applications = reg.header?.applications ?? [] | ||
| return applications.some(app => |
There was a problem hiding this comment.
can we make the Approved filter match the row label? when an older renewal still needs review and a newer one is auto-approved, the row says Review Renew in the Approved filter.
There was a problem hiding this comment.
Yes! The row label is right: once an older renewal is still awaiting review, the row should stay in Review Renew. So I fixed the filter instead. The Approved filter now leaves out registrations that Review Renew picks up. That covers your case and one more: a newer provisional renewal where the examiner decision is only on the application. While I was there, I also made Review + Approved selected together return exactly what the two filters return separately. Before, it matched on the latest application's status alone, so labels could disagree there too. Tests now check each filter for the case where an older renewal is still awaiting review and a newer one exists.
See new commit.
…s submitted (REGBACKLOG-391) The 409 RENEWAL_ALREADY_IN_PROGRESS check ran only when a renewal was started, so submitting an existing draft created an invoice even while another renewal was in progress. That's how H353013514 paid for two renewals on 2026-06-14, from drafts started before the check went live. In Production, 52 registrations still have a renewal draft beside another unfinished renewal. - The check now also runs when a renewal draft is submitted. Saving a draft still isn't checked, since that creates no invoice. - find_non_terminal_renewal_for_payment_account takes an optional exclude_application_id, so the draft being submitted isn't its own conflict. - Adds test_draft_is_submitted_only_while_no_other_renewal_is_in_progress. Addresses review feedback on bcgov#1964.
@Jacky-Pham ^^^ in response to your comment on #1964. |
…BACKLOG-391) - The Approved filter now leaves out registrations that the Review Renew filter returns, so a row labelled Review Renew (an older renewal awaiting review, with a newer auto/full-review approved or application-decided renewal) no longer shows under Approved. - Review and Approved selected together now return exactly the union of the two filters, instead of matching on the latest application's status alone. - The Review Renew subquery is joined once and shared by both filters.
|




Issue:
Description of changes:
When a renewal is auto-approved provisionally (PROVISIONAL_REVIEW, "Approved – Provisional"), the registration's expiry is extended at once, while the renewal waits for an examiner. The 409 check counted that renewal as still in progress, and it doesn't filter by date. So in the host's next renewal window,
/todosoffered Renew but submitting it returned 409RENEWAL_ALREADY_IN_PROGRESS. In Production, about 12,100 registrations have a latest renewal in PROVISIONAL_REVIEW. Their next windows open from December 2026.This PR also addresses the Copilot comment on #1964:
/todosand the 409 check now use the same rule. It also addresses Jacky's comment on #1964 (#1964 (comment)): the 409 check now also runs when a renewal draft is submitted.application_service.py:RENEWAL_APPROVED_STATES: FULL_REVIEW_APPROVED, PROVISIONALLY_APPROVED, AUTO_APPROVED, PROVISIONAL_REVIEW, PROVISIONAL_REVIEW_NOC_PENDING, PROVISIONAL_REVIEW_NOC_EXPIREDRENEWAL_DECLINED_STATES: DECLINED, PROVISIONALLY_DECLINEDRENEWAL_FINISHED_STATES: both of the abovefind_non_terminal_renewal_for_payment_accounttakes an optionalexclude_application_id, so the draft being submitted isn't its own conflict. In Production, 52 registrations have a renewal draft beside another unfinished renewal on the same account (38 beside PAYMENT_DUE, 14 beside another DRAFT), all from before the check went live on 2026-06-01./todos: Renew is hidden while a renewal is in progress, whenever it was submitted, matching the 409 check. It's also hidden once a renewal submitted in the current window is approved, provisionally or in full. Declined renewals never hide it._review_renew_conditionnow matches a registration with no registration-level decider when any of its renewals is in PROVISIONAL_REVIEW or PROVISIONALLY_APPROVED with no decider. In Production, 102 registrations have an undecided provisional renewal with a newer application after it; in 95 of them the newer one is a leftover DRAFT or PAYMENT_DUE renewal, which REGBACKLOG-494 and REGBACKLOG-495 remove.isReviewRenewindashboard.vuenow uses the same rule as the filter, so a row the filter returns is labelled Review Renew instead of Approved or "-". The Renewal badge follows it.Notes for reviewers:
/todos.hasRenewalApplicationindashboard.vue, which this PR removes. Whichever PR merges second should keep this PR'sisReviewRenew.mainwithout it. Before this PR, AUTO_APPROVED already counted as finished, and in Production H564079612 renewed again 10 seconds after its first renewal was auto-approved, paying twice. This PR makes PROVISIONAL_REVIEW count as finished too, which would widen that gap. The renewal window closes it: once a renewal is approved, the expiry moves a year on, so a new renewal getsRENEWAL_WINDOW_NOT_OPEN.How this was tested:
test_draft_is_submitted_only_while_no_other_renewal_is_in_progresschecks that saving a draft always works, and that submitting it gets a 409, with no invoice and the draft left as a DRAFT, only while another renewal is in progress. Its three conflict cases fail without the fix./todostests now include the provisional and NOC statuses.test_get_todos_with_submitted_renewal_recent_and_oldnow uses an approved renewal from last year. A PAID one is still in progress, so it correctly hides Renew.test_search_registrations_review_renew_keeps_older_provisional_renewal_after_newer_renewalcovers an older provisional renewal followed by a newer DRAFT or AUTO_APPROVED renewal. It fails on the old query and passes now.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the BC Registry and Digital Services BSD 3-Clause License