Feature #60
openFeature #33: Canofy Control Centre Backend Development
Feature #46: Canofy Control Centre Onboarding Process
# [CANOFY-114] Register Site on OCR Server
0%
Description
[CANOFY-114] Register Site on OCR Server¶
Type: Story
Epic: New Client Onboarding — Automated AWS + Frappe Provisioning
Stage key: ocr_register (pipeline stage 14 of 15)
Component: utils/ocr_config_manager.py, utils/onboarding_executor.py
User Story¶
As an operations engineer,
I want the new client's site automatically registered in the shared
OCR server's config files,
so that the OCR pipeline recognizes and processes documents for this
client without a manual config file edit on the OCR server.
Description¶
Call ocr_config_manager.register_site_on_ocr(site_name, client_code),
which:
- Updates
property.jsonon the shared OCR server (adds
{site_name: {client_code}}). - Updates
sites.jsonon the client's own server (addssite_nameto the
list). - Appends a row to
OCR Server Config.registered_sites. - Sets
Client Site.ocr_registered = 1.
This stage is explicitly best-effort / non-fatal — unlike stage 7
(ocr_policy_update, IAM), a failure here must not fail the whole
onboarding run, since OCR registration can be corrected after the fact
without re-provisioning anything. The failure must still be clearly logged
so it isn't silently missed.
Configuration / Prerequisites¶
-
OCR Server Configsingleton populated (ocr_server,
property_json_path,sites_json_path) — if this is unset, the stage
should log a clear "OCR not configured, skipping" message and continue,
not throw an unhandled exception. - Depends on stage 10 (site exists) and stage 5 (client_code known).
Acceptance Criteria¶
-
property.jsonon the OCR server gains an entry for this site/client,
with every previously-registered site's entry left untouched. -
sites.jsonon the client's own server gains this site. -
A failure at any point in this stage (OCR server unreachable, config
file malformed, etc.) is caught, logged, and does NOT change
Onboarding Request.onboarding_statustoFailed— the pipeline
proceeds to the next stage. -
Client Site.ocr_registeredis only set to1on actual success, not
when the stage is skipped/failed.
Test Cases¶
| ID | Scenario | Steps | Expected Result |
|---|---|---|---|
| TC-1 | Happy path | Run stage with valid OCR config | Both config files updated; Client Site.ocr_registered = 1
|
| TC-2 | No regression to existing registrations | Diff property.json/sites.json before/after |
All previously-registered clients/sites remain present |
| TC-3 | OCR not configured |
OCR Server Config.ocr_server unset |
Stage logs "skipped, not configured" and the pipeline continues to stage 15 without failing |
| TC-4 | OCR server unreachable | Simulate an SSM failure against the OCR server | Stage logs the failure with detail; pipeline still continues; ocr_registered stays 0
|
| TC-5 | Idempotent re-run | Run stage twice for the same site |
sites.json/property.json don't end up with duplicate entries |
No data to display