Skip to content

STOP-457: Automatic BenID download for StopTB laptops - #200

Merged
vishwab1 merged 3 commits into
release-3.12.0from
vb/3.12.0-stop457-benid
Oct 14, 2026
Merged

vishwab1 merged 3 commits into
release-3.12.0from
vb/3.12.0-stop457-benid

Conversation

@vishwab1

Copy link
Copy Markdown
Member

📋 Description

JIRA ID:

Please provide a summary of the change and the motivation behind it. Include relevant context and details.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.

vishwab1 and others added 2 commits October 14, 2026 14:20
The laptop now downloads BeneficiaryIDs from central by itself, so StopTB
registration no longer depends on someone clicking "Generate BenID".

- CentralAuthService: after the operator's normal login, signs in to central
  once as an API client and keeps only the refresh token (AES-GCM encrypted,
  key tied to this machine, file 600 under /opt/amrit/data). Each run uses
  refreshToken -> JWT -> getLoginResponse to get a central session key. No
  password is stored; a password central rejected is never sent again.
- BenIdAutoTopUpService: pool 0 -> 10000, below 2000 -> 1000. IDs received
  from central are written to a pending file before the local import, so a
  failed import is retried with the same IDs. Retries 5/15/30/60 min; one
  lock shared with the manual "Generate BenID" button.
- /centralAuth/status and /centralAuth/capture for MMU-UI.
- Top-up check also runs after a successful van-to-server upload and master
  download.
- Only active when stoptb.enforce.vanid=true and stoptb.van.id>0; every
  setting has a default, so other deployments need no config change.

No change on central (Common-API / BenGen).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Ask central for at most 1000 IDs per request (benid.pool.maxPerRequest):
  a 10000-ID request can outlast the central gateway timeout, and every
  retry after a lost reply reserved another 10000 unused IDs.
- Remember a central-rejected laptop password across restarts (marker file
  with the user name only), so daily restarts cannot slowly lock the
  central account; a successful Data Sync reconnect clears it.
- Write the pending-import file atomically (temp + move); a pending file
  that still fails after 3 tries is set aside so top-ups never get stuck.
- Spread retry waits by +/-20% so laptops do not all hit central at once
  after an outage.
- Run background work on the feature's own single thread instead of the
  shared ForkJoin pool.

Tests: 26 unit tests pass; checked in the running app (2500 IDs arrived as
1000+1000+500; rejected login not resent after restart).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eb09c0d0-5b0b-47ed-82a8-1fa5a4d1175a
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vishwab1
vishwab1 merged commit d1a0ca9 into release-3.12.0 Oct 14, 2026
2 of 3 checks passed
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants