Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

fix: resolve gate-3 stub-scan (implement BerichtenboxReadStatusJob.run())#630

Merged
rubenvdlinde merged 1 commit into
developmentfrom
fix/gate3-stub
May 26, 2026
Merged

fix: resolve gate-3 stub-scan (implement BerichtenboxReadStatusJob.run())#630
rubenvdlinde merged 1 commit into
developmentfrom
fix/gate3-stub

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What the stub was

BerichtenboxReadStatusJob::run() was an empty stub: it logged one info line and contained only a comment saying "The actual polling happens in BerichtenboxService::pollReadStatus / This job would iterate unread messages and poll each one." The service was injected in the constructor but never called from run(). Gate-3 flagged it as a stub because there were < 2 non-logger statements in the body.

The job is registered in appinfo/info.xml's <background-jobs> section, so it runs daily in production — doing nothing.

Fix decision: implement with real bulk polling

The job's intent was clear from the comment and from BerichtenboxService::pollReadStatus() (already implemented, used by the controller endpoint). The background job should poll ALL pending messages, not just individual ones.

Changes:

  • lib/Service/BerichtenboxService.php — added getPendingMessages(): fetches all messages with status 'sent' or 'unread_flagged' that may need a read-status update (matching the statuses set by pollReadStatus())
  • lib/BackgroundJob/BerichtenboxReadStatusJob.php:
    • Added IAppManager injection (openregister availability guard — same pattern as AdviceDeadlineJob)
    • Implemented run(): guard check → getPendingMessages() → loop calling pollReadStatus() per message → summary log

Gate-3 result

[gate-3] stub-scan: PASS

…un()

run() was an empty stub containing only a log line and a comment. The job injected
BerichtenboxService but never called it. Added:
- IAppManager guard (skip if openregister not installed)
- BerichtenboxService::getPendingMessages() method that fetches all 'sent' and
  'unread_flagged' messages from OpenRegister
- Loop in run() that calls pollReadStatus() for each pending message, updating
  status to 'read' / 'unread_flagged' via the existing service logic
@rubenvdlinde rubenvdlinde merged commit 6ad95b8 into development May 26, 2026
@rubenvdlinde rubenvdlinde deleted the fix/gate3-stub branch May 26, 2026 19:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant