Skip to content

Rebase master - #1408

Merged
vinothrallapalli-eGov merged 2 commits into
2.12from
master
Aug 20, 2026
Merged

Rebase master#1408
vinothrallapalli-eGov merged 2 commits into
2.12from
master

Conversation

@vinothrallapalli-eGov

Copy link
Copy Markdown
Collaborator

No description provided.

vinothrallapalli-eGov and others added 2 commits August 20, 2026 12:49
* Add count API to mdms-v2 service reusing search criteria models

Adds POST /v2/_count, taking the same MdmsCriteriaReqV2/MdmsCriteriaV2
request models as /v2/_search. Refactors MdmsDataQueryBuilderV2 to
share its WHERE-clause building between the search and count queries,
and unifies the tenant-fallback resolution used by search() and
count() so both agree on the same tenant tier for identical criteria.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Use Long for mdms-v2 count contract to match PostgreSQL BIGINT

COUNT(*) returns bigint in Postgres; mapping it to Integer would throw
on counts above 2,147,483,647. Addresses CodeRabbit review comment on
PR #1405.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Document the mdms-v2 count API in README and add a Swagger contract

Adds core-services/docs/mdms-v2-contract.yml covering _search, _count,
_create and _update for the mdms-v2 service, and extends the module
README with a "MDMS V2 API Details" section describing each endpoint,
emphasizing that /_count reuses the exact same MdmsCriteriaReqV2
request contract and tenant-fallback resolution as /_search.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add missing schema-definition APIs to mdms-v2 contract

The contract only covered the master-data endpoints on MDMSControllerV2.
Adds /schema/v1/_create, _search and _update (SchemaDefinitionController)
with their SchemaDefinition/SchemaDefCriteria models, and updates the
README pointer to mention them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Fix uniqueIdentifiers constraint and clarify MdmsCriteria requiredness

@SiZe(min=1, max=64) on MdmsCriteriaV2.uniqueIdentifiers constrains the
Set's element count, not each string's length - the contract had this
backwards (minLength/maxLength on items instead of minItems/maxItems
on the array). Also documents that MdmsCriteriaReqV2.MdmsCriteria is
functionally required but not enforced by bean validation.

Found via an adversarial verification pass cross-checking the contract
against the mdms-v2 model classes field-by-field.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add DB UML diagram for mdms-v2 to README

Adds a Mermaid ER diagram covering eg_mdms_schema_definition and
eg_mdms_data, derived from the Flyway migrations under
src/main/resources/db/migration/main/ and cross-checked against the
live schema in the local stack. Notes that there is no enforced FK
between the two tables - schemacode/code linkage is validated at the
application layer only.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Address CodeRabbit findings: declare JSON media type, fix heading levels

- mdms-v2-contract.yml: add root-level consumes/produces: application/json,
  since all POST operations use body parameters and JSON response schemas.
- README.md: fix "##### Method" (H5) to "#### Method" (H4) under both the
  v1 and v2 API Details sections (H3), keeping the heading outline valid.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…1401)

* fix(egov-user): resolve countryCode from MDMS default entry, not just properties fallback

MobileNumberValidator previously echoed back the incoming countryCode as-is,
falling to the application.properties default only when the caller omitted
it entirely. When MDMS resolves a rule via its own "default" entry (no
incoming countryCode, or no exact match), that entry's countryCode should
win over the properties fallback since MDMS is authoritative whenever it
has an answer.

Introduces MobileValidationRule (regex + countryCode) so the cache and MDMS
resolution paths carry both fields together instead of a bare regex string.

* fix(user-otp): propagate MDMS-resolved countryCode back onto OtpRequest

OtpRequestValidator resolved a MobileValidationConfig (including that
entry's own countryCode) but never wrote it back onto the OtpRequest.
OtpSMSRepository.send() forwards otpRequest.getCountryCode() as-is into
the Kafka SMSRequest, so a request that omits countryCode reached
egov-notification-sms with countryCode still null — which then fell back
to its own static sms.mobile.prefix instead of the MDMS default, the same
properties-wins-over-MDMS bug just fixed in egov-user.

Backfill the countryCode from the resolved config (cache hit or fresh MDMS
fetch) whenever the caller didn't supply one, so the SMS request carries
the country code MDMS is actually configured for.

* fix: address code review findings on countryCode/regex resolution

egov-user:
- Replace the ad-hoc U+0001-separated cache value encoding with JSON
  (via ObjectMapper), matching the approach user-otp's equivalent cache
  repository already uses for the same (regex, countryCode) pair.
- Version the cache key prefix (mobile-val: -> mobile-val:v2:) so a pod
  still running the pre-JSON jar during a rolling deploy can't read a
  value written by an upgraded pod as a bare regex — which would never
  match anything and reject every valid mobile number until TTL expiry.

user-otp:
- OtpRequestValidator.resolveCountryCode() now only backfills countryCode
  from a resolved MDMS config when that config also carries a non-blank
  mobileNumberRegex. A default=true entry with countryCode set but no
  regex was flipping isMobileNumberValid()'s branch from "fall back to
  the application.properties default regex" to "reject as country-specific
  misconfiguration", rejecting requests that should have passed.

* fix(egov-user): drop mobile-val cache key versioning

The v2 prefix guarded against a rolling-deploy mismatch between old
(bare regex) and new (JSON) cache values. Since this feature hasn't
shipped yet, there's no old format in the wild to guard against, so
the versioning is unnecessary.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@vinothrallapalli-eGov
vinothrallapalli-eGov merged commit 628f85c into 2.12 Aug 20, 2026
3 of 4 checks passed
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