-
Notifications
You must be signed in to change notification settings - Fork 653
API Revision Deployment Monitoring #13191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
📝 Walkthrough## Walkthrough
This change set introduces a comprehensive gateway instance and deployment status management feature to the API Management system. It adds new database tables, DAO classes, configuration options, REST API endpoints, and supporting logic for gateway registration, heartbeat, status notification, and cleanup. The implementation spans backend Java classes, REST APIs, OpenAPI specifications, configuration files, and SQL schema scripts, enabling real-time gateway monitoring, deployment status tracking, and administrative visibility into gateway environments.
## Changes
| Cohort / File(s) | Change Summary |
|---|---|
| **Gateway Instance & Deployment Status DB Schema**<br>`features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/*` | Added `AM_GW_INSTANCES`, `AM_GW_INSTANCE_ENV_MAPPING`, and `AM_GW_REVISION_DEPLOYMENT` tables to all supported RDBMS scripts for gateway instance tracking, environment mapping, and deployment status. |
| **Gateway Notification & Cleanup Configuration**<br>`features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.default.json`,<br>`features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json`,<br>`features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/templates/repository/conf/api-manager.xml.j2` | Introduced new configuration keys and XML sections for gateway notification, heartbeat, deployment acknowledgement, registration, and cleanup. Updated unit mappings for new config keys. |
| **Gateway Notification Configuration DTO**<br>`components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java` | Added a new DTO with nested classes to encapsulate gateway notification and cleanup configuration parameters. |
| **API Manager Configuration Parsing**<br>`components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIManagerConfiguration.java` | Extended to parse and expose `GatewayNotificationConfiguration` from XML. |
| **Gateway Management DAO**<br>`components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java` | Added new DAO for gateway instance and deployment record CRUD, heartbeat, status updates, and cleanup operations. |
| **Gateway Revision Deployment Stats DAO**<br>`components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java`,<br>`components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java` | Moved and extended logic for merging revision deployment DTOs to include gateway deployment statistics. Added new SQL queries for deployment stats and live gateway counts. |
| **APIRevisionDeployment Model & DTO Mapping**<br>`components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/APIRevisionDeployment.java`,<br>`components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIMappingUtil.java` | Added integer fields for live, deployed, and failed gateway counts; updated DTO mapping to include these fields. |
| **Publisher API OpenAPI Spec**<br>`components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml`,<br>`components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml` | Extended `APIRevisionDeployment` schema with new gateway count properties. |
| **Gateway Notification & Deployment Status REST APIs**<br>`components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml`,<br>`components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/webapp/WEB-INF/web.xml`,<br>`components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java`,<br>`components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java` | Added new REST endpoints and implementations for gateway registration, heartbeat, and deployment status notification. Updated OpenAPI spec and web.xml to expose new APIs. |
| **Gateway Notification Internal Logic**<br>`components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java`,<br>`components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java` | Introduced singleton classes for gateway registration, heartbeat, and deployment status notification to event hub. |
| **Gateway Notification Integration**<br>`components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayStartupListener.java`,<br>`components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java`,<br>`components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/InMemoryAPIDeployer.java` | Integrated notification logic into gateway startup, JMS event handling, and in-memory API deployer for deployment/undeployment events and reconnects. |
| **Gateway Registration Status Tracking**<br>`components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/DataHolder.java` | Added enum and fields to track gateway registration/acknowledgment state and gateway ID. |
| **Admin API: Gateway Instance Listing**<br>`components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java`,<br>`components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml`,<br>`components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml` | Added new GET endpoint and implementation to list gateway instances for an environment. Extended OpenAPI specs with new schemas. |
| **API Constants**<br>`components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java` | Added constants for gateway notification, registration, heartbeat, deployment status, and cleanup configuration. |
| **Gateway Validation Scheduler**<br>`components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java`,<br>`components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java` | Added scheduler for periodic cleanup/expiration of gateway instances based on heartbeat. Integrated scheduler lifecycle with APIManagerComponent. |
| **Utility Method Removal**<br>`components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIMgtDBUtil.java` | Removed `mergeRevisionDeploymentDTOs` utility, logic now resides in DAO. |
| **Gateway Module Build**<br>`components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml` | Added Maven compiler plugin config for Java 9 source/target. |
| **Gateway Listener Test Update**<br>`components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java` | Added static mocking for `DeploymentStatusNotifier` in test setup. |
| **Internal API Spec Checksum**<br>`components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256` | Updated SHA-256 checksum for modified OpenAPI spec. |
| **APIUtil Method Access Modifier**<br>`components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java` | Changed `getLocalAddress()` method from private to public static for external usage. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant Gateway
participant GatewayNotifier
participant EventHub (Control Plane)
participant GatewayManagementDAO
participant DB
Note over Gateway: Startup or reconnect
Gateway->>GatewayNotifier: registerGateway()
GatewayNotifier->>EventHub: POST /notify-gateway (REGISTER)
EventHub->>GatewayManagementDAO: insert/update gateway instance
GatewayManagementDAO->>DB: Write gateway record
EventHub-->>GatewayNotifier: Response (REGISTERED/ACKNOWLEDGED)
Note over Gateway: Periodic heartbeat
Gateway->>GatewayNotifier: startHeartbeat()
GatewayNotifier->>EventHub: POST /notify-gateway (HEARTBEAT)
EventHub->>GatewayManagementDAO: updateGatewayHeartbeat()
GatewayManagementDAO->>DB: Update last_updated
EventHub-->>GatewayNotifier: Response (ACKNOWLEDGED)
Note over Gateway: API deployment event
Gateway->>DeploymentStatusNotifier: submitDeploymentStatus(apiId, revisionId, success, ...)
DeploymentStatusNotifier->>EventHub: POST /notify-api-deployment-status
EventHub->>GatewayManagementDAO: insert/update deployment record
GatewayManagementDAO->>DB: Write deployment status
EventHub-->>DeploymentStatusNotifier: Response (success/error) Estimated code review effort🎯 5 (Critical) | ⏱️ ~90+ minutes Suggested reviewers
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements API Revision Deployment Monitoring functionality to track and manage gateway deployments. The implementation includes comprehensive database schema changes, REST API endpoints, and gateway monitoring capabilities to provide visibility into API deployment status across gateway instances.
- Database schema additions for tracking gateway instances and their deployment status
- REST API endpoints for gateway heartbeat/registration and deployment status acknowledgment
- Cleanup scheduler for managing stale gateway data and automated monitoring infrastructure
Reviewed Changes
Copilot reviewed 57 out of 57 changed files in this pull request and generated 8 comments.
Show a summary per file
File | Description |
---|---|
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/*.sql | Adds database tables for gateway instances and revision deployment tracking across all supported databases |
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/* | Admin API endpoints for retrieving gateway instances by environment |
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/* | Publisher API enhancements to show gateway deployment statistics |
components/apimgt/org.wso2.carbon.apimgt.internal.service/* | Internal service endpoints for gateway registration and deployment status notifications |
components/apimgt/org.wso2.carbon.apimgt.impl/* | Core implementation including DAO classes, configuration DTOs, and cleanup scheduler |
components/apimgt/org.wso2.carbon.apimgt.gateway/* | Gateway-side implementation for heartbeat monitoring and deployment status reporting |
Comments suppressed due to low confidence (6)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
Outdated
Show resolved
Hide resolved
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
Outdated
Show resolved
Hide resolved
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
Outdated
Show resolved
Hide resolved
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
Outdated
Show resolved
Hide resolved
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
Outdated
Show resolved
Hide resolved
...ts/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
Outdated
Show resolved
Hide resolved
...dmin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/GatewayInstantListDTO.java
Outdated
Show resolved
Hide resolved
...rbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 43
🔭 Outside diff range comments (2)
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/templates/repository/conf/api-manager.xml.j2 (1)
858-877
: Fix duplicate configuration and verify retry parameter usage.Two issues identified:
Duplicate "Enabled" configuration: Line 859 has the same
Enabled
property as line 861 within theHeartbeat
subsection. Remove the duplicate at line 859.Inconsistent retry parameter usage: The
DeploymentAcknowledgement
section (lines 868-870) usesapim.gateway_notification.registration.*
parameters instead of deployment-specific ones. Verify if this is intentional or if these should beapim.gateway_notification.deployment_ack.*
parameters.Apply this diff to fix the duplicate configuration:
<GatewayNotificationConfiguration> -<Enabled>{{apim.gateway_notification.heartbeat.enabled}}</Enabled> <Heartbeat> <Enabled>{{apim.gateway_notification.heartbeat.enabled}}</Enabled> <NotifyIntervalSeconds>{{apim.gateway_notification.heartbeat.notify_interval}}</NotifyIntervalSeconds> <GatewayID>{{apim.gateway_notification.heartbeat.gateway_id}}</GatewayID> </Heartbeat>
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/InMemoryAPIDeployer.java (1)
326-328
: Consider propagating deployment failuresThe catch block only logs the error without propagating it or affecting the method's return value. This could lead to silent failures where the JWKS or Health Check APIs fail to deploy but the overall deployment continues.
Consider either:
- Propagating the exception
- Tracking the failure and including it in the method's return value
- At minimum, incrementing an error counter to affect the final result
} catch (APIManagementException e) { log.error("Error while deploying in-memory APIs for tenant domain :" + tenantDomain, e); + // Consider propagating or tracking this failure + errorCount++; }
♻️ Duplicate comments (1)
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/InMemoryAPIDeployer.java (1)
153-172
: Externalize the Health Check API XML configurationSimilar to the JWKS API, the hardcoded XML string for the Health Check Synapse API should be externalized for better maintainability.
🧹 Nitpick comments (38)
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/DataHolder.java (2)
422-425
: Consider using EnumSet for better maintainability.The logic is correct but hardcodes the registered states. Consider using an EnumSet for better maintainability if more "registered" states are added in the future.
Alternative implementation using EnumSet:
+import java.util.EnumSet; + + private static final EnumSet<GatewayRegistrationResponse> REGISTERED_STATES = + EnumSet.of(GatewayRegistrationResponse.REGISTERED, GatewayRegistrationResponse.ACKNOWLEDGED); + public boolean isGatewayRegistered() { - return gatewayRegistrationResponse == GatewayRegistrationResponse.REGISTERED || - gatewayRegistrationResponse == GatewayRegistrationResponse.ACKNOWLEDGED; + return REGISTERED_STATES.contains(gatewayRegistrationResponse); }
57-58
: Consider consistency in access patterns.The static field
gatewayRegistrationResponse
with instance-levelgatewayID
creates a mixed access pattern. Consider whether both should be static or both should be instance-level for consistency.components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml (1)
11465-11470
: Typo inliveGatewayCount
description
currenty
→currently
.- The number of gateways that are currenty live in the gateway environment + The number of gateway instances that are currently live in the gateway environmentcomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java (1)
4225-4227
: Inefficient LIKE patterns onENV_LABELS
.Both new queries use
ENV_LABELS LIKE ?
with leading wildcards (%
). This prevents index usage and will full-scanAM_GW_INSTANCES
on every call, which could be heavy in large gateway fleets.
Consider normalizing labels into a join table, or at least using an indexed JSON/array column if supported, instead of comma-separated text + wildcard searches.components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java (1)
360-368
: Consider unconditional scheduler shutdown for robustness.While the current implementation mirrors the activate method's pattern, there's a potential issue: if the configuration changes between activate and deactivate (e.g., enabled becomes false), a running scheduler might not be stopped.
Consider unconditionally calling
GatewayCleanupScheduler.getInstance().stop()
since the scheduler's stop method already handles the case where it's not running.- GatewayCleanupConfiguration cleanupConfig = configuration.getGatewayCleanupConfiguration(); - if (cleanupConfig != null && cleanupConfig.isEnabled()) { - try { - GatewayCleanupScheduler.getInstance().stop(); - } catch (Exception e) { - log.error("Error while stopping Gateway cleanup scheduler", e); - } - } + try { + GatewayCleanupScheduler.getInstance().stop(); + } catch (Exception e) { + log.error("Error while stopping Gateway cleanup scheduler", e); + }features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.default.json (1)
239-241
: Consider unit consistency in configuration keys.There's a naming inconsistency:
notify_interval_seconds
(line 237) clearly indicates secondsheartbeat.notify_interval
(line 240) doesn't specify unitsWhile the unit resolution file may handle this, consider renaming for clarity:
- "apim.gateway_notification.heartbeat.notify_interval": "30", + "apim.gateway_notification.heartbeat.notify_interval_seconds": "30",components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml (2)
11469-11469
: Spelling nit – “currently”
currenty
→currently
.- The number of gateways that are currenty live in the gateway environment + The number of gateways that are currently live in the gateway environment
11465-11483
: Add a non-negative constraint to all count fieldsCounts can never be negative; encode this in the schema:
liveGatewayCount: readOnly: true type: integer + minimum: 0 ... deployedGatewayCount: readOnly: true type: integer + minimum: 0 ... failedGatewayCount: readOnly: true type: integer + minimum: 0components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayCleanupConfiguration.java (1)
24-30
: LGTM on class structure, but fix the inconsistent comment.The DTO structure is well-designed for gateway cleanup configuration. However, there's an inconsistency in the comment on line 28.
Fix the comment to match the actual default value:
- private int dataRetentionPeriodSeconds = 120; // Default 24 hours (1440 Seconds) + private int dataRetentionPeriodSeconds = 120; // Default 2 minutes (120 Seconds)The current comment says "24 hours (1440 Seconds)" but the default value is 120 seconds (2 minutes).
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java (2)
22-31
: Remove redundant importsThe specific DTO imports (lines 28-31) are redundant since the wildcard import at line 23 already includes them.
import org.wso2.carbon.apimgt.impl.dao.GatewayManagementDAO; import org.wso2.carbon.apimgt.internal.service.*; import org.wso2.carbon.apimgt.internal.service.dto.*; import org.apache.cxf.jaxrs.ext.multipart.Attachment; import org.apache.cxf.jaxrs.ext.MessageContext; -import org.wso2.carbon.apimgt.internal.service.dto.ErrorDTO; -import org.wso2.carbon.apimgt.internal.service.dto.GatewayDeploymentStatusAcknowledgmentListDTO; -import org.wso2.carbon.apimgt.internal.service.dto.GatewayDeploymentStatusAcknowledgmentDTO; -import org.wso2.carbon.apimgt.internal.service.dto.InlineResponse200DTO; import java.util.List;
33-36
: Remove unused importsThe
List
andInputStream
imports are not used in the implementation.-import java.util.List; -import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext;features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql (1)
2759-2778
: Consider adding indexes for improved query performanceBased on the query patterns in
GatewayManagementDAO
, consider adding indexes on frequently queried columns:-- Index for faster gateway existence checks CREATE INDEX IDX_GW_INSTANCES_STATUS ON AM_GW_INSTANCES(STATUS); -- Index for deployment queries by API_ID CREATE INDEX IDX_GW_REVISION_DEPLOYMENT_API ON AM_GW_REVISION_DEPLOYMENT(API_ID); -- Index for timestamp-based queries CREATE INDEX IDX_GW_REVISION_DEPLOYMENT_TIME ON AM_GW_REVISION_DEPLOYMENT(LAST_UPDATED);These indexes would improve performance for:
- Gateway status checks
- Finding all deployments for a specific API
- Time-based deployment queries
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql (1)
2785-2792
: ConsiderJSON
/MEDIUMTEXT
over genericBLOB
forGW_PROPERTIES
If the column is meant to hold human-readable key/value data (e.g., gateway meta, labels), declaring it as
JSON
(MySQL 5.7 +) or at leastMEDIUMTEXT
allows:
- server-side validation (
JSON_VALID()
),- partial querying with
->
operators,- better compression by the storage engine.
A raw
BLOB
makes the data opaque to the database and complicates future migrations.components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java (3)
19742-19743
: Improve unique key generationConsider using a more robust approach for generating unique keys instead of string concatenation with null handling.
- String uniqueKey = (environmentName != null ? environmentName : "") + - (vhost != null ? vhost : "") + (revisionUuid != null ? revisionUuid : ""); + String uniqueKey = String.format("%s:%s:%s", + Objects.toString(environmentName, ""), + Objects.toString(vhost, ""), + Objects.toString(revisionUuid, ""));Also add the import at the top of the file:
import java.util.Objects;
19801-19837
: Consider combining database queries for better performanceThe method executes two separate queries to fetch deployment stats and live count. These could potentially be combined into a single query or executed in parallel for better performance.
Consider creating a single query that retrieves both deployment statistics and live gateway count, or use a stored procedure to reduce database round trips. This would improve performance especially when processing multiple deployments.
19757-19760
: Missing break statement in switch default caseWhile not causing issues in the current implementation (as status remains null), it's a good practice to include a break statement in the default case.
default: // Handle the case where revisionStatus is not one of the expected values + log.warn("Unknown revision status: " + revisionStatus); break;
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql (1)
4198-4205
: Re-evaluate table schema & add operational indexesThe current definition is minimal and works functionally, but a couple of small tweaks would make it more robust and future-proof:
ENV_LABELS
– comma-separated lists quickly become painful to query. If you anticipate any server-side filtering/joining on labels, consider a link-table (AM_GW_INSTANCE_LABEL
) instead of an inline VARCHAR.STATUS
is likely to be queried frequently (dashboards / clean-up jobs). Add an index on this column, or at least onLAST_UPDATED
, to avoid occasional full-table scans.LAST_UPDATED
has no default; remember to populate it explicitly (e.g.DEFAULT CURRENT_TIMESTAMP
) or you will need to set it from all mutation code paths.These are low-risk improvements that keep the table performant as the row count grows.
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
2064-2079
: Consider pagination parameters to avoid unbounded result sets.If a gateway environment grows (e.g., hundreds of gateway instances in a mesh), returning the full list in one shot may be slow and memory-heavy. Most collection endpoints in this spec expose
limit
/offset
&pagination
metadata.Add the standard
limit
/offset
query parameters and return aGatewayInstanceList
with apagination
object to keep the API consistent and scalable.features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql (1)
2946-2953
:AM_GW_INSTANCES
: makeLAST_UPDATED
auto-managed & consider supporting longer label lists
LAST_UPDATED TIMESTAMP NOT NULL
forces callers to always supply a value. 99 % of the time it should just reflect “now”.ENV_LABELS
is limited to 255 chars; a couple of env names + commas can hit that quickly.- ENV_LABELS VARCHAR(255) NOT NULL, - LAST_UPDATED TIMESTAMP NOT NULL, + ENV_LABELS VARCHAR(512) NOT NULL, -- room for >5 env names + LAST_UPDATED TIMESTAMP NOT NULL + DEFAULT CURRENT_TIMESTAMP + ON UPDATE CURRENT_TIMESTAMP,This removes boiler-plate from DAO code and avoids silent
NULL
insert failures.
Optionally add a secondary index on (STATUS
,LAST_UPDATED
) if you’ll query inactive instances older than X minutes.features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql (2)
3576-3583
: Add indexes (and optional timestamp default) to prevent table-scan hot-spotsThe
AM_GW_INSTANCES
table will likely be polled by heartbeat/cleanup tasks usingSTATUS
and/orLAST_UPDATED
.
Without secondary indexes every lookup degrades into a full table scan on DB2.CREATE TABLE AM_GW_INSTANCES ( GATEWAY_ID VARCHAR(255) NOT NULL, ENV_LABELS VARCHAR(255) NOT NULL, - LAST_UPDATED TIMESTAMP NOT NULL, + LAST_UPDATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, GW_PROPERTIES BLOB NOT NULL, STATUS VARCHAR(255) NOT NULL, PRIMARY KEY (GATEWAY_ID) ) / +-- highly‐selective columns +CREATE INDEX IDX_GW_INSTANCES_STATUS ON AM_GW_INSTANCES (STATUS); +CREATE INDEX IDX_GW_INSTANCES_LAST_UPDATED ON AM_GW_INSTANCES (LAST_UPDATED);Adding these two narrow indexes (or at least
STATUS
) keeps row-lookups and purge jobs O(log n) instead of O(n).
If you deliberately avoided indexes for write-throughput reasons, note that DB2 supportsPCTFREE
/INCLUDE
to keep the cost negligible.
3590-3591
: ValidateSTATUS
/ACTION
values with a CHECK constraintBoth columns look like enums (e.g.
{'DEPLOYED','FAILED','REMOVED'}
and{'DEPLOY','UNDEPLOY'}
). Adding aCHECK
keeps bad values out and simplifies analytics.ALTER TABLE AM_GW_REVISION_DEPLOYMENT ADD CONSTRAINT CK_GW_REV_DEP_STATUS CHECK (STATUS IN ('DEPLOYED','FAILED','IN_PROGRESS')), ADD CONSTRAINT CK_GW_REV_DEP_ACTION CHECK (ACTION IN ('DEPLOY','UNDEPLOY'));components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (2)
3455-3461
: Add a private constructor to prevent instantiation, for consistency with other nested constants‐holder classesAll other nested static classes (
AI
,TokenStatus
,SubscriptionStatus
, etc.) include a private constructor, enforcing the intended utility behaviour.
GatewayNotification
omits this, so accidental instantiation is possible.public static class GatewayNotification { + private GatewayNotification() { + }
3462-3463
: RenametimeStamp
value to match constant styleConstant
TIMESTAMP
is mapped to"timeStamp"
(camel-case S).
Other timestamp keys in the codebase appear lowercase (timestamp
) or underscore separated. If this key is new, prefer"timestamp"
for consistency; if it must remain, consider renaming the constant toTIME_STAMP
to mirror the payload key.components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (2)
2046-2053
: Typo & terminology – use “instances” throughoutThe resource represents a collection of gateway instances, but the
summary
,description
, and the heading repeatedly say “instants” (lines 2048-2051). This is very likely a typo that will leak into autogenerated docs/SDKs.- summary: Get Gateway instants in a Gateway Environment + summary: Get Gateway instances in a Gateway Environment ... - description: | - Retrieve list of gateway instants in the gateway environment. + description: | + Retrieve the list of gateway instances in the specified gateway environment.Consistent wording helps users and future contributors; please correct everywhere the term appears in this block (and in schema definitions below).
5362-5375
: Schema title/name mismatch and copy-paste artifact
- Title says “Environment List” but the schema is actually a Gateway list.
- Descriptions again use “instants”.
gatewayID
should follow existing camelCase convention (gatewayId
).- Adding
format: date-time
tolastActive
improves swagger tooling validation.- title: Environment List + title: Gateway Instance List ... - gatewayID: + gatewayId: ... - example: "Env1_1372344" + example: "env1_1372344" ... - lastActive: - type: string - example: "2025-06-26T06:47:50Z" + lastActive: + type: string + format: date-time + example: "2025-06-26T06:47:50Z"These small clean-ups keep the OpenAPI spec internally consistent and tooling-friendly.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (5)
18-18
: Address the TODO comment before merging.The TODO comment indicates that code formatting is incomplete. Please format the code according to project standards before merging.
49-49
: Remove unused import from SAML2 package.The import
org.wso2.carbon.identity.sso.agent.oauth2.SAML2GrantAccessTokenRequestor.executePost
appears to be unused and is from an unrelated SAML2 package. The code usesAPIUtil.executeHTTPRequestWithRetries
instead.-import static org.wso2.carbon.identity.sso.agent.oauth2.SAML2GrantAccessTokenRequestor.executePost;
113-113
: Consider using the existing scheduler instead of creating new threads.Creating new threads directly for registration can lead to uncontrolled thread proliferation. Consider using the existing
scheduler
ExecutorService for registration tasks.- new Thread(new registerGateway()).start(); + scheduler.execute(new registerGateway());
151-153
: Remove redundant gatewayID validation.The gatewayID is already validated and set in the constructor, so this validation in
buildRegistrationPayload
is redundant since the method is only called internally with the class field.- if (gatewayID == null || gatewayID.isEmpty()) { - gatewayID = UUID.randomUUID().toString(); - }
18-18
: Remove TODO comment or address formatting.The TODO comment about formatting should either be addressed or removed before merging.
-// todo: formate the code
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java (2)
107-109
: Consider more specific exception handling.The generic Exception catch might mask specific configuration or scheduling errors. Consider catching more specific exceptions like configuration errors separately from scheduling errors.
- } catch (Exception e) { - log.error("Failed to start Gateway cleanup scheduler", e); - } + } catch (RuntimeException e) { + log.error("Configuration error while starting Gateway cleanup scheduler", e); + } catch (Exception e) { + log.error("Unexpected error while starting Gateway cleanup scheduler", e); + }
48-48
: Fix typo in comment.There's a spelling error in the comment.
- // define sheduled task interval in seconds + // define scheduled task interval in secondscomponents/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/InMemoryAPIDeployer.java (1)
112-120
: Consider externalizing the Synapse API XML configurationThe hardcoded XML string for the JWKS Synapse API should be externalized to a configuration file or template for better maintainability and flexibility.
Consider moving this XML content to a resource file:
- String jwksSynapseAPI = - "<api xmlns=\"http://ws.apache.org/ns/synapse\" name=\"_JwksEndpoint_\" " + "context=\"" - + jwksApiContext + "\">\n" - + " <resource methods=\"GET\" url-mapping=\"/*\" faultSequence=\"fault\">\n" - + " <inSequence>\n" + " <respond/>\n" + " </inSequence>\n" - + " </resource>\n" + " <handlers>\n" - + " <handler class=\"org.wso2.carbon.apimgt.gateway.handlers.common.JwksHandler\"/>\n" - + " </handlers>\n" + "</api>\n"; + String jwksSynapseAPI = loadSynapseAPITemplate("jwks-api-template.xml", jwksApiContext);This would require creating a template file and a method to load and process it with the appropriate context.
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java (1)
89-89
: Consider using a different delimiter for environment labelsUsing comma as a delimiter could cause issues if environment labels themselves contain commas. Consider using a less common delimiter or properly escaping the values.
Apply this diff to use a pipe delimiter:
-String envLabels = String.join(APIConstants.DELEM_COMMA, dto.getEnvironmentLabels()); +String envLabels = String.join("|", dto.getEnvironmentLabels());Also update the parsing logic in
getGatewayInstancesByEnvironment
method in the DAO to handle the new delimiter.components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (1)
238-270
: Limit response body size to prevent memory issuesUsing
readAllBytes()
on line 260 could cause memory issues if the server returns a large response.Consider adding a size limit:
-String responseBody = new String(response.getEntity().getContent().readAllBytes(), - StandardCharsets.UTF_8); +InputStream content = response.getEntity().getContent(); +ByteArrayOutputStream result = new ByteArrayOutputStream(); +byte[] buffer = new byte[1024]; +int length; +int totalRead = 0; +int maxSize = 1024 * 1024; // 1MB limit +while ((length = content.read(buffer)) != -1 && totalRead < maxSize) { + result.write(buffer, 0, length); + totalRead += length; +} +if (totalRead >= maxSize) { + log.warn("Response body exceeded size limit"); +} +String responseBody = result.toString(StandardCharsets.UTF_8.name());components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (2)
95-150
: Restore autocommit state after transactionBoth methods set autocommit to false but don't restore it. While connections are closed after use, it's good practice to restore the original state.
Use the utility method from APIMgtDBUtil:
public int updateExpiredGateways(Timestamp expireTimeThreshold) throws APIManagementException { int updatedCount = 0; try (Connection connection = APIMgtDBUtil.getConnection()) { + boolean autoCommit = connection.getAutoCommit(); connection.setAutoCommit(false); try (PreparedStatement preparedStatement = connection.prepareStatement(UPDATE_EXPIRED_GATEWAYS_SQL)) { preparedStatement.setTimestamp(1, expireTimeThreshold); updatedCount = preparedStatement.executeUpdate(); connection.commit(); if (log.isDebugEnabled()) { log.debug("Updated " + updatedCount + " gateways to EXPIRED status"); } } catch (SQLException e) { connection.rollback(); throw new APIManagementException("Error updating expired gateways", e); + } finally { + APIMgtDBUtil.setAutoCommit(connection, autoCommit); } } catch (SQLException e) { throw new APIManagementException("Error getting database connection", e); }Apply similar changes to
deleteOldGatewayRecords
method.
392-396
: Improve encapsulation of GatewayInstanceInfo classThe inner class uses public fields which violates encapsulation principles.
Convert to a proper data class:
-public static class GatewayInstanceInfo { - public String gatewayId; - public java.sql.Timestamp lastUpdated; - public String status; -} +public static class GatewayInstanceInfo { + private final String gatewayId; + private final java.sql.Timestamp lastUpdated; + private final String status; + + public GatewayInstanceInfo(String gatewayId, Timestamp lastUpdated, String status) { + this.gatewayId = gatewayId; + this.lastUpdated = lastUpdated; + this.status = status; + } + + public String getGatewayId() { return gatewayId; } + public Timestamp getLastUpdated() { return lastUpdated; } + public String getStatus() { return status; } +}Update the usage in
getGatewayInstancesByEnvironment
method accordingly.components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java (1)
65-92
: LGTM! Well-implemented REST endpoint.The implementation follows established patterns with proper validation, error handling, and data mapping. The use of
GatewayManagementDAO
for data access and appropriate DTO mapping is correct.Minor suggestion: Consider extracting the timestamp conversion logic to a utility method if this pattern is used elsewhere:
dto.setLastActive(info.lastUpdated.toInstant().toString());
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (15)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyApiDeploymentStatusApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyApiDeploymentStatusApiService.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyGatewayApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyGatewayApiService.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/GatewayDeploymentStatusAcknowledgmentDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/GatewayDeploymentStatusAcknowledgmentListDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/GatewayPropertiesDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/InlineResponse200DTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/NotifyGatewayPayloadDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/NotifyGatewayStatusResponseDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/EnvironmentsApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/EnvironmentsApiService.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/GatewayInstantDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/GatewayInstantListDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIRevisionDeploymentDTO.java
is excluded by!**/gen/**
📒 Files selected for processing (42)
components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/APIRevisionDeployment.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/InMemoryAPIDeployer.java
(10 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/DataHolder.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/GatewayRegistrationResponse.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
(6 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayStartupListener.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIManagerConfiguration.java
(6 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayCleanupConfiguration.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIMgtDBUtil.java
(0 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/webapp/WEB-INF/web.xml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIMappingUtil.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.default.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/templates/repository/conf/api-manager.xml.j2
(2 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
(1 hunks)
💤 Files with no reviewable changes (1)
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIMgtDBUtil.java
🧰 Additional context used
🧠 Learnings (36)
📓 Common learnings
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256 (1)
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json (1)
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/webapp/WEB-INF/web.xml (5)
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: Piumal1999
PR: #13132
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/PublisherCommonUtils.java:1524-1524
Timestamp: 2025-06-03T06:19:48.138Z
Learning: In PublisherCommonUtils.addAPIWithGeneratedSwaggerDefinition method, when ParseException was added to the throws clause, the calling methods in ApisApiServiceImpl.java and ImportUtils.java already had proper exception handling in place, so no additional changes were needed.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AzureContentSafetyGuardrailProviderServiceImpl.java:75-84
Timestamp: 2025-06-30T06:50:20.514Z
Learning: In WSO2 Carbon API Manager, initialization of service components (like GuardrailProviderService implementations) is guaranteed to occur before service methods are called, so additional initialization validation checks in service methods are not needed.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java (7)
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/Environment.java:341-355
Timestamp: 2025-07-19T14:50:12.218Z
Learning: In WSO2 Carbon API Manager, input validation for model properties like apiDiscoveryScheduledWindow is performed at the REST API level rather than in individual setter methods, avoiding code duplication and ensuring validation occurs at the entry point.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:11919-11923
Timestamp: 2025-06-30T06:27:48.390Z
Learning: In the WSO2 API Manager codebase, the input to the createCanonicalQueryString
method in APIUtil.java
is already URL encoded, so additional encoding within this method is not required and should be avoided to prevent double encoding.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AWSBedrockGuardrailProviderServiceImpl.java:131-133
Timestamp: 2025-06-30T08:24:52.352Z
Learning: In WSO2 Carbon API Manager, the APIUtil.generateAWSSignature and generateAWSSignatureUsingAssumeRole methods throw APIManagementException on failure rather than returning null, so null checks on their return values are not necessary.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/AsyncApiParserUtil.java:23-25
Timestamp: 2025-06-18T10:50:32.454Z
Learning: In WSO2 API Manager, when API specification parsing logic was extracted to org.wso2.carbon.apimgt.spec.parser component, the original classes in org.wso2.carbon.apimgt.impl.definitions (like AsyncApiParserUtil) were kept as deprecated wrapper classes that extend the new implementations. This inheritance is maintained for backward compatibility to support custom workflows that may extend these original classes, not removed as "needless inheritance".
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java (6)
Learnt from: Piumal1999
PR: #13132
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/PublisherCommonUtils.java:1524-1524
Timestamp: 2025-06-03T06:19:48.138Z
Learning: In PublisherCommonUtils.addAPIWithGeneratedSwaggerDefinition method, when ParseException was added to the throws clause, the calling methods in ApisApiServiceImpl.java and ImportUtils.java already had proper exception handling in place, so no additional changes were needed.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/AsyncApiParserUtil.java:23-25
Timestamp: 2025-06-18T10:50:32.454Z
Learning: In WSO2 API Manager, when API specification parsing logic was extracted to org.wso2.carbon.apimgt.spec.parser component, the original classes in org.wso2.carbon.apimgt.impl.definitions (like AsyncApiParserUtil) were kept as deprecated wrapper classes that extend the new implementations. This inheritance is maintained for backward compatibility to support custom workflows that may extend these original classes, not removed as "needless inheritance".
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:11919-11923
Timestamp: 2025-06-30T06:27:48.390Z
Learning: In the WSO2 API Manager codebase, the input to the createCanonicalQueryString
method in APIUtil.java
is already URL encoded, so additional encoding within this method is not required and should be avoided to prevent double encoding.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/APIHandlerServiceComponent.java:194-196
Timestamp: 2025-07-01T09:56:40.853Z
Learning: In WSO2 Carbon API Manager, the ServiceReferenceHolder and APIManagerConfiguration classes guarantee that getEmbeddingProvider() returns a non-null EmbeddingProviderConfigurationDTO instance, eliminating the need for null checks before calling methods on the returned DTO.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml (2)
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: Piumal1999
PR: #13132
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/PublisherCommonUtils.java:1524-1524
Timestamp: 2025-06-03T06:19:48.138Z
Learning: In PublisherCommonUtils.addAPIWithGeneratedSwaggerDefinition method, when ParseException was added to the throws clause, the calling methods in ApisApiServiceImpl.java and ImportUtils.java already had proper exception handling in place, so no additional changes were needed.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.default.json (2)
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayStartupListener.java (8)
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/APIHandlerServiceComponent.java:194-196
Timestamp: 2025-07-01T09:56:40.853Z
Learning: In WSO2 Carbon API Manager, the ServiceReferenceHolder and APIManagerConfiguration classes guarantee that getEmbeddingProvider() returns a non-null EmbeddingProviderConfigurationDTO instance, eliminating the need for null checks before calling methods on the returned DTO.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AzureContentSafetyGuardrailProviderServiceImpl.java:75-84
Timestamp: 2025-06-30T06:50:20.514Z
Learning: In WSO2 Carbon API Manager, initialization of service components (like GuardrailProviderService implementations) is guaranteed to occur before service methods are called, so additional initialization validation checks in service methods are not needed.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/AWSBedrockLLMProviderService.java:59-62
Timestamp: 2025-07-14T14:03:05.170Z
Learning: In WSO2 Carbon API Manager, API definition files are copied from their source location (features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/api_definitions/) to the runtime location (repository/resources/api_definitions/) during the build/deployment process. Therefore, the path construction using "repository" + File.separator + "resources" + File.separator + "api_definitions" in LLM provider service implementations is correct for the runtime environment.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml (3)
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: Piumal1999
PR: #13132
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/PublisherCommonUtils.java:1524-1524
Timestamp: 2025-06-03T06:19:48.138Z
Learning: In PublisherCommonUtils.addAPIWithGeneratedSwaggerDefinition method, when ParseException was added to the throws clause, the calling methods in ApisApiServiceImpl.java and ImportUtils.java already had proper exception handling in place, so no additional changes were needed.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (1)
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql (2)
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3569-3570
Timestamp: 2025-06-18T05:58:44.775Z
Learning: In AM_DEVPORTAL_API_REFERENCE tables across all database types, row deletions are handled separately through custom logic rather than using foreign key constraints with CASCADE delete actions. This is an intentional design choice to maintain control over the deletion process.
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3560-3561
Timestamp: 2025-06-18T05:58:38.988Z
Learning: In the AM_DEVPORTAL_API_CONTENT table and similar DevPortal content tables, foreign key constraints are deliberately omitted because row deletions are handled separately through application logic rather than database constraints for all database types.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java (3)
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql (2)
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3569-3570
Timestamp: 2025-06-18T05:58:44.775Z
Learning: In AM_DEVPORTAL_API_REFERENCE tables across all database types, row deletions are handled separately through custom logic rather than using foreign key constraints with CASCADE delete actions. This is an intentional design choice to maintain control over the deletion process.
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3560-3561
Timestamp: 2025-06-18T05:58:38.988Z
Learning: In the AM_DEVPORTAL_API_CONTENT table and similar DevPortal content tables, foreign key constraints are deliberately omitted because row deletions are handled separately through application logic rather than database constraints for all database types.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (2)
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/AsyncApiParserUtil.java:23-25
Timestamp: 2025-06-18T10:50:32.454Z
Learning: In WSO2 API Manager, when API specification parsing logic was extracted to org.wso2.carbon.apimgt.spec.parser component, the original classes in org.wso2.carbon.apimgt.impl.definitions (like AsyncApiParserUtil) were kept as deprecated wrapper classes that extend the new implementations. This inheritance is maintained for backward compatibility to support custom workflows that may extend these original classes, not removed as "needless inheritance".
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (4)
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIMappingUtil.java (2)
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: Piumal1999
PR: #13132
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/PublisherCommonUtils.java:1524-1524
Timestamp: 2025-06-03T06:19:48.138Z
Learning: In PublisherCommonUtils.addAPIWithGeneratedSwaggerDefinition method, when ParseException was added to the throws clause, the calling methods in ApisApiServiceImpl.java and ImportUtils.java already had proper exception handling in place, so no additional changes were needed.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java (3)
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/AsyncApiParserUtil.java:23-25
Timestamp: 2025-06-18T10:50:32.454Z
Learning: In WSO2 API Manager, when API specification parsing logic was extracted to org.wso2.carbon.apimgt.spec.parser component, the original classes in org.wso2.carbon.apimgt.impl.definitions (like AsyncApiParserUtil) were kept as deprecated wrapper classes that extend the new implementations. This inheritance is maintained for backward compatibility to support custom workflows that may extend these original classes, not removed as "needless inheritance".
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayCleanupConfiguration.java (1)
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIManagerConfiguration.java (5)
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/AsyncApiParserUtil.java:23-25
Timestamp: 2025-06-18T10:50:32.454Z
Learning: In WSO2 API Manager, when API specification parsing logic was extracted to org.wso2.carbon.apimgt.spec.parser component, the original classes in org.wso2.carbon.apimgt.impl.definitions (like AsyncApiParserUtil) were kept as deprecated wrapper classes that extend the new implementations. This inheritance is maintained for backward compatibility to support custom workflows that may extend these original classes, not removed as "needless inheritance".
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/InMemoryAPIDeployer.java (13)
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/AsyncApiParserUtil.java:23-25
Timestamp: 2025-06-18T10:50:32.454Z
Learning: In WSO2 API Manager, when API specification parsing logic was extracted to org.wso2.carbon.apimgt.spec.parser component, the original classes in org.wso2.carbon.apimgt.impl.definitions (like AsyncApiParserUtil) were kept as deprecated wrapper classes that extend the new implementations. This inheritance is maintained for backward compatibility to support custom workflows that may extend these original classes, not removed as "needless inheritance".
Learnt from: Piumal1999
PR: #13132
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/PublisherCommonUtils.java:1524-1524
Timestamp: 2025-06-03T06:19:48.138Z
Learning: In PublisherCommonUtils.addAPIWithGeneratedSwaggerDefinition method, when ParseException was added to the throws clause, the calling methods in ApisApiServiceImpl.java and ImportUtils.java already had proper exception handling in place, so no additional changes were needed.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/APIHandlerServiceComponent.java:194-196
Timestamp: 2025-07-01T09:56:40.853Z
Learning: In WSO2 Carbon API Manager, the ServiceReferenceHolder and APIManagerConfiguration classes guarantee that getEmbeddingProvider() returns a non-null EmbeddingProviderConfigurationDTO instance, eliminating the need for null checks before calling methods on the returned DTO.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AzureContentSafetyGuardrailProviderServiceImpl.java:75-84
Timestamp: 2025-06-30T06:50:20.514Z
Learning: In WSO2 Carbon API Manager, initialization of service components (like GuardrailProviderService implementations) is guaranteed to occur before service methods are called, so additional initialization validation checks in service methods are not needed.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/AWSBedrockLLMProviderService.java:59-62
Timestamp: 2025-07-14T14:03:05.170Z
Learning: In WSO2 Carbon API Manager, API definition files are copied from their source location (features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/api_definitions/) to the runtime location (repository/resources/api_definitions/) during the build/deployment process. Therefore, the path construction using "repository" + File.separator + "resources" + File.separator + "api_definitions" in LLM provider service implementations is correct for the runtime environment.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Learnt from: Oshanath
PR: #13124
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java:2861-2863
Timestamp: 2025-05-27T16:51:06.742Z
Learning: Service layer validation in WSO2 API Manager: The getAPIProductbyUUID method in APIProviderImpl validates that retrieved artifacts are actual API Products by checking publisherAPIProduct.getType() equals APIConstants.API_PRODUCT, throwing APIMgtResourceNotFoundException if not. This service-layer approach provides centralized type validation for all API Product operations.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AWSBedrockGuardrailProviderServiceImpl.java:131-133
Timestamp: 2025-06-30T08:24:52.352Z
Learning: In WSO2 Carbon API Manager, the APIUtil.generateAWSSignature and generateAWSSignatureUsingAssumeRole methods throw APIManagementException on failure rather than returning null, so null checks on their return values are not necessary.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql (2)
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3569-3570
Timestamp: 2025-06-18T05:58:44.775Z
Learning: In AM_DEVPORTAL_API_REFERENCE tables across all database types, row deletions are handled separately through custom logic rather than using foreign key constraints with CASCADE delete actions. This is an intentional design choice to maintain control over the deletion process.
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3560-3561
Timestamp: 2025-06-18T05:58:38.988Z
Learning: In the AM_DEVPORTAL_API_CONTENT table and similar DevPortal content tables, foreign key constraints are deliberately omitted because row deletions are handled separately through application logic rather than database constraints for all database types.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql (2)
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3560-3561
Timestamp: 2025-06-18T05:58:38.988Z
Learning: In the AM_DEVPORTAL_API_CONTENT table and similar DevPortal content tables, foreign key constraints are deliberately omitted because row deletions are handled separately through application logic rather than database constraints for all database types.
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3569-3570
Timestamp: 2025-06-18T05:58:44.775Z
Learning: In AM_DEVPORTAL_API_REFERENCE tables across all database types, row deletions are handled separately through custom logic rather than using foreign key constraints with CASCADE delete actions. This is an intentional design choice to maintain control over the deletion process.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql (2)
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3560-3561
Timestamp: 2025-06-18T05:58:38.988Z
Learning: In the AM_DEVPORTAL_API_CONTENT table and similar DevPortal content tables, foreign key constraints are deliberately omitted because row deletions are handled separately through application logic rather than database constraints for all database types.
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3569-3570
Timestamp: 2025-06-18T05:58:44.775Z
Learning: In AM_DEVPORTAL_API_REFERENCE tables across all database types, row deletions are handled separately through custom logic rather than using foreign key constraints with CASCADE delete actions. This is an intentional design choice to maintain control over the deletion process.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql (2)
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3569-3570
Timestamp: 2025-06-18T05:58:44.775Z
Learning: In AM_DEVPORTAL_API_REFERENCE tables across all database types, row deletions are handled separately through custom logic rather than using foreign key constraints with CASCADE delete actions. This is an intentional design choice to maintain control over the deletion process.
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3560-3561
Timestamp: 2025-06-18T05:58:38.988Z
Learning: In the AM_DEVPORTAL_API_CONTENT table and similar DevPortal content tables, foreign key constraints are deliberately omitted because row deletions are handled separately through application logic rather than database constraints for all database types.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (4)
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql (2)
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3569-3570
Timestamp: 2025-06-18T05:58:44.775Z
Learning: In AM_DEVPORTAL_API_REFERENCE tables across all database types, row deletions are handled separately through custom logic rather than using foreign key constraints with CASCADE delete actions. This is an intentional design choice to maintain control over the deletion process.
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3560-3561
Timestamp: 2025-06-18T05:58:38.988Z
Learning: In the AM_DEVPORTAL_API_CONTENT table and similar DevPortal content tables, foreign key constraints are deliberately omitted because row deletions are handled separately through application logic rather than database constraints for all database types.
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java (2)
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/templates/repository/conf/api-manager.xml.j2 (5)
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:11926-11933
Timestamp: 2025-06-30T06:48:38.255Z
Learning: In the WSO2 API Manager codebase, for simple XML responses where the structure is predictable and namespaces are not involved, regex-based XML extraction is preferred over using a full XML parser, as it is more performant and avoids unnecessary overhead.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/AsyncApiParserUtil.java:23-25
Timestamp: 2025-06-18T10:50:32.454Z
Learning: In WSO2 API Manager, when API specification parsing logic was extracted to org.wso2.carbon.apimgt.spec.parser component, the original classes in org.wso2.carbon.apimgt.impl.definitions (like AsyncApiParserUtil) were kept as deprecated wrapper classes that extend the new implementations. This inheritance is maintained for backward compatibility to support custom workflows that may extend these original classes, not removed as "needless inheritance".
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/AWSBedrockLLMProviderService.java:59-62
Timestamp: 2025-07-14T14:03:05.170Z
Learning: In WSO2 Carbon API Manager, API definition files are copied from their source location (features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/api_definitions/) to the runtime location (repository/resources/api_definitions/) during the build/deployment process. Therefore, the path construction using "repository" + File.separator + "resources" + File.separator + "api_definitions" in LLM provider service implementations is correct for the runtime environment.
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java (2)
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/AsyncApiParserUtil.java:23-25
Timestamp: 2025-06-18T10:50:32.454Z
Learning: In WSO2 API Manager, when API specification parsing logic was extracted to org.wso2.carbon.apimgt.spec.parser component, the original classes in org.wso2.carbon.apimgt.impl.definitions (like AsyncApiParserUtil) were kept as deprecated wrapper classes that extend the new implementations. This inheritance is maintained for backward compatibility to support custom workflows that may extend these original classes, not removed as "needless inheritance".
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql (2)
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3569-3570
Timestamp: 2025-06-18T05:58:44.775Z
Learning: In AM_DEVPORTAL_API_REFERENCE tables across all database types, row deletions are handled separately through custom logic rather than using foreign key constraints with CASCADE delete actions. This is an intentional design choice to maintain control over the deletion process.
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3560-3561
Timestamp: 2025-06-18T05:58:38.988Z
Learning: In the AM_DEVPORTAL_API_CONTENT table and similar DevPortal content tables, foreign key constraints are deliberately omitted because row deletions are handled separately through application logic rather than database constraints for all database types.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql (2)
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3560-3561
Timestamp: 2025-06-18T05:58:38.988Z
Learning: In the AM_DEVPORTAL_API_CONTENT table and similar DevPortal content tables, foreign key constraints are deliberately omitted because row deletions are handled separately through application logic rather than database constraints for all database types.
Learnt from: kavindasr
PR: #13145
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql:3569-3570
Timestamp: 2025-06-18T05:58:44.775Z
Learning: In AM_DEVPORTAL_API_REFERENCE tables across all database types, row deletions are handled separately through custom logic rather than using foreign key constraints with CASCADE delete actions. This is an intentional design choice to maintain control over the deletion process.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (2)
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml (3)
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java (6)
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AzureContentSafetyGuardrailProviderServiceImpl.java:75-84
Timestamp: 2025-06-30T06:50:20.514Z
Learning: In WSO2 Carbon API Manager, initialization of service components (like GuardrailProviderService implementations) is guaranteed to occur before service methods are called, so additional initialization validation checks in service methods are not needed.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/AsyncApiParserUtil.java:23-25
Timestamp: 2025-06-18T10:50:32.454Z
Learning: In WSO2 API Manager, when API specification parsing logic was extracted to org.wso2.carbon.apimgt.spec.parser component, the original classes in org.wso2.carbon.apimgt.impl.definitions (like AsyncApiParserUtil) were kept as deprecated wrapper classes that extend the new implementations. This inheritance is maintained for backward compatibility to support custom workflows that may extend these original classes, not removed as "needless inheritance".
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (3)
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/AsyncApiParserUtil.java:23-25
Timestamp: 2025-06-18T10:50:32.454Z
Learning: In WSO2 API Manager, when API specification parsing logic was extracted to org.wso2.carbon.apimgt.spec.parser component, the original classes in org.wso2.carbon.apimgt.impl.definitions (like AsyncApiParserUtil) were kept as deprecated wrapper classes that extend the new implementations. This inheritance is maintained for backward compatibility to support custom workflows that may extend these original classes, not removed as "needless inheritance".
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
🧬 Code Graph Analysis (5)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java (4)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (1)
GatewayManagementDAO
(40-397)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/GatewayInstantDTO.java (1)
GatewayInstantDTO
(21-120)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/GatewayInstantListDTO.java (1)
GatewayInstantListDTO
(24-105)components/apimgt/org.wso2.carbon.apimgt.rest.api.util/src/main/java/org/wso2/carbon/apimgt/rest/api/util/utils/RestApiUtil.java (1)
RestApiUtil
(85-1394)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java (2)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (1)
GatewayManagementDAO
(40-397)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayCleanupConfiguration.java (1)
GatewayCleanupConfiguration
(24-62)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java (4)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (1)
GatewayManagementDAO
(40-397)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/GatewayDeploymentStatusAcknowledgmentListDTO.java (1)
GatewayDeploymentStatusAcknowledgmentListDTO
(24-105)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/GatewayDeploymentStatusAcknowledgmentDTO.java (1)
GatewayDeploymentStatusAcknowledgmentDTO
(21-294)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/InlineResponse200DTO.java (1)
InlineResponse200DTO
(21-80)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (1)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIMgtDBUtil.java (1)
APIMgtDBUtil
(50-253)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java (2)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayCleanupConfiguration.java (1)
GatewayCleanupConfiguration
(24-62)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java (1)
GatewayCleanupScheduler
(40-187)
🪛 Gitleaks (8.27.2)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
2078-2078: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
2078-2078: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
🪛 YAMLlint (1.37.1)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
[warning] 2308-2308: too many spaces after colon
(colons)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build-carbon
- GitHub Check: build-product (3, group3)
- GitHub Check: build-product (1, group1)
- GitHub Check: build-product (2, group2)
- GitHub Check: run-benchmark-test
- GitHub Check: build-product (4, group4)
🔇 Additional comments (68)
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/GatewayRegistrationResponse.java (2)
24-28
: LGTM! Clean enum implementation.The enum definition is well-structured with clear state progression from
NOT_RESPONDED
→ACKNOWLEDGED
→REGISTERED
. The naming follows Java conventions and the Javadoc provides adequate documentation.
21-28
: LGTM! Clean enum implementation.The enum is well-structured with clear, descriptive values representing the gateway registration lifecycle states. The implementation follows Java conventions and serves as a solid foundation for the gateway registration system.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/DataHolder.java (5)
58-58
: LGTM! Instance field for gateway ID.The
gatewayID
instance field is appropriately placed and follows naming conventions.
405-411
: LGTM! Standard getter/setter implementation.The getter and setter methods for
gatewayID
follow Java bean conventions correctly.
413-415
: LGTM! Registration response getter.The getter method correctly returns the static registration response field.
427-429
: LGTM! Static setter implementation.The static setter method correctly updates the static field and follows naming conventions.
405-430
: LGTM! Well-implemented gateway management methods.The getter/setter methods for gatewayID and the registration response management are well-implemented. The
isGatewayRegistered()
method correctly checks for both REGISTERED and ACKNOWLEDGED states.components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256 (1)
1-1
: Auto-generated checksum update acknowledgedThe hash merely reflects the updated OpenAPI spec (new notification endpoints). Assuming the change originated from
src/main/resources/api.yaml
, this is expected and requires no further review.components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIMappingUtil.java (1)
3625-3628
: Remove invalid null guards and enforce non-negative gateway countsThe getters in APIRevisionDeployment return primitive int, so
model.getXxxGatewayCount() != null
won’t compile and null can’t occur. Instead, add an explicit check to reject or sanitize negative values (which indicate corrupt data).• File:
components/apimgt/…/common/mappings/APIMappingUtil.java
Lines: 3625–3628Proposed diff:
- apiRevisionDeploymentDTO.setLiveGatewayCount(model.getLiveGatewayCount()); - apiRevisionDeploymentDTO.setDeployedGatewayCount(model.getDeployedGatewayCount()); - apiRevisionDeploymentDTO.setFailedGatewayCount(model.getFailedGatewayCount()); + int liveCount = model.getLiveGatewayCount(); + if (liveCount < 0) { + throw new IllegalArgumentException("liveGatewayCount cannot be negative: " + liveCount); + } + apiRevisionDeploymentDTO.setLiveGatewayCount(liveCount); + + int deployedCount = model.getDeployedGatewayCount(); + if (deployedCount < 0) { + throw new IllegalArgumentException("deployedGatewayCount cannot be negative: " + deployedCount); + } + apiRevisionDeploymentDTO.setDeployedGatewayCount(deployedCount); + + int failedCount = model.getFailedGatewayCount(); + if (failedCount < 0) { + throw new IllegalArgumentException("failedGatewayCount cannot be negative: " + failedCount); + } + apiRevisionDeploymentDTO.setFailedGatewayCount(failedCount);⛔ Skipped due to learnings
Learnt from: AnuGayan PR: wso2/carbon-apimgt#13182 File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0 Timestamp: 2025-07-19T14:47:03.856Z Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: tharindu1st PR: wso2/carbon-apimgt#13144 File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892 Timestamp: 2025-07-20T17:30:51.843Z Learning: In the WSO2 Carbon API Manager repository, `components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml` is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: nimsara66 PR: wso2/carbon-apimgt#13158 File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AWSBedrockGuardrailProviderServiceImpl.java:131-133 Timestamp: 2025-06-30T08:24:52.352Z Learning: In WSO2 Carbon API Manager, the APIUtil.generateAWSSignature and generateAWSSignatureUsingAssumeRole methods throw APIManagementException on failure rather than returning null, so null checks on their return values are not necessary.
Learnt from: Oshanath PR: wso2/carbon-apimgt#13117 File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0 Timestamp: 2025-05-26T06:53:40.902Z Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: AnuGayan PR: wso2/carbon-apimgt#13182 File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/Environment.java:341-355 Timestamp: 2025-07-19T14:50:12.218Z Learning: In WSO2 Carbon API Manager, input validation for model properties like apiDiscoveryScheduledWindow is performed at the REST API level rather than in individual setter methods, avoiding code duplication and ensuring validation occurs at the entry point.
Learnt from: Oshanath PR: wso2/carbon-apimgt#13124 File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIProviderImpl.java:5845-5851 Timestamp: 2025-05-27T16:38:44.397Z Learning: In `APIProviderImpl.getAPIProductbyUUID`, the method already throws an exception if the API Product artifact is null or not of type `APIConstants.API_PRODUCT`, guarding against downstream NPEs.
Learnt from: thisaltennakoon PR: wso2/carbon-apimgt#13149 File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60 Timestamp: 2025-06-18T11:14:40.788Z Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json (1)
17-17
: LGTM: Consistent time unit configurationThe new heartbeat notification interval configuration follows the established pattern and uses an appropriate time unit (seconds) for heartbeat intervals.
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/webapp/WEB-INF/web.xml (1)
63-65
: LGTM: Proper service registrationThe new gateway notification and deployment status API services are correctly registered following the established pattern. This enables the control plane to receive gateway notifications and deployment acknowledgments.
components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/APIRevisionDeployment.java (2)
35-37
: LGTM: Clean model enhancementThe new gateway count fields are appropriately typed and named, enhancing the deployment tracking capabilities for API revisions.
103-125
: LGTM: Proper getter/setter implementationThe getter and setter methods follow Java bean conventions and are correctly implemented for the new gateway count fields.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayStartupListener.java (4)
35-35
: LGTM: Clean import additionThe GatewayNotifier import is properly added to support the new gateway notification functionality.
103-103
: LGTM: Appropriate field declarationThe private GatewayNotifier field follows the established pattern in the class.
233-235
: LGTM: Proper gateway notification integrationThe gateway notification integration is well-implemented:
- Uses singleton pattern appropriately
- Registers gateway on startup
- Starts heartbeat for continuous monitoring
- Placement after other initialization is correct
392-394
: LGTM: Defensive shutdown implementationThe null check before stopping the heartbeat is good defensive programming, ensuring clean shutdown even if the notifier wasn't properly initialized.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java (3)
64-64
: Import addition looks correct.The import for
GatewayCleanupConfiguration
is necessary for the gateway cleanup functionality added in the activate/deactivate methods.
86-86
: Import addition looks correct.The import for
GatewayCleanupScheduler
is necessary for accessing the singleton scheduler instance in the lifecycle methods.
337-345
: Clean integration of gateway cleanup scheduler startup.The implementation correctly:
- Retrieves configuration from the APIManager configuration
- Performs null and enabled checks before starting the scheduler
- Handles exceptions gracefully with appropriate error logging
- Follows the singleton pattern correctly
The integration aligns well with the OSGi component lifecycle management pattern used throughout this class.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.default.json (4)
232-235
: Gateway cleanup configuration looks well-structured.The configuration provides reasonable defaults:
- Safely disabled by default for new feature rollout
- Conservative time intervals (60s expire, 120s retention, 60s cleanup)
- Consistent naming convention following existing patterns
- Clear time unit specification (seconds)
236-238
: Gateway notification configuration is appropriate.The settings provide sensible defaults:
- Enabled by default indicates this is a core feature
- 30-second notification interval is reasonable for monitoring
- Empty gateway_id allows for runtime or deployment-specific configuration
242-246
: Deployment acknowledgment configuration demonstrates good retry strategy.The settings implement solid patterns:
- Reasonable batch size (100) for efficiency
- Appropriate batch interval (100s) for accumulation
- Exponential backoff retry with progression factor 2.0
- Good balance of retry attempts (5) and initial duration (10s)
These values should provide robust fault tolerance for deployment notifications.
247-249
: Registration retry configuration maintains good consistency.The retry parameters align well with the deployment acknowledgment settings:
- Consistent max retry count (5) and initial duration (10s)
- Same exponential backoff factor (2.0)
- Maintains uniform retry behavior across gateway features
This consistency simplifies configuration management and provides predictable behavior.
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml (1)
11465-11483
: Edits applied to an auto-generated spec file will be lostPer past guidance (see learning from PR #13144),
publisher-api.yaml
underrest.api.publisher.v1
is a generated copy. Manual modifications here will be overwritten the next time the spec is re-generated. Move the three new properties to the authoritative source file (components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
) and regenerate the copy instead.⛔ Skipped due to learnings
Learnt from: tharindu1st PR: wso2/carbon-apimgt#13144 File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892 Timestamp: 2025-07-20T17:30:51.843Z Learning: In the WSO2 Carbon API Manager repository, `components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml` is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: thisaltennakoon PR: wso2/carbon-apimgt#13149 File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60 Timestamp: 2025-06-18T11:14:40.788Z Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Learnt from: Piumal1999 PR: wso2/carbon-apimgt#13132 File: components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/PublisherCommonUtils.java:1524-1524 Timestamp: 2025-06-03T06:19:48.138Z Learning: In PublisherCommonUtils.addAPIWithGeneratedSwaggerDefinition method, when ParseException was added to the throws clause, the calling methods in ApisApiServiceImpl.java and ImportUtils.java already had proper exception handling in place, so no additional changes were needed.
Learnt from: tharindu1st PR: wso2/carbon-apimgt#13144 File: components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/LlmProvidersApiServiceImpl.java:0-0 Timestamp: 2025-07-13T16:21:39.072Z Learning: In WSO2 Carbon API Manager LLM provider updates, the multipleVendorSupport/modelFamilySupported field is read-only - it can only be set during provider creation and is preserved from the existing provider during updates via provider.setModelFamilySupported(retrievedProvider.isModelFamilySupported()).
Learnt from: AnuGayan PR: wso2/carbon-apimgt#13182 File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/Environment.java:341-355 Timestamp: 2025-07-19T14:50:12.218Z Learning: In WSO2 Carbon API Manager, input validation for model properties like apiDiscoveryScheduledWindow is performed at the REST API level rather than in individual setter methods, avoiding code duplication and ensuring validation occurs at the entry point.
Learnt from: tharindu1st PR: wso2/carbon-apimgt#13144 File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/AWSBedrockLLMProviderService.java:59-62 Timestamp: 2025-07-14T14:03:05.170Z Learning: In WSO2 Carbon API Manager, API definition files are copied from their source location (features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/api_definitions/) to the runtime location (repository/resources/api_definitions/) during the build/deployment process. Therefore, the path construction using "repository" + File.separator + "resources" + File.separator + "api_definitions" in LLM provider service implementations is correct for the runtime environment.
Learnt from: thisaltennakoon PR: wso2/carbon-apimgt#13149 File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/AsyncApiParserUtil.java:23-25 Timestamp: 2025-06-18T10:50:32.454Z Learning: In WSO2 API Manager, when API specification parsing logic was extracted to org.wso2.carbon.apimgt.spec.parser component, the original classes in org.wso2.carbon.apimgt.impl.definitions (like AsyncApiParserUtil) were kept as deprecated wrapper classes that extend the new implementations. This inheritance is maintained for backward compatibility to support custom workflows that may extend these original classes, not removed as "needless inheritance".
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java (2)
25-27
: LGTM! Imports are properly added.The new imports for
GatewayManagementDAO
and the DTO classes are correctly placed and necessary for the new gateway instances retrieval functionality.
65-92
: Well-implemented gateway instances retrieval method.The method follows established patterns in this class and handles the requirements correctly:
- Proper input validation and organization extraction
- Environment existence validation with appropriate exception handling
- Clean mapping from DAO objects to DTOs
- ISO-8601 timestamp formatting for API consistency
- Appropriate HTTP response structure
The implementation aligns well with the existing codebase patterns and REST API best practices.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayCleanupConfiguration.java (2)
31-61
: Standard getter/setter implementation looks good.The methods follow Java bean conventions correctly with appropriate return types and parameter handling.
24-62
: LGTM! Clean DTO implementation.The DTO is well-structured with appropriate default values and standard getter/setter methods. The configuration properties are logically organized for gateway cleanup settings.
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java (1)
54-65
: Well-implemented input validationThe validation logic properly checks for null and empty lists, returning appropriate error responses with detailed error objects.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql (1)
2759-2778
: Well-designed database schema for gateway managementThe new tables are properly structured with:
- Appropriate data types and constraints
- Proper foreign key relationship with CASCADE DELETE
- Composite primary key that prevents duplicate deployments per gateway/API
- Consistent naming conventions with existing tables
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java (1)
19708-19708
: Method refactoring looks goodThe relocation of
mergeRevisionDeploymentDTOs
fromAPIMgtDBUtil
to the DAO class is appropriate as it allows for better encapsulation and access to instance methods likecalculateGatewayDeploymentStats
.components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java (5)
38-38
: LGTM: New imports properly added for notification framework integration.The imports for
GatewayNotifier
andDeploymentStatusNotifier
are correctly added to support the new deployment monitoring functionality.Also applies to: 41-41
80-80
: LGTM: Static field declaration follows singleton pattern.The static
GatewayNotifier
field is appropriately declared to support the gateway registration functionality during JMS reconnection events.
163-163
: LGTM: Deployment status notification properly integrated for API deployment.The implementation correctly:
- Obtains the
DeploymentStatusNotifier
singleton instance- Retrieves the API revision ID from the tenant API map after successful deployment
- Submits success status with proper parameters (
uuid
,apiRevisionId
,true
,"DEPLOY"
)- Handles exceptions by submitting failure status with error details
Also applies to: 189-198
214-222
: LGTM: Deployment status notification properly integrated for API undeployment.The implementation correctly:
- Submits success status for undeployment with
null
revision ID (appropriate for undeploy operations)- Handles exceptions by submitting failure status with error code and message
- Follows the same pattern as deployment notification for consistency
672-674
: LGTM: Gateway registration integrated into JMS reconnection handling.The implementation properly:
- Logs the re-registration event for debugging
- Obtains the
GatewayNotifier
singleton instance- Calls
registerGateway()
to re-register the gateway after JMS reconnectionThis ensures the gateway maintains its registration status even after connection interruptions.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java (4)
24-52
: LGTM: Well-structured main configuration class.The main
GatewayNotificationConfiguration
class properly:
- Initializes nested configuration objects with default instances
- Provides standard getter/setter methods
- Follows proper JavaBean conventions
- Organizes gateway notification settings logically
56-84
: LGTM: Heartbeat configuration with sensible defaults.The
HeartbeatConfiguration
class provides:
- Reasonable default values (enabled=true, 30-second interval)
- Proper boolean flag for enabling/disabling heartbeat functionality
- Configurable gateway ID field
- Standard getter/setter pattern
The 30-second default interval is appropriate for heartbeat monitoring without excessive overhead.
89-135
: LGTM: Comprehensive deployment acknowledgement configuration.The
DeploymentAcknowledgementConfiguration
class provides:
- Well-balanced batch processing defaults (200 items, 1-second interval)
- Proper retry mechanism configuration (5 attempts, 10-second duration, 2.0 progression factor)
- Exponential backoff support through the progression factor
- All parameters are configurable with reasonable defaults
The configuration supports efficient batching while providing resilience through retry mechanisms.
140-168
: LGTM: Consistent registration retry configuration.The
RegistrationConfiguration
class:
- Maintains consistency with deployment acknowledgement retry parameters
- Provides the same retry mechanism (5 attempts, 10-second duration, 2.0 progression factor)
- Follows the same getter/setter pattern
- Supports robust gateway registration with proper retry handling
The consistent retry configuration across different notification types ensures predictable behavior.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
2065-2068
: Schema reference will inherit the typoBecause the model is referenced as
GatewayInstantList
, fixing the wording above without renaming the schema will introduce inconsistency (instances
vsInstant
). Decide upfront:Option A – keep the name as-is and just fix visible text.
Option B (recommended) – rename the schema toGatewayInstanceList
/GatewayInstance
for long-term clarity (requires matching DTO & service rename).Ensure server DTOs and mapping code are updated if you choose Option B.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (4)
120-147
: Well-implemented scheduler lifecycle management.The heartbeat scheduler lifecycle management is properly implemented with graceful shutdown, timeout handling, and proper thread interruption handling.
73-147
: LGTM! Well-implemented gateway notification system.The constructor properly initializes configuration and the singleton pattern is correctly implemented. The heartbeat scheduling and shutdown logic are robust with proper resource cleanup and interrupt handling.
189-237
: LGTM! Robust registration implementation with proper retry logic.The registration logic is well-implemented with proper authentication, retry mechanisms, and response handling. The use of separate thread for asynchronous registration is appropriate.
239-274
: LGTM! Clean heartbeat implementation.The heartbeat logic is straightforward and properly handles HTTP communication with appropriate error handling and debug logging.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java (10)
51-67
: Well-implemented singleton pattern with proper resource initialization.The singleton implementation is thread-safe and properly initializes required resources. The use of a single-threaded executor is appropriate for sequential cleanup operations.
117-139
: Excellent graceful shutdown implementation.The stop method properly handles the shutdown lifecycle with timeout, forced shutdown, and thread interruption. This follows best practices for ExecutorService shutdown.
144-177
: Well-structured cleanup task with proper error handling.The cleanup task correctly calculates timestamp thresholds and handles both expected APIManagementException and unexpected exceptions appropriately. The logging provides good visibility into cleanup operations.
184-187
: Simple and appropriate state query method.The isRunning method provides clean access to the scheduler state, which is useful for monitoring and debugging.
19-31
: LGTM!The package declaration and imports are appropriate for this scheduler implementation.
40-54
: Well-structured singleton implementation.The class follows proper singleton pattern with appropriate member variables and initialization. The private constructor correctly initializes the DAO and scheduler instances.
56-67
: Thread-safe singleton implementation.The synchronized getInstance method ensures thread safety with proper lazy initialization. This approach is simpler and safer than double-checked locking for this use case.
77-110
: Robust scheduler startup implementation.The start method properly handles:
- Duplicate start attempts with guard condition
- Configuration retrieval and validation
- Graceful handling when cleanup is disabled
- Comprehensive logging and error handling
- Proper scheduling setup with configurable intervals
117-139
: Proper executor service shutdown implementation.The stop method follows best practices:
- Graceful shutdown with reasonable 60-second timeout
- Proper handling of InterruptedException with thread interrupt restoration
- Force shutdown as fallback
- Appropriate state management and logging
144-187
: Well-implemented cleanup task logic.The GatewayCleanupTask properly:
- Calculates expiration and retention thresholds based on configuration
- Executes cleanup operations through DAO methods
- Handles both specific and generic exceptions
- Provides appropriate logging for monitoring cleanup operations
- Includes a simple state check method
The timestamp calculations and DAO method invocations are correct.
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/templates/repository/conf/api-manager.xml.j2 (1)
417-423
: LGTM! Well-structured configuration section.The
GatewayCleanupConfiguration
section is properly implemented with consistent naming conventions and appropriate template variable usage.components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/InMemoryAPIDeployer.java (2)
353-409
: LGTM! Comprehensive deployment status trackingThe integration of
DeploymentStatusNotifier
properly tracks deployment status for all scenarios:
- Initial deployments
- Redeployments with revision changes
- Failed deployments with error details
The implementation ensures deployment outcomes are consistently reported to the monitoring system.
365-365
: Confirm case sensitivity of API revision IDsPlease verify whether API revision identifiers in your system are case-sensitive. The only occurrence of a case-insensitive comparison is here:
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/InMemoryAPIDeployer.java:365
if (!api.getRevisionId().equalsIgnoreCase(gatewayAPIDTO.getRevision())) {If revision IDs must match exactly (including case), replace
equalsIgnoreCase
withequals()
. Otherwise, the current comparison is acceptable.components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIManagerConfiguration.java (7)
54-54
: LGTM!The import for
GatewayCleanupConfiguration
is correctly placed and follows the established package structure.
78-78
: LGTM!The import for
GatewayNotificationConfiguration
is correctly placed and follows the established package structure.
152-152
: LGTM!The field declaration follows the established pattern for configuration objects in this class, with proper initialization to prevent null pointer issues.
234-234
: LGTM!The field declaration follows the established pattern for configuration objects in this class, with proper initialization to prevent null pointer issues.
790-794
: LGTM!The XML parsing conditional blocks follow the established pattern used throughout this method. The use of constants for element names ensures consistency and maintainability.
3032-3034
: LGTM!The getter method follows the established pattern and provides appropriate access to the configuration object.
3095-3097
: LGTM!The getter method follows the established pattern and provides appropriate access to the configuration object.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (1)
305-354
: Well-implemented shutdown logicThe shutdown method properly handles all cleanup tasks including:
- Canceling scheduled tasks
- Flushing pending batches
- Graceful shutdown with timeouts
- Forced shutdown as fallback
- Proper interrupt handling
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (1)
40-397
: Well-structured DAO implementationThe DAO follows good practices:
- Proper use of prepared statements
- Consistent error handling
- Resource management with try-with-resources
- Clear separation of concerns
Consider adding bulk operations in the future if performance becomes a concern when processing multiple deployment updates.
...rbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
Outdated
Show resolved
Hide resolved
...rbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
Outdated
Show resolved
Hide resolved
...rbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
Outdated
Show resolved
Hide resolved
....carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/DataHolder.java
Show resolved
Hide resolved
...mgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
Outdated
Show resolved
Hide resolved
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
Outdated
Show resolved
Hide resolved
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
Outdated
Show resolved
Hide resolved
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
Outdated
Show resolved
Hide resolved
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
Outdated
Show resolved
Hide resolved
features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review continued from previous batch...
...rbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
Outdated
Show resolved
Hide resolved
....carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/DataHolder.java
Show resolved
Hide resolved
...n.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayCleanupConfiguration.java
Outdated
Show resolved
Hide resolved
b0caf1c
to
9f570ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
♻️ Duplicate comments (12)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java (2)
19717-19722
: Fix misleading JavadocThe Javadoc mentions "Handle connection rollback logic" but this method doesn't handle any connection rollback. It processes ResultSet and builds a list of APIRevisionDeployment objects.
- /** - * Handle connection rollback logic. Rethrow original exception so that it can be handled centrally. - * @param rs result set - * @throws SQLException sql exception - * @throws APIManagementException api management exception - */ + /** + * Merge revision deployment DTOs from ResultSet and enrich with gateway deployment statistics + * @param rs result set containing revision deployment data + * @return list of APIRevisionDeployment objects with deployment statistics + * @throws SQLException if database access error occurs + * @throws APIManagementException if error occurs while processing deployments + */
19792-19845
: Resource management issues in calculateGatewayDeploymentStatsThe method has several resource management issues:
- Connection is obtained but might not be properly closed if an exception occurs between the two queries
- The error is logged but swallowed, which could hide critical issues
- Two separate queries could be combined for better performance
The current implementation closes resources incorrectly between queries:
- Line 19823 closes the PreparedStatement and ResultSet but keeps the connection open
- If an exception occurs after this line, the connection might leak
- APIMgtDBUtil.closeAllConnections(ps, null, resultSet); - + APIMgtDBUtil.closeAllConnections(ps, null, resultSet); + ps = null; + resultSet = null;Also, consider propagating the SQLException instead of just logging it:
} catch (SQLException e) { - log.error("Error while calculating gateway deployment statistics for revision: " + revisionUuid + - " and environment: " + environmentName, e); + handleException("Error while calculating gateway deployment statistics for revision: " + revisionUuid + + " and environment: " + environmentName, e);components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (1)
67-70
: Address SQL wildcard vulnerability in environment filteringThe LIKE queries for environment filtering are vulnerable to SQL wildcard injection if environmentId contains '%' or '_' characters, which could lead to unintended matches.
This issue was already identified in a previous review. Please implement the suggested wildcard escaping fix.
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (3)
2044-2051
: Typos in public API surface – “instant” ➜ “instance”.
The newly-added operation still exposes the misspelling “instant” (summary, description, schema names). This was raised earlier but not fixed; once released it becomes a permanent breaking-change.
2073-2075
: Over-permissive scope – useapim:environment_read
for a pure GET.The endpoint is read-only;
apim:environment_manage
is unnecessary and violates the least-privilege rule.- - OAuth2Security: - - apim:admin - - apim:environment_manage + - OAuth2Security: + - apim:admin + - apim:environment_read
5375-5387
: Schema field conventions not followed.
gatewayID
→gatewayId
(camel-case Id convention).lastActive
lacksformat: date-time
.status
should be anenum: [ACTIVE, INACTIVE, STALE]
.- gatewayID: + gatewayId: type: string example: "Env1_1372344" - lastActive: - type: string + lastActive: + type: string + format: date-time - status: - type: string - example: "ACTIVE" + status: + type: string + enum: [ACTIVE, INACTIVE, STALE] + example: ACTIVEcomponents/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (3)
53-55
: Fix thread safety issues with static field modifications.The static fields
notifyIntervalSeconds
,gatewayNotificationEnabled
, andgatewayID
are modified in the constructor, which creates thread safety issues if multiple instances are created concurrently. Since this is a singleton, these should be instance fields instead.Also applies to: 77-85
214-215
: Potential resource leak when reading response content.Using
readAllBytes()
on the InputStream can cause resource leaks if an exception occurs. Consider using try-with-resources or proper resource management.
258-260
: Same resource leak issue as in registration logic.The response content reading has the same potential resource leak issue as the registration logic.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (2)
55-56
: Avoid modifying static fields from instance methods.The configuration fields (batchSize, batchIntervalMillis) are declared as static but modified in the constructor. This is problematic because it creates confusion about whether these are class-level or instance-level configurations and could lead to race conditions in a multi-threaded environment.
Also applies to: 78-79, 94-95
173-173
: Consider adding queue size limits to prevent memory issues.When the gateway is not registered, jobs are queued indefinitely. This could lead to memory issues if the gateway never registers and jobs keep accumulating.
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml (1)
2308-2308
: Fix YAML formatting issue.YAMLlint detected too many spaces after the colon.
- title: API Revision Deployment Status acknowledgements List + title: API Revision Deployment Status acknowledgements List
🧹 Nitpick comments (9)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java (3)
33-49
: Fix typo in comment.The class design and field organization look good, but there's a typo in the comment.
- // define sheduled task interval in seconds + // define scheduled task interval in seconds
77-105
: Consider adding configuration validation.The start method is well-implemented with proper error handling and logging. However, consider validating configuration values to prevent issues.
if (!configuration.isEnabled()) { log.info("Gateway cleanup scheduler is disabled in configuration"); return; } + // Validate configuration values + int cleanupInterval = configuration.getGatewayCleanupConfiguration().getCleanupIntervalSeconds(); + if (cleanupInterval <= 0) { + log.error("Invalid cleanup interval: " + cleanupInterval + ". Must be positive."); + return; + } log.info("Starting Gateway cleanup scheduler with interval: " - + configuration.getGatewayCleanupConfiguration().getCleanupIntervalSeconds() + " Seconds"); + + cleanupInterval + " Seconds");
141-143
: Consider making isRunning field volatile for thread safety.While the current implementation works in practice, the
isRunning
field should be marked asvolatile
since it's accessed from multiple threads.- private boolean isRunning = false; + private volatile boolean isRunning = false;components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (5)
109-111
: Use APIMgtDBUtil.rollbackConnection for consistent error handlingConsider using the utility method for rollback to maintain consistency with the codebase pattern.
- } catch (SQLException e) { - connection.rollback(); - throw new APIManagementException("Error updating expired gateways", e); - } + } catch (SQLException e) { + APIMgtDBUtil.rollbackConnection(connection, "Error updating expired gateways", e); + }
141-143
: Use APIMgtDBUtil.rollbackConnection for consistent error handlingSame as the previous method, consider using the utility method for rollback.
- } catch (SQLException e) { - connection.rollback(); - throw new APIManagementException("Error deleting old gateway records", e); - } + } catch (SQLException e) { + APIMgtDBUtil.rollbackConnection(connection, "Error deleting old gateway records", e); + }
225-239
: Consider reordering parameters to match SQL column orderThe parameter order in the method signature doesn't match the SQL column order, which could be confusing for maintenance.
Consider reordering to match the SQL:
- public void insertDeployment(String gatewayId, String apiId, String status, Timestamp lastUpdated, String action, - String revisionId) throws APIManagementException { + public void insertDeployment(String gatewayId, String apiId, String status, String action, + String revisionId, Timestamp lastUpdated) throws APIManagementException {And update the parameter binding accordingly.
251-265
: Consider reordering parameters to match SQL column orderSame issue as insertDeployment method - parameter order doesn't match SQL column order.
Consider reordering for consistency:
- public void updateDeployment(String gatewayId, String apiId, String status, Timestamp lastUpdated,String action, - String revisionId) throws APIManagementException { + public void updateDeployment(String gatewayId, String apiId, String status, String action, + String revisionId, Timestamp lastUpdated) throws APIManagementException {
50-51
: Unused SQL constant for deployment cleanupThe
DELETE_OLD_DEPLOYMENTS_SQL
constant is defined but there's no corresponding method that uses it. This might indicate missing cleanup functionality.Would you like me to implement the missing
deleteOldDeploymentRecords()
method or is this intentionally reserved for future implementation?components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
5376-5387
: Minor naming/style nits
- The schema name is
GatewayInstance
but the title is lowercase gateway instances in the gateway environment – capitalise for consistency, e.g.Gateway Instance
.- Consider clarifying
lastActive
with an ISO-8601 format hint:lastActive: type: string format: date-time example: "2025-06-26T06:47:50Z"These tweaks improve generated docs and client typings.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (15)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyApiDeploymentStatusApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyApiDeploymentStatusApiService.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyGatewayApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyGatewayApiService.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/GatewayDeploymentStatusAcknowledgmentDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/GatewayDeploymentStatusAcknowledgmentListDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/GatewayPropertiesDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/InlineResponse200DTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/NotifyGatewayPayloadDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/dto/NotifyGatewayStatusResponseDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/EnvironmentsApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/EnvironmentsApiService.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/GatewayInstantDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/GatewayInstantListDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIRevisionDeploymentDTO.java
is excluded by!**/gen/**
📒 Files selected for processing (43)
components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/APIRevisionDeployment.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/InMemoryAPIDeployer.java
(3 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/DataHolder.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/GatewayRegistrationResponse.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
(6 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayStartupListener.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIManagerConfiguration.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIMgtDBUtil.java
(0 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/webapp/WEB-INF/web.xml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/internal/PublisherCommonServiceComponent.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIMappingUtil.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.default.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/templates/repository/conf/api-manager.xml.j2
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
(1 hunks)
💤 Files with no reviewable changes (1)
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIMgtDBUtil.java
✅ Files skipped from review due to trivial changes (4)
- components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/internal/PublisherCommonServiceComponent.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
🚧 Files skipped from review as they are similar to previous changes (29)
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/webapp/WEB-INF/web.xml
- components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
- components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/APIRevisionDeployment.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayStartupListener.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/GatewayRegistrationResponse.java
- components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.default.json
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/templates/repository/conf/api-manager.xml.j2
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/DataHolder.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIManagerConfiguration.java
- components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/common/mappings/APIMappingUtil.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
- components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/InMemoryAPIDeployer.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
🧰 Additional context used
🧬 Code Graph Analysis (2)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java (2)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (1)
GatewayManagementDAO
(40-397)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java (1)
GatewayNotificationConfiguration
(24-210)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (1)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIMgtDBUtil.java (1)
APIMgtDBUtil
(50-253)
🪛 YAMLlint (1.37.1)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
[warning] 2308-2308: too many spaces after colon
(colons)
🪛 Gitleaks (8.27.2)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
2078-2078: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
2078-2078: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build-product (4, group4)
- GitHub Check: build-product (1, group1)
- GitHub Check: run-benchmark-test
- GitHub Check: build-product (2, group2)
- GitHub Check: build-product (3, group3)
- GitHub Check: build-carbon
🔇 Additional comments (14)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java (4)
19-31
: LGTM! Clean and necessary imports.The package structure follows WSO2 Carbon conventions and all imports are relevant to the scheduler functionality.
51-67
: LGTM! Proper singleton implementation.The singleton pattern is correctly implemented with thread safety. The synchronized method approach is appropriate for this use case where getInstance() calls are infrequent.
112-134
: Excellent shutdown implementation!This follows Java concurrent best practices perfectly - graceful shutdown with timeout, proper InterruptedException handling, and thread interrupt status restoration.
148-182
: LGTM! Robust cleanup task implementation.The cleanup logic is well-designed with proper error handling, timestamp calculations, and logging. The two-phase approach (expire then delete) is logical and the non-atomic nature is acceptable for cleanup operations.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java (1)
19708-19708
: LGTM - Method call updated correctlyThe method call has been updated to use the new local implementation instead of the external utility method.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (9)
159-169
: Well-implemented existence checkThe method uses efficient SELECT 1 pattern and proper resource management. Good implementation.
180-192
: Clean insert implementationThe method properly handles resource management and parameter binding. The hardcoded "ACTIVE" status is appropriate for new gateway insertions.
202-213
: Consistent existence check implementationFollows the same efficient pattern as gatewayExists method. Well implemented.
275-285
: Appropriate heartbeat update implementationThe method correctly updates the timestamp and sets status to "ACTIVE" for heartbeat updates. Good implementation.
297-310
: Well-implemented gateway instance updateThe method properly updates gateway instance information and sets appropriate status. Good implementation.
327-340
: Good result mapping implementationThe result set mapping to GatewayInstanceInfo objects is well implemented with proper resource management.
350-364
: Robust timestamp comparison logicThe method correctly handles timestamp comparison with proper null checking and handles the non-existence case appropriately.
375-390
: Consistent timestamp comparison implementationFollows the same robust pattern as isGatewayTimestampInorder method. Well implemented.
392-396
: Appropriate data transfer objectSimple and effective data class for transferring gateway instance information. The public fields are acceptable for internal DAO usage.
...rbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
Outdated
Show resolved
Hide resolved
...rbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
Outdated
Show resolved
Hide resolved
...mgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
Outdated
Show resolved
Hide resolved
...mgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
Outdated
Show resolved
Hide resolved
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
Outdated
Show resolved
Hide resolved
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
Outdated
Show resolved
Hide resolved
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (14)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (1)
137-163
: Gateway cleanup task implementation is correct and focused.Based on the retrieved learning, the data retention cleanup is handled at the data insertion location rather than in this periodic task. The current implementation correctly focuses only on marking gateways as expired based on heartbeat inactivity, which aligns with the architectural decision.
The error handling, logging, and transaction management are all properly implemented.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (2)
249-263
: Parameter order mismatch between method signature and SQL execution.The method signature has parameters in the order:
gatewayId, apiId, status, lastUpdated, action, revisionUuid
, but the SQL parameters are set in a different order:gatewayId, apiId, status, action, revisionUuid, lastUpdated
.Apply this diff to fix the parameter order:
- public void insertDeployment(String gatewayId, String apiId, String status, Timestamp lastUpdated, String action, - String revisionUuid) throws APIManagementException { + public void insertDeployment(String gatewayId, String apiId, String status, String action, + String revisionUuid, Timestamp lastUpdated) throws APIManagementException {
275-289
: Same parameter order issue in updateDeployment method.The method has the same parameter order inconsistency as
insertDeployment
, plus a missing space after comma in the signature.Apply this diff to fix both issues:
- public void updateDeployment(String gatewayId, String apiId, String status, Timestamp lastUpdated,String action, - String revisionUuid) throws APIManagementException { + public void updateDeployment(String gatewayId, String apiId, String status, String action, + String revisionUuid, Timestamp lastUpdated) throws APIManagementException {components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (3)
5362-5375
: GatewayInstanceList title & items reference are still inconsistent
The schema still carries the misleading title Environment List and points to the correctGatewayInstance
items, but the title should be Gateway Instance List for clarity.This has been pointed out in a prior round; please update to avoid confusion in generated docs/SDKs.
5376-5387
: Property casing/typing tweaks remain unaddressed
gatewayID
breaks camel-case convention (gatewayId
elsewhere).
lastActive
lacks aformat: date-time
.
Consider restrictingstatus
with an enum[ACTIVE, INACTIVE, OFFLINE]
.Same feedback was given earlier – re-raising for completeness.
2044-2080
: Add the standard406 NotAcceptable
response to align with other collection endpointsAll existing
GET
collection endpoints in this file expose a406
error contract (see/throttling/policies/application
or/subscriptions
above). Omitting it here breaks symmetry and can trip code-gen tooling that relies on a uniform error matrix.@@ $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable'components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
5362-5387
: Rename fields & add missing schema metadata for GatewayInstance / GatewayInstanceListThe new schemas still carry the issues called out in earlier reviews:
gatewayID
breaks the repo-wide camel-case Id convention (environmentId
,applicationId
, …).lastActive
is a timestamp but missesformat: date-time
, so generators treat it as a plain string.status
should be an explicit enum (ACTIVE
,INACTIVE
,STALE
) to guide clients.GatewayInstanceList.title
is copy-pasted (“Environment List”) which is misleading.- GatewayInstanceList: - title: Environment List + GatewayInstanceList: + title: Gateway Instance List ... - gatewayID: + gatewayId: type: string example: "Env1_1372344" ... - lastActive: - type: string + lastActive: + type: string + format: date-time example: "2025-06-26T06:47:50Z" ... - status: - type: string - example: "ACTIVE" + status: + type: string + enum: [ACTIVE, INACTIVE, STALE] + example: ACTIVEFixing this now prevents a permanent public-API wart and avoids messy breaking changes later.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (3)
104-109
: Use thread pool instead of creating threads manually.Creating threads manually can lead to resource issues. Consider using the existing scheduler or a dedicated thread pool for gateway registration.
public void registerGateway() { if (log.isDebugEnabled()) { log.debug("Registering Gateway with ID: " + gatewayID); } - new Thread(new registerGateway()).start(); + scheduler.submit(new registerGateway()); }
222-224
: Potential resource leak when reading response content.Using
readAllBytes()
on the InputStream can cause resource leaks if an exception occurs. Consider using try-with-resources or proper resource management.- String responseBody = new String(response.getEntity().getContent().readAllBytes(), - StandardCharsets.UTF_8); + try (InputStream inputStream = response.getEntity().getContent()) { + String responseBody = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8); + }
267-269
: Same resource leak issue as in registration logic.The response content reading has the same potential resource leak issue as the registration logic.
- String responseBody = new String(response.getEntity().getContent().readAllBytes(), - StandardCharsets.UTF_8); + try (InputStream inputStream = response.getEntity().getContent()) { + String responseBody = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8); + }components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (2)
199-199
: Consider adding queue size limits to prevent memory issues.When the gateway is not registered, jobs are queued indefinitely. This could lead to memory issues if the gateway never registers and jobs keep accumulating.
+ private static final int MAX_QUEUE_SIZE = 10000; // Add as configurable parameter + private void handleBatchedSubmission(DeploymentStatusJob job) { + if (currentBatch.size() >= MAX_QUEUE_SIZE) { + log.warn("Deployment status queue is full. Dropping oldest job."); + currentBatch.poll(); // Remove oldest + } currentBatch.offer(job); // rest of method... private void handleImmediateSubmission(DeploymentStatusJob job) { if (DataHolder.getInstance().isGatewayRegistered()) { // ... existing logic } else { + if (currentBatch.size() >= MAX_QUEUE_SIZE) { + log.warn("Deployment status queue is full. Dropping oldest job."); + currentBatch.poll(); // Remove oldest + } currentBatch.offer(job); } }Also applies to: 215-215
303-305
: Fix potential resource leak in response handling.The InputStream from
response.getEntity().getContent()
should be properly closed to prevent resource leaks.- String responseBody = new String(response.getEntity().getContent().readAllBytes(), - StandardCharsets.UTF_8); + String responseBody; + try (InputStream inputStream = response.getEntity().getContent()) { + responseBody = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8); + }components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml (2)
1180-1190
: Response schema still an ad-hoc{status: string}
objectPrevious review recommended re-using the concrete
GatewayDeploymentStatusAcknowledgmentList
(or a dedicated result DTO) instead of a generic status wrapper, to keep the contract self-documenting and SDK-friendly. The change has not been applied.
2310-2311
: Remove the extra space after the colon intitle
YAML-lint still flags “too many spaces after colon”.
- title: API Revision Deployment Status acknowledgements List + title: API Revision Deployment Status acknowledgements List
🧹 Nitpick comments (4)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (1)
55-56
: Fix incorrect class name in JavaDoc comment.The JavaDoc comment refers to "GatewayCleanupScheduler" but the actual class name is "GatewayValidationScheduler".
- * Returns the singleton instance of GatewayCleanupScheduler. + * Returns the singleton instance of GatewayValidationScheduler.components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
2044-2080
: Consider adding the standardAccept
header parameter for consistencyMost list endpoints in this spec include the reusable
Accept
header parameter (#/components/parameters/Accept
). The new/environments/{environmentId}/gateways
GET omits it, which makes the surface slightly inconsistent and forces clients to rely on defaults.parameters: - $ref: '#/components/parameters/environmentId' + - $ref: '#/components/parameters/Accept'
Not critical, but aligning with the common pattern avoids surprises for client generators that rely on explicit media‐type negotiation.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (1)
264-264
: Consider using retry logic for heartbeat requests.The registration logic uses
APIUtil.executeHTTPRequestWithRetries()
but the heartbeat uses directhttpClient.execute()
. For consistency and resilience, consider applying the same retry logic to heartbeat requests.- HttpResponse response = httpClient.execute(request); + try (CloseableHttpResponse response = APIUtil.executeHTTPRequestWithRetries(request, httpClient, + retryDuration, + maxRetryCount, + retryProgressionFactor)) {components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml (1)
1126-1165
: Consider returning 201 Created on successful gateway registrationA heartbeat is idempotent, but a registration creates a new resource (gateway instance). Using HTTP 201 for the REGISTER flow better reflects REST semantics and helps SDKs distinguish the two cases. Example diff:
- responses: - '200': - description: Successful response for registration or heartbeat. + responses: + '201': + description: Gateway registered successfully. + content: + application/json: + schema: + $ref: '#/components/schemas/NotifyGatewayStatusResponse' + '200': + description: Heartbeat acknowledged. ...This is optional, but improves API expressiveness.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyGatewayApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/EnvironmentsApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIRevisionDeploymentDTO.java
is excluded by!**/gen/**
📒 Files selected for processing (30)
components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
(5 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
(3 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
🚧 Files skipped from review as they are similar to previous changes (20)
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.048Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.822Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:35.964Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.654Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.822Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: wso2/carbon-apimgt#13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java:0-0
Timestamp: 2025-07-28T02:15:19.932Z
Learning: In WSO2 Carbon API Manager, the AM_GW_REVISION_DEPLOYMENT table uses the column name REVISION_ID (not REVISION_UUID) for referencing API revision identifiers. This is distinct from other tables (like AM_REVISION) that use REVISION_UUID.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (8)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.048Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:35.964Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (9)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:137-163
Timestamp: 2025-07-28T14:26:37.442Z
Learning: In the GatewayValidationScheduler class, the data retention cleanup is handled at the data insertion location rather than in the periodic GatewayValidationTask. The scheduler task only handles marking gateways as expired based on heartbeat inactivity.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java:0-0
Timestamp: 2025-07-28T03:41:10.644Z
Learning: In WSO2 Carbon API Manager, scheduler.scheduleAtFixedRate calls are not typically wrapped in try-catch blocks, following a consistent pattern across the codebase. This design decision prioritizes consistency with existing scheduler implementations over additional error handling.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/Environment.java:341-355
Timestamp: 2025-07-19T14:50:12.218Z
Learning: In WSO2 Carbon API Manager, input validation for model properties like apiDiscoveryScheduledWindow is performed at the REST API level rather than in individual setter methods, avoiding code duplication and ensuring validation occurs at the entry point.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AzureContentSafetyGuardrailProviderServiceImpl.java:75-84
Timestamp: 2025-06-30T06:50:20.514Z
Learning: In WSO2 Carbon API Manager, initialization of service components (like GuardrailProviderService implementations) is guaranteed to occur before service methods are called, so additional initialization validation checks in service methods are not needed.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:35.964Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (9)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:35.964Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/test/java/org/wso2/carbon/apimgt/spec/parser/definitions/OASParserUtilTest.java:174-176
Timestamp: 2025-06-18T08:15:46.118Z
Learning: CodeRabbit flagged duplicate production flags in OASParserUtilTest.java but provided incorrect line numbers (174-176). The actual issue exists at lines 403 and 430 where sandbox endpoint tests incorrectly use the true
flag instead of false
.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:11919-11923
Timestamp: 2025-06-30T06:27:48.390Z
Learning: In the WSO2 API Manager codebase, the input to the createCanonicalQueryString
method in APIUtil.java
is already URL encoded, so additional encoding within this method is not required and should be avoided to prevent double encoding.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:137-163
Timestamp: 2025-07-28T14:26:37.442Z
Learning: In the GatewayValidationScheduler class, the data retention cleanup is handled at the data insertion location rather than in the periodic GatewayValidationTask. The scheduler task only handles marking gateways as expired based on heartbeat inactivity.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (16)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:35.964Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.048Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.822Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.822Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:137-163
Timestamp: 2025-07-28T14:26:37.442Z
Learning: In the GatewayValidationScheduler class, the data retention cleanup is handled at the data insertion location rather than in the periodic GatewayValidationTask. The scheduler task only handles marking gateways as expired based on heartbeat inactivity.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java:319-340
Timestamp: 2025-07-28T02:28:05.259Z
Learning: In WSO2 Carbon API Manager, environment IDs are validated during environment creation to prevent SQL wildcard characters (% and _), eliminating the need for SQL wildcard escaping in queries that use environment IDs as parameters.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:11919-11923
Timestamp: 2025-06-30T06:27:48.390Z
Learning: In the WSO2 API Manager codebase, the input to the createCanonicalQueryString
method in APIUtil.java
is already URL encoded, so additional encoding within this method is not required and should be avoided to prevent double encoding.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.654Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java:0-0
Timestamp: 2025-07-28T02:15:19.932Z
Learning: In WSO2 Carbon API Manager, the AM_GW_REVISION_DEPLOYMENT table uses the column name REVISION_ID (not REVISION_UUID) for referencing API revision identifiers. This is distinct from other tables (like AM_REVISION) that use REVISION_UUID.
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml (14)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.048Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:35.964Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.822Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java:0-0
Timestamp: 2025-07-28T02:15:19.932Z
Learning: In WSO2 Carbon API Manager, the AM_GW_REVISION_DEPLOYMENT table uses the column name REVISION_ID (not REVISION_UUID) for referencing API revision identifiers. This is distinct from other tables (like AM_REVISION) that use REVISION_UUID.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.822Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.654Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (13)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.822Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.822Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.048Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:35.964Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java:0-0
Timestamp: 2025-07-28T02:15:19.932Z
Learning: In WSO2 Carbon API Manager, the AM_GW_REVISION_DEPLOYMENT table uses the column name REVISION_ID (not REVISION_UUID) for referencing API revision identifiers. This is distinct from other tables (like AM_REVISION) that use REVISION_UUID.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.654Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (13)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.822Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.822Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.048Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java:0-0
Timestamp: 2025-07-28T02:15:19.932Z
Learning: In WSO2 Carbon API Manager, the AM_GW_REVISION_DEPLOYMENT table uses the column name REVISION_ID (not REVISION_UUID) for referencing API revision identifiers. This is distinct from other tables (like AM_REVISION) that use REVISION_UUID.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:262-276
Timestamp: 2025-06-18T10:07:57.821Z
Learning: In the GraphQLSchemaDefinition class (and potentially other areas of the WSO2 API Manager codebase), template.getAuthType() can return null, which creates NPE risks when calling .equalsIgnoreCase() on the result. This specific issue has been tracked in wso2/api-manager#3971.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:35.964Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
🧬 Code Graph Analysis (2)
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (4)
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/internal/DataHolder.java (1)
DataHolder
(43-431)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (2)
APIConstants
(32-3519)GatewayNotification
(3460-3518)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java (2)
GatewayNotificationConfiguration
(24-210)DeploymentAcknowledgementConfiguration
(98-144)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java (1)
APIUtil
(338-12008)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (1)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIMgtDBUtil.java (1)
APIMgtDBUtil
(50-253)
🪛 YAMLlint (1.37.1)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
[warning] 2310-2310: too many spaces after colon
(colons)
🪛 Gitleaks (8.27.2)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
2078-2078: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
2078-2078: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build-product (2, group2)
- GitHub Check: build-product (4, group4)
- GitHub Check: build-product (3, group3)
- GitHub Check: build-product (1, group1)
- GitHub Check: build-carbon
- GitHub Check: run-benchmark-test
🔇 Additional comments (20)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (2)
71-98
: LGTM! Scheduler initialization and startup logic is well-implemented.The start method correctly handles:
- Thread-safe singleton initialization
- Configuration validation and early return if disabled
- Proper scheduler setup with configured intervals
- Comprehensive logging for operational visibility
The implementation follows WSO2 Carbon API Manager patterns for scheduler components.
103-125
: Excellent shutdown handling with proper resource cleanup.The stop method implements robust shutdown logic:
- Graceful shutdown with timeout handling
- Force shutdown as fallback
- Proper interrupt handling to maintain thread state
- Clear status tracking
This follows best practices for executor service lifecycle management.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (8)
45-80
: SQL query constants are well-defined and secure.The SQL queries use proper parameterized statements to prevent SQL injection. The query structure aligns with the database schema design mentioned in the retrieved learnings.
100-123
: Excellent transaction management in cleanup operations.The
updateExpiredGateways
method correctly:
- Uses transactions with proper commit/rollback handling
- Implements appropriate error handling and logging
- Returns meaningful counts for operational monitoring
132-155
: Robust implementation of data retention cleanup.The
deleteOldGatewayRecords
method follows the same excellent pattern as the expiration method with proper transaction handling and logging.
185-216
: Well-structured gateway instance insertion with environment mapping.The method correctly handles the normalized relationship between gateway instances and environment labels using transactions to ensure data consistency.
321-358
: Sophisticated gateway update with environment mapping refresh.The
updateGatewayInstance
method properly handles the complex update scenario by:
- Updating the main gateway record
- Clearing existing environment mappings
- Inserting new environment mappings
- All within a transaction for consistency
This correctly implements the normalized relationship design mentioned in the retrieved learnings.
367-385
: Simple and effective environment-based gateway querying.The
getGatewayInstancesByEnvironment
method uses a proper JOIN to retrieve gateway instances for a specific environment. Based on the retrieved learning, environment IDs are validated during creation to prevent SQL wildcard characters, so no additional escaping is needed.
395-409
: Timestamp validation methods prevent out-of-order updates.These methods provide important safeguards against processing stale heartbeat or deployment messages. The logic correctly handles the case where records don't exist by returning false, ensuring that updates are only applied when they represent newer information.
Also applies to: 420-435
454-458
: Simple and appropriate data transfer object.The
GatewayInstanceInfo
class provides a clean way to return gateway instance data. The public fields approach is appropriate for this internal DTO use case.components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (3)
54-92
: LGTM! Thread safety issues have been resolved.The singleton implementation correctly uses
volatile
for the instance field and all configuration fields are now properly declared as instance fields rather than static. The constructor properly initializes configuration from the API Manager configuration service.
144-185
: LGTM! Well-structured payload building.Both payload building methods properly handle edge cases like null gatewayID and network address resolution failures. The JSON structure follows the API specification and includes proper error handling.
115-142
: LGTM! Proper lifecycle management.The heartbeat lifecycle methods implement proper resource management with graceful shutdown, timeout handling, and appropriate thread interruption. The configuration check prevents unnecessary resource usage when heartbeat is disabled.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (6)
73-89
: LGTM! Static field issues have been resolved.The configuration fields are now properly declared as final instance fields and initialized from the configuration service in the constructor. This addresses the previous thread safety concerns with static field modifications.
94-103
: LGTM! Thread-safe singleton implementation.The double-checked locking pattern is correctly implemented with a volatile instance field and proper synchronization.
105-126
: LGTM! Well-designed thread pool management.The thread pool creation uses proper thread factories with daemon threads and atomic counters for naming. The separation of scheduler and processor thread pools provides good isolation of concerns.
232-248
: LGTM! Robust batch processing with proper error handling.The batch submission uses proper thread pool management with graceful degradation (CallerRunsPolicy) and fallback processing in the current thread on rejection. The debug logging provides good visibility into thread pool utilization.
318-353
: LGTM! Well-structured data classes.The
BatchPayload
andDeploymentStatusJob
classes are properly designed to match the API specification. The constructor properly handles null values and timestamp generation, and the field mapping aligns with the expected DTO structure.
136-154
: LGTM! Proper resource cleanup on shutdown.The shutdown method implements proper executor service cleanup with appropriate timeouts, graceful termination attempts, and fallback to forced shutdown. Thread interruption is handled correctly.
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml (1)
2254-2283
: Verify server-side validation ofgatewayId
for HEARTBEAT payloads
gatewayId
is optional in the unifiedNotifyGatewayPayload
, but a heartbeat from an un-registered gateway is meaningless. Ensure the implementation rejects HEARTBEAT requests missinggatewayId
, even though the schema allows it.
b7aa332
to
300dbb5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (5)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (2)
5362-5374
: Schema title is still wrong – should be “Gateway Instance List”The title string was not updated when the schema name changed from GatewayInstantList to GatewayInstanceList.
- GatewayInstanceList: - title: Environment List + GatewayInstanceList: + title: Gateway Instance List
5376-5387
: Property naming & metadata still deviate from existing conventions
gatewayID
→gatewayId
(camel-case Id likeenvironmentId
,applicationId
, …)lastActive
should specifyformat: date-time
so generators treat it as a timestamp.status
is a free-form string – add an explicit enum (ACTIVE
,INACTIVE
,STALE
, …) to guide clients.GatewayInstance: - title: gateway Instances in the gateway environment + title: Gateway instance in the gateway environment type: object properties: - gatewayID: + gatewayId: type: string example: "Env1_1372344" - lastActive: - type: string + lastActive: + type: string + format: date-time example: "2025-06-26T06:47:50Z" - status: - type: string - example: "ACTIVE" + status: + type: string + enum: [ACTIVE, INACTIVE, STALE] + example: ACTIVEcomponents/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (2)
298-308
: Fix potential resource leak in response handling.The InputStream from
response.getEntity().getContent()
should be properly closed to prevent resource leaks.- String responseBody = new String(response.getEntity().getContent().readAllBytes(), - StandardCharsets.UTF_8); + String responseBody; + try (InputStream inputStream = response.getEntity().getContent()) { + responseBody = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8); + }
198-217
: Consider adding queue size limits to prevent potential memory issues.When the gateway is not registered, jobs are queued indefinitely in
currentBatch
(lines 199 and 215). If the gateway never registers or takes a long time to register, this could lead to unbounded memory growth.Consider adding a configurable maximum queue size:
+private static final int MAX_QUEUE_SIZE = 10000; // Make this configurable private void handleBatchedSubmission(DeploymentStatusJob job) { + if (currentBatch.size() >= MAX_QUEUE_SIZE) { + log.warn("Deployment status queue is full. Dropping oldest job."); + currentBatch.poll(); // Remove oldest + } currentBatch.offer(job); // ... rest of method } private void handleImmediateSubmission(DeploymentStatusJob job) { if (DataHolder.getInstance().isGatewayRegistered()) { List<DeploymentStatusJob> singleJobList = Collections.singletonList(job); submitBatchForProcessing(singleJobList); } else { + if (currentBatch.size() >= MAX_QUEUE_SIZE) { + log.warn("Deployment status queue is full. Dropping oldest job."); + currentBatch.poll(); // Remove oldest + } currentBatch.offer(job); } }components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml (1)
2310-2311
: YAML-lint: double space after colon still present
Previous review already highlighted this — the extra space before “API” violates YAML style and may break tooling.- title: API Revision Deployment Status acknowledgements List + title: API Revision Deployment Status acknowledgements List
🧹 Nitpick comments (5)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (1)
45-51
: Consider performance optimization for cleanup query.The
DELETE_OLD_DEPLOYMENTS_SQL
uses a subquery withNOT IN
which can be inefficient for large datasets and may not handle NULL values correctly.Consider using a LEFT JOIN approach for better performance:
-private static final String DELETE_OLD_DEPLOYMENTS_SQL = - "DELETE FROM AM_GW_REVISION_DEPLOYMENT WHERE GATEWAY_ID NOT IN (SELECT GATEWAY_ID FROM AM_GW_INSTANCES)"; +private static final String DELETE_OLD_DEPLOYMENTS_SQL = + "DELETE d FROM AM_GW_REVISION_DEPLOYMENT d LEFT JOIN AM_GW_INSTANCES g ON d.GATEWAY_ID = g.GATEWAY_ID WHERE g.GATEWAY_ID IS NULL";components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
2044-2080
: Add standardAccept
header & 406 response for consistency with other GET endpointsAll other read-only list endpoints in this spec include an
Accept
header parameter (via#/components/parameters/Accept
) and declare a406 NotAcceptable
response. Omitting it here makes the surface inconsistent and forces clients to guess the default.@@ parameters: - $ref: '#/components/parameters/environmentId' + - $ref: '#/components/parameters/Accept' @@ $ref: '#/components/responses/NotFound' + 406: + $ref: '#/components/responses/NotAcceptable'components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml (3)
2277-2283
: ClarifygatewayId
semantics for REGISTER vs. HEARTBEAT
The description implies the field is assigned on registration, yet it is also the identifier the gateway must send on subsequent heartbeats. A short note such as “Returned by the control-plane on successful registration; must be sent by the gateway on every subsequent request” removes ambiguity.
2315-2317
: Wrong wording in list schema description
GatewayDeploymentStatusAcknowledgmentList
is not “Number of APIs returned.” – replace “APIs” with “acknowledgments” to keep the contract self-describing.
2340-2344
:timeStamp
description references heartbeat, not deployment status
Copy-paste residue: this timestamp represents when the deployment event occurred, not a heartbeat. Update the description to avoid confusion for SDK generators.
300dbb5
to
5650dc2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (7)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (2)
5362-5374
: Schema title & naming mismatch
GatewayInstanceList
is titled “Environment List” – copy-paste residue that confuses client SDKs and documentation tooling. Rename to “Gateway Instance List”.- GatewayInstanceList: - title: Environment List + GatewayInstanceList: + title: Gateway Instance List
5376-5387
: Standardise property names & enrich schema metadata
gatewayID
,lastActive
, andstatus
still deviate from existing conventions and lack helpful metadata:
- Use
gatewayId
(camel-case Id) – aligns withenvironmentId
,applicationId
, etc.- Add
format: date-time
tolastActive
.- Restrict
status
with an explicit enum (ACTIVE
,INACTIVE
,STALE
, …).- GatewayInstance: - title: gateway Instances in the gateway environment + GatewayInstance: + title: Gateway instance in the gateway environment type: object properties: - gatewayID: + gatewayId: type: string example: "Env1_1372344" - lastActive: - type: string + lastActive: + type: string + format: date-time example: "2025-06-26T06:47:50Z" - status: - type: string - example: "ACTIVE" + status: + type: string + enum: [ACTIVE, INACTIVE, STALE] + example: ACTIVEcomponents/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
5376-5387
:gatewayID
casing & missingformat: date-time
– same concern as last reviewPrevious feedback requested:
- Rename
gatewayID
→gatewayId
(camel-case, aligns withenvironmentId
)- Annotate
lastActive
withformat: date-time
- Optional enum for
status
Those changes are still absent in this generated copy.
Re-sync with the source specification so both originals and generated artifacts reflect the agreed model.components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (3)
104-109
: Use thread pool instead of creating threads manually.Creating threads manually can lead to resource issues. Consider using the existing scheduler or a dedicated thread pool for gateway registration.
222-223
: Potential resource leak when reading response content.Using
readAllBytes()
on the InputStream can cause resource leaks if an exception occurs. Consider using try-with-resources or proper resource management.
267-268
: Same resource leak issue as in registration logic.The response content reading has the same potential resource leak issue as the registration logic.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (1)
198-217
: Consider adding queue size limits to prevent memory issues.When the gateway is not registered, jobs are queued indefinitely. This could lead to memory issues if the gateway never registers and jobs keep accumulating.
🧹 Nitpick comments (3)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
2044-2076
: Minor consistency nit – expose standardAccept
headerMost collection endpoints declare an
Accept
parameter for content negotiation./environments/{environmentId}/gateways
omits it, breaking spec uniformity.parameters: - $ref: '#/components/parameters/environmentId' + - $ref: '#/components/parameters/Accept'
Adding it keeps the contract symmetrical with the rest of the Admin API.
No functional impact – purely descriptive.components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (2)
2044-2076
: Add missing 406 response & standardAccept
header for contract symmetryAll collection-style
GET
endpoints in this spec expose a406 NotAcceptable
response and the reusableAccept
header parameter.
/environments/{environmentId}/gateways
omits both, breaking consistency and forcing client-side special-casing.@@ parameters: - $ref: '#/components/parameters/environmentId' + - $ref: '#/components/parameters/Accept' @@ ... + 406: + $ref: '#/components/responses/NotAcceptable'
5362-5374
: Schema title is misleading (‘Environment List’)
GatewayInstanceList
still carries the copy-pasted title “Environment List”, which confuses SDK generators and human readers.- GatewayInstanceList: - title: Environment List + GatewayInstanceList: + title: Gateway Instance List
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyGatewayApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/EnvironmentsApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIRevisionDeploymentDTO.java
is excluded by!**/gen/**
📒 Files selected for processing (31)
components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
(5 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
(3 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
🚧 Files skipped from review as they are similar to previous changes (23)
- components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like `/notify-api-deployment-status` in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: wso2/carbon-apimgt#13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (10)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/test/java/org/wso2/carbon/apimgt/spec/parser/definitions/OASParserUtilTest.java:174-176
Timestamp: 2025-06-18T08:15:46.118Z
Learning: CodeRabbit flagged duplicate production flags in OASParserUtilTest.java but provided incorrect line numbers (174-176). The actual issue exists at lines 403 and 430 where sandbox endpoint tests incorrectly use the true
flag instead of false
.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:11919-11923
Timestamp: 2025-06-30T06:27:48.390Z
Learning: In the WSO2 API Manager codebase, the input to the createCanonicalQueryString
method in APIUtil.java
is already URL encoded, so additional encoding within this method is not required and should be avoided to prevent double encoding.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:137-163
Timestamp: 2025-07-28T14:26:37.464Z
Learning: In the GatewayValidationScheduler class, the data retention cleanup is handled at the data insertion location rather than in the periodic GatewayValidationTask. The scheduler task only handles marking gateways as expired based on heartbeat inactivity.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (9)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (9)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:137-163
Timestamp: 2025-07-28T14:26:37.464Z
Learning: In the GatewayValidationScheduler class, the data retention cleanup is handled at the data insertion location rather than in the periodic GatewayValidationTask. The scheduler task only handles marking gateways as expired based on heartbeat inactivity.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java:0-0
Timestamp: 2025-07-28T03:41:10.644Z
Learning: In WSO2 Carbon API Manager, scheduler.scheduleAtFixedRate calls are not typically wrapped in try-catch blocks, following a consistent pattern across the codebase. This design decision prioritizes consistency with existing scheduler implementations over additional error handling.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/Environment.java:341-355
Timestamp: 2025-07-19T14:50:12.218Z
Learning: In WSO2 Carbon API Manager, input validation for model properties like apiDiscoveryScheduledWindow is performed at the REST API level rather than in individual setter methods, avoiding code duplication and ensuring validation occurs at the entry point.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AzureContentSafetyGuardrailProviderServiceImpl.java:75-84
Timestamp: 2025-06-30T06:50:20.514Z
Learning: In WSO2 Carbon API Manager, initialization of service components (like GuardrailProviderService implementations) is guaranteed to occur before service methods are called, so additional initialization validation checks in service methods are not needed.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (15)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (18)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:262-276
Timestamp: 2025-06-18T10:07:57.821Z
Learning: In the GraphQLSchemaDefinition class (and potentially other areas of the WSO2 API Manager codebase), template.getAuthType() can return null, which creates NPE risks when calling .equalsIgnoreCase() on the result. This specific issue has been tracked in wso2/api-manager#3971.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConsumerImpl.java:3454-3476
Timestamp: 2025-06-18T09:51:26.533Z
Learning: When reviewing code movement/refactoring PRs, if logical issues are discovered in the moved code that existed before the refactoring, it's appropriate to defer fixing them to a separate effort with proper issue tracking, rather than expanding the scope of the refactoring PR.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3885-3891
Timestamp: 2025-07-28T13:03:45.797Z
Learning: In WSO2 Carbon API Manager, BiyonFernando prefers storing JSON data in BLOB columns as it can be visualized from DB clients, rather than using CLOB for human-readable text storage.
🪛 Gitleaks (8.27.2)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
2078-2078: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
2078-2078: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
🔇 Additional comments (14)
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (4)
54-66
: LGTM! Thread safety issues have been resolved.The field declarations now correctly use instance fields instead of static fields, and the singleton instance is properly declared as volatile. This addresses the previous thread safety concerns.
71-92
: LGTM! Constructor properly initializes all configuration.The constructor correctly loads configuration from ServiceReferenceHolder, handles gateway ID initialization with proper fallback to UUID generation, and sets up all required fields.
94-99
: LGTM! Singleton pattern is correctly implemented.The singleton implementation uses proper synchronization with the volatile instance field, ensuring thread-safe lazy initialization.
144-185
: LGTM! Payload building methods are well implemented.Both
buildRegistrationPayload
andbuildHeartbeatPayload
methods correctly construct JSON payloads using Gson, handle timestamps properly, and include appropriate error handling for IP address retrieval.components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (4)
41-63
: LGTM! Singleton pattern and class structure are well implemented.The class correctly implements the singleton pattern with volatile instance field and proper synchronization. Constructor properly initializes dependencies.
71-98
: LGTM! Start method properly handles configuration and scheduling.The start method correctly checks running state, loads configuration, respects enable/disable settings, and properly schedules the cleanup task with appropriate intervals.
103-125
: LGTM! Stop method implements proper shutdown sequence.The stop method correctly implements graceful shutdown with timeout, proper exception handling, and thread interruption restoration following best practices for executor service shutdown.
137-163
: LGTM! Task implementation correctly handles gateway expiration.The
GatewayValidationTask
properly calculates expiration thresholds, marks expired gateways, and includes appropriate logging and error handling. The scope is correctly focused on expiration marking, with data retention cleanup handled at the data insertion location as clarified.components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (6)
67-72
: LGTM! Static field modification issues have been resolved.The configuration fields are now properly declared as instance fields instead of static fields, which addresses the previous thread safety concerns about modifying static fields from the constructor.
73-103
: LGTM! Constructor and singleton pattern are well implemented.The constructor properly loads configuration without modifying static fields, and the singleton pattern uses correct double-checked locking with proper synchronization.
105-131
: LGTM! Thread pool management is well designed.The class properly creates dedicated executors with custom thread factories, uses daemon threads appropriately, and configures thread pools with proper parameters and rejection policies.
136-154
: LGTM! Shutdown method implements proper cleanup.The shutdown method correctly handles graceful shutdown of both executors with appropriate timeouts, proper exception handling, and thread interruption restoration.
298-308
: LGTM! HTTP request handling properly uses try-with-resources.The HTTP request handling correctly uses try-with-resources for the CloseableHttpResponse, ensuring proper resource cleanup and preventing resource leaks.
332-353
: LGTM! DeploymentStatusJob class is well implemented.The inner class properly represents deployment status data with correct field initialization, appropriate type conversions, and proper null handling for optional fields.
@CodeRabbit review |
✅ Actions performedReview triggered.
|
5650dc2
to
5f20c93
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (3)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (2)
5376-5387
: Property casing & typing inconsistencies inGatewayInstance
Consistency with rest of OAS:
- Use camelCase (
gatewayId
) as elsewhere (environmentId
etc.).lastActive
should exposeformat: date-time
to aid tooling.status
values are well-defined (ACTIVE, INACTIVE, OFFLINE) – declare an enum.- gatewayID: + gatewayId: type: string example: "Env1_1372344" - lastActive: - type: string + lastActive: + type: string + format: date-time example: "2025-06-26T06:47:50Z" - status: - type: string - example: "ACTIVE" + status: + type: string + enum: [ACTIVE, INACTIVE, OFFLINE] + example: "ACTIVE"
5362-5374
: Schema title & items reference are misleading
GatewayInstanceList
is titled “Environment List”, which confuses doc-readers and code-gen tools. Rename to a meaningful title.- GatewayInstanceList: - title: Environment List + GatewayInstanceList: + title: Gateway Instance List ... - items: - $ref: '#/components/schemas/GatewayInstance' + items: + $ref: '#/components/schemas/GatewayInstance'components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
5362-5387
: Schema still carries earlier naming / typing issuesThe exact same observations were raised in a previous review; they remain unaddressed here.
- GatewayInstanceList: - title: Environment List + GatewayInstanceList: + title: Gateway instance list ... - list: + list: type: array items: $ref: '#/components/schemas/GatewayInstance' - GatewayInstance: - title: gateway Instances in the gateway environment + GatewayInstance: + title: Gateway instance in the gateway environment ... - gatewayID: + gatewayId: type: string example: "Env1_1372344" - lastActive: - type: string - example: "2025-06-26T06:47:50Z" + lastActive: + type: string + format: date-time + example: "2025-06-26T06:47:50Z" - status: - type: string - example: "ACTIVE" + status: + type: string + enum: [ACTIVE, INACTIVE, STALE] + example: ACTIVEThis aligns with prevailing conventions (
camelCase Id
,date-time
formats, explicitenum
s) and corrects the copy-paste title error.
🧹 Nitpick comments (4)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (3)
34-40
: Update class documentation to reflect actual implementation scope.Based on the retrieved learning that data retention cleanup is handled at data insertion location, the documentation should be updated to accurately reflect that this scheduler only handles marking gateways as expired, not the full cleanup operations mentioned.
/** * Scheduler for cleaning up gateway heartbeat data from the database. * This scheduler runs periodically to: * 1. Update gateway status to EXPIRED for gateways that haven't sent heartbeat within the expire time - * 2. Delete gateway records that are older than the data retention period - * 3. Clean up orphaned deployment records */
55-57
: Fix incorrect class name in JavaDoc comment.The comment refers to "GatewayCleanupScheduler" but the actual class name is "GatewayValidationScheduler".
/** - * Returns the singleton instance of GatewayCleanupScheduler. + * Returns the singleton instance of GatewayValidationScheduler. */
48-48
: Consider making isRunning volatile for better thread visibility.While not critical for this use case, making the
isRunning
field volatile would ensure immediate visibility of state changes across threads.- private boolean isRunning = false; + private volatile boolean isRunning = false;components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
2044-2080
: Consider adding the standardAccept
header parameter for response content negotiationAll list-fetching operations in this spec expose an
Accept
header parameter (e.g./throttling/policies/...
,/applications
,/environments
). Omitting it here introduces an inconsistency that client SDK generators and tooling rely on.parameters: + - $ref: '#/components/parameters/Accept' - $ref: '#/components/parameters/environmentId'
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyGatewayApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/EnvironmentsApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIRevisionDeploymentDTO.java
is excluded by!**/gen/**
📒 Files selected for processing (31)
components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
(5 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
- components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
🚧 Files skipped from review as they are similar to previous changes (25)
- components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
- components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like `/notify-api-deployment-status` in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: AnuGayan
PR: wso2/carbon-apimgt#13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (10)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:137-163
Timestamp: 2025-07-28T14:26:37.464Z
Learning: In the GatewayValidationScheduler class, the data retention cleanup is handled at the data insertion location rather than in the periodic GatewayValidationTask. The scheduler task only handles marking gateways as expired based on heartbeat inactivity.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java:0-0
Timestamp: 2025-07-28T03:41:10.644Z
Learning: In WSO2 Carbon API Manager, scheduler.scheduleAtFixedRate calls are not typically wrapped in try-catch blocks, following a consistent pattern across the codebase. This design decision prioritizes consistency with existing scheduler implementations over additional error handling.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/Environment.java:341-355
Timestamp: 2025-07-19T14:50:12.218Z
Learning: In WSO2 Carbon API Manager, input validation for model properties like apiDiscoveryScheduledWindow is performed at the REST API level rather than in individual setter methods, avoiding code duplication and ensuring validation occurs at the entry point.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AzureContentSafetyGuardrailProviderServiceImpl.java:75-84
Timestamp: 2025-06-30T06:50:20.514Z
Learning: In WSO2 Carbon API Manager, initialization of service components (like GuardrailProviderService implementations) is guaranteed to occur before service methods are called, so additional initialization validation checks in service methods are not needed.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (15)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (18)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:262-276
Timestamp: 2025-06-18T10:07:57.821Z
Learning: In the GraphQLSchemaDefinition class (and potentially other areas of the WSO2 API Manager codebase), template.getAuthType() can return null, which creates NPE risks when calling .equalsIgnoreCase() on the result. This specific issue has been tracked in wso2/api-manager#3971.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConsumerImpl.java:3454-3476
Timestamp: 2025-06-18T09:51:26.533Z
Learning: When reviewing code movement/refactoring PRs, if logical issues are discovered in the moved code that existed before the refactoring, it's appropriate to defer fixing them to a separate effort with proper issue tracking, rather than expanding the scope of the refactoring PR.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3885-3891
Timestamp: 2025-07-28T13:03:45.797Z
Learning: In WSO2 Carbon API Manager, BiyonFernando prefers storing JSON data in BLOB columns as it can be visualized from DB clients, rather than using CLOB for human-readable text storage.
🪛 Gitleaks (8.27.2)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
2078-2078: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
2078-2078: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
🔇 Additional comments (4)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (4)
71-98
: Well-implemented scheduler startup logic.The start method properly handles configuration validation, prevents double-starting, and provides good operational logging. The use of
scheduleAtFixedRate
is appropriate for periodic cleanup tasks.
103-125
: Excellent graceful shutdown implementation.The stop method implements proper graceful shutdown with timeout handling and correct InterruptedException management, following Java concurrency best practices.
137-163
: Focused and well-implemented cleanup task.The
GatewayValidationTask
correctly implements the core functionality of marking expired gateways with proper error handling and conditional logging to reduce noise while maintaining operational visibility.
77-86
: Appropriate configuration handling pattern.The configuration retrieval and validation logic properly ensures the scheduler only starts when gateway notifications are enabled, with clear logging for operational visibility.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
Outdated
Show resolved
Hide resolved
5f20c93
to
b1e7520
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (3)
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (2)
198-217
: Address unbounded queue growth concern.While the batching logic is well-implemented, there's still a potential memory issue when the gateway is not registered - jobs are queued indefinitely without size limits. This could lead to memory exhaustion if the gateway never registers.
Consider adding a configurable maximum queue size check:
private void handleBatchedSubmission(DeploymentStatusJob job) { + if (!DataHolder.getInstance().isGatewayRegistered() && currentBatch.size() > MAX_QUEUE_SIZE) { + log.warn("Deployment status queue is full. Dropping oldest job."); + currentBatch.poll(); // Remove oldest + } currentBatch.offer(job);private void handleImmediateSubmission(DeploymentStatusJob job) { if (DataHolder.getInstance().isGatewayRegistered()) { List<DeploymentStatusJob> singleJobList = Collections.singletonList(job); submitBatchForProcessing(singleJobList); } else { + if (currentBatch.size() > MAX_QUEUE_SIZE) { + log.warn("Deployment status queue is full. Dropping oldest job."); + currentBatch.poll(); // Remove oldest + } currentBatch.offer(job); } }
303-304
: Fix resource leak in response handling.The InputStream from
response.getEntity().getContent()
is not properly closed, which can lead to resource leaks.Apply this fix to ensure proper resource management:
- String responseBody = new String(response.getEntity().getContent().readAllBytes(), - StandardCharsets.UTF_8); + String responseBody; + try (InputStream inputStream = response.getEntity().getContent()) { + responseBody = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8); + }components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
2044-2078
: Add missingAccept
header parameter for contract symmetryAll other collection–style
GET
endpoints include the reusable#/components/parameters/Accept
header so SDK generators can negotiate the response media type.
The new/environments/{environmentId}/gateways
endpoint omits it, breaking the otherwise-uniform contract.@@ parameters: - $ref: '#/components/parameters/environmentId' + - $ref: '#/components/parameters/Accept'
(No behavioural change – just metadata.)
🧹 Nitpick comments (1)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
2044-2082
: Add anAccept
header parameter for consistency with the rest of the Admin APIMost collection/list endpoints in this spec expose the
Accept
header as an explicit parameter (e.g./throttling/policies/custom
,/applications
).
/environments/{environmentId}/gateways
omits it while still defining406 NotAcceptable
as a possible response. Exposing the header keeps the surface uniform and avoids ambiguity for generated SDKs.parameters: + - $ref: '#/components/parameters/Accept' - $ref: '#/components/parameters/environmentId'
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyGatewayApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/EnvironmentsApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/GatewayInstanceDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIRevisionDeploymentDTO.java
is excluded by!**/gen/**
📒 Files selected for processing (32)
components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
(5 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
🚧 Files skipped from review as they are similar to previous changes (26)
- components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
- components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
- components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like `/notify-api-deployment-status` in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: AnuGayan
PR: wso2/carbon-apimgt#13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (9)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (10)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/AsyncApiParserUtil.java:23-25
Timestamp: 2025-06-18T10:50:32.454Z
Learning: In WSO2 API Manager, when API specification parsing logic was extracted to org.wso2.carbon.apimgt.spec.parser component, the original classes in org.wso2.carbon.apimgt.impl.definitions (like AsyncApiParserUtil) were kept as deprecated wrapper classes that extend the new implementations. This inheritance is maintained for backward compatibility to support custom workflows that may extend these original classes, not removed as "needless inheritance".
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (15)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (18)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:262-276
Timestamp: 2025-06-18T10:07:57.821Z
Learning: In the GraphQLSchemaDefinition class (and potentially other areas of the WSO2 API Manager codebase), template.getAuthType() can return null, which creates NPE risks when calling .equalsIgnoreCase() on the result. This specific issue has been tracked in wso2/api-manager#3971.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConsumerImpl.java:3454-3476
Timestamp: 2025-06-18T09:51:26.533Z
Learning: When reviewing code movement/refactoring PRs, if logical issues are discovered in the moved code that existed before the refactoring, it's appropriate to defer fixing them to a separate effort with proper issue tracking, rather than expanding the scope of the refactoring PR.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3885-3891
Timestamp: 2025-07-28T13:03:45.797Z
Learning: In WSO2 Carbon API Manager, BiyonFernando prefers storing JSON data in BLOB columns as it can be visualized from DB clients, rather than using CLOB for human-readable text storage.
🪛 Gitleaks (8.27.2)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
2080-2080: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
2080-2080: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
🔇 Additional comments (10)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (2)
3291-3293
: LGTM!The new gateway-related constants for organization deletion are consistent with the existing pattern and align with the PR's gateway management functionality.
3458-3518
: Well-structured gateway notification constants.The new
GatewayNotification
class provides a comprehensive set of constants for the gateway notification feature. The constants are well-organized with:
- Clear categorization for different functional areas (heartbeat, deployment acknowledgement, cleanup)
- Sensible default values for batch processing, retry logic, and thread pool configuration
- Consistent naming conventions following the existing codebase patterns
- Proper endpoint definitions using the existing
INTERNAL_WEB_APP_EP
patterncomponents/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (6)
58-72
: LGTM! Proper field declaration and thread safety.The field declarations are well-designed with proper use of final instance fields, thread-safe collections, and synchronization objects. The previous issue with static field modifications has been correctly addressed.
73-89
: LGTM! Proper constructor implementation.The constructor correctly initializes all configuration fields from the service configuration and properly sets up the thread pools and scheduler. This addresses the previous concern about static field modifications.
94-103
: LGTM! Correct singleton implementation.The double-checked locking pattern is properly implemented for thread-safe singleton initialization.
105-126
: LGTM! Well-designed thread pool configuration.The thread pool creation methods properly configure executors with appropriate sizing, naming, and daemon thread settings for background processing.
136-154
: LGTM! Proper resource cleanup implementation.The shutdown method follows best practices with graceful termination, appropriate timeouts, and proper interrupt handling for both executors.
318-353
: LGTM! Well-designed inner classes.Both
BatchPayload
andDeploymentStatusJob
classes are properly designed with appropriate encapsulation, immutability through final fields, and correct data representation for JSON serialization.components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
5364-5393
: DescribelastActive
as an RFC 3339 timestamp and tighten the schema
lastActive
is a timestamp but is currently just a free-text string.
Addingformat: date-time
(OAS-native RFC 3339) improves client generation, validation, and documentation. No functional impact.GatewayInstance: title: Gateway instance in the gateway environment type: object properties: gatewayId: type: string example: "Env1_1372344" lastActive: type: string + format: date-time example: "2025-06-26T06:47:50Z"
While touching the schema, consider whether a separate enum value such as
INACTIVE
(previously suggested) is preferable toEXPIRED
. IfEXPIRED
is correct, no action needed.
[ suggest_essential_refactor ]components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
5364-5392
: Verify gateway-instance status vocabulary
GatewayInstance.status
currently allows onlyACTIVE | EXPIRED
.
Backend code (e.g. DAO & scheduler) formerly distinguishedINACTIVE
/OFFLINE
states; narrowing the enum here will 422-fail such records at the REST layer.Please confirm the final state list and update either:
• the enum in the spec, or
• the DAO/service logic that persists other states.[tag added for follow-up]
b1e7520
to
2a2edf0
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
♻️ Duplicate comments (4)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
2051-2054
: MissingAccept
header parameter – repeat of prior feedbackEarlier review already highlighted that all collection-style
GET
endpoints expose an optionalAccept
header to keep SDK generators happy.
The new/environments/{environmentId}/gateways
endpoint still omits it.parameters: - $ref: '#/components/parameters/environmentId' + - $ref: '#/components/parameters/Accept'
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (2)
64-66
: Make configuration fields private for better encapsulation.The fields should be declared as private to follow encapsulation best practices.
- private final int maxRetryCount; - private final double retryProgressionFactor; - private final long retryDuration; + private final int maxRetryCount; + private final double retryProgressionFactor; + private final long retryDuration;
105-110
: Use thread pool instead of creating threads manually.Creating threads manually can lead to resource issues. Consider using the existing scheduler or a dedicated thread pool for gateway registration.
public void registerGateway() { if (log.isDebugEnabled()) { log.debug("Registering Gateway with ID: " + gatewayID); } - new Thread(new registerGateway()).start(); + scheduler.submit(new registerGateway()); }components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (1)
199-217
: Add queue size limit to prevent memory issues.When the gateway is not registered, jobs are queued indefinitely which could lead to memory exhaustion. Add a configurable maximum queue size check.
private void handleBatchedSubmission(DeploymentStatusJob job) { + if (currentBatch.size() >= maxQueueSize) { + log.warn("Deployment status queue is full (size: " + maxQueueSize + "). Dropping oldest job."); + currentBatch.poll(); // Remove oldest + } currentBatch.offer(job); if (currentBatch.size() >= batchSize && DataHolder.getInstance().isGatewayRegistered()) { synchronized (batchLock) { if (currentBatch.size() >= batchSize) { processCurrentBatch(); } } } } private void handleImmediateSubmission(DeploymentStatusJob job) { if (DataHolder.getInstance().isGatewayRegistered()) { List<DeploymentStatusJob> singleJobList = Collections.singletonList(job); submitBatchForProcessing(singleJobList); } else { + if (currentBatch.size() >= maxQueueSize) { + log.warn("Deployment status queue is full (size: " + maxQueueSize + "). Dropping oldest job."); + currentBatch.poll(); // Remove oldest + } currentBatch.offer(job); } }Add
maxQueueSize
as a configurable parameter with a reasonable default (e.g., 10000).
🧹 Nitpick comments (1)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
5364-5376
: Addpagination
object for consistency with other List schemasMost list-returning schemas (e.g.
ThrottlePolicyDetailsList
,EnvironmentList
) expose apagination
field so clients can page through large result sets.
GatewayInstanceList
lacks this field; adding it keeps the contract uniform and avoids special-casing in SDKs/UI code.GatewayInstanceList: title: Gateway instance list type: object properties: count: type: integer @@ list: type: array items: $ref: '#/components/schemas/GatewayInstance' + pagination: + $ref: '#/components/schemas/Pagination'
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyGatewayApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/EnvironmentsApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/GatewayInstanceDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIRevisionDeploymentDTO.java
is excluded by!**/gen/**
📒 Files selected for processing (32)
components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
(5 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
- components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
🚧 Files skipped from review as they are similar to previous changes (25)
- components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
- components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
- components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like `/notify-api-deployment-status` in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: wso2/carbon-apimgt#13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (10)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/test/java/org/wso2/carbon/apimgt/spec/parser/definitions/OASParserUtilTest.java:174-176
Timestamp: 2025-06-18T08:15:46.118Z
Learning: CodeRabbit flagged duplicate production flags in OASParserUtilTest.java but provided incorrect line numbers (174-176). The actual issue exists at lines 403 and 430 where sandbox endpoint tests incorrectly use the true
flag instead of false
.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:11919-11923
Timestamp: 2025-06-30T06:27:48.390Z
Learning: In the WSO2 API Manager codebase, the input to the createCanonicalQueryString
method in APIUtil.java
is already URL encoded, so additional encoding within this method is not required and should be avoided to prevent double encoding.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:137-163
Timestamp: 2025-07-28T14:26:37.464Z
Learning: In the GatewayValidationScheduler class, the data retention cleanup is handled at the data insertion location rather than in the periodic GatewayValidationTask. The scheduler task only handles marking gateways as expired based on heartbeat inactivity.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (9)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (9)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:137-163
Timestamp: 2025-07-28T14:26:37.464Z
Learning: In the GatewayValidationScheduler class, the data retention cleanup is handled at the data insertion location rather than in the periodic GatewayValidationTask. The scheduler task only handles marking gateways as expired based on heartbeat inactivity.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java:0-0
Timestamp: 2025-07-28T03:41:10.644Z
Learning: In WSO2 Carbon API Manager, scheduler.scheduleAtFixedRate calls are not typically wrapped in try-catch blocks, following a consistent pattern across the codebase. This design decision prioritizes consistency with existing scheduler implementations over additional error handling.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/Environment.java:341-355
Timestamp: 2025-07-19T14:50:12.218Z
Learning: In WSO2 Carbon API Manager, input validation for model properties like apiDiscoveryScheduledWindow is performed at the REST API level rather than in individual setter methods, avoiding code duplication and ensuring validation occurs at the entry point.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AzureContentSafetyGuardrailProviderServiceImpl.java:75-84
Timestamp: 2025-06-30T06:50:20.514Z
Learning: In WSO2 Carbon API Manager, initialization of service components (like GuardrailProviderService implementations) is guaranteed to occur before service methods are called, so additional initialization validation checks in service methods are not needed.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (18)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:262-276
Timestamp: 2025-06-18T10:07:57.821Z
Learning: In the GraphQLSchemaDefinition class (and potentially other areas of the WSO2 API Manager codebase), template.getAuthType() can return null, which creates NPE risks when calling .equalsIgnoreCase() on the result. This specific issue has been tracked in wso2/api-manager#3971.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConsumerImpl.java:3454-3476
Timestamp: 2025-06-18T09:51:26.533Z
Learning: When reviewing code movement/refactoring PRs, if logical issues are discovered in the moved code that existed before the refactoring, it's appropriate to defer fixing them to a separate effort with proper issue tracking, rather than expanding the scope of the refactoring PR.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3885-3891
Timestamp: 2025-07-28T13:03:45.797Z
Learning: In WSO2 Carbon API Manager, BiyonFernando prefers storing JSON data in BLOB columns as it can be visualized from DB clients, rather than using CLOB for human-readable text storage.
🪛 Gitleaks (8.27.2)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
2080-2080: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build-product (3, group3)
- GitHub Check: run-benchmark-test
- GitHub Check: build-product (4, group4)
- GitHub Check: build-carbon
- GitHub Check: build-product (1, group1)
- GitHub Check: build-product (2, group2)
🔇 Additional comments (1)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (1)
40-40
: Add volatile modifier to singleton instance field.The singleton instance field should be volatile to ensure thread-safe lazy initialization with double-checked locking pattern.
- private static GatewayValidationScheduler instance; + private static volatile GatewayValidationScheduler instance;⛔ Skipped due to learnings
Learnt from: BiyonFernando PR: wso2/carbon-apimgt#13191 File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:137-163 Timestamp: 2025-07-28T14:26:37.464Z Learning: In the GatewayValidationScheduler class, the data retention cleanup is handled at the data insertion location rather than in the periodic GatewayValidationTask. The scheduler task only handles marking gateways as expired based on heartbeat inactivity.
...rbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
Outdated
Show resolved
Hide resolved
...rbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
Outdated
Show resolved
Hide resolved
...mgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
Outdated
Show resolved
Hide resolved
2a2edf0
to
f8b9d03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (3)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
5364-5393
: Addformat: date-time
tolastActive
; revisit status enum
lastActive
is a timestamp but is missing theformat: date-time
hint used elsewhere in the spec (e.g.createdTime
,updatedTime
). Adding it improves generated-SDK typing and Swagger-UI rendering.- lastActive: - type: string - example: "2025-06-26T06:47:50Z" + lastActive: + type: string + format: date-time + example: "2025-06-26T06:47:50Z"Optional: earlier feedback suggested
ACTIVE | INACTIVE | STALE
; the currentEXPIRED
value is fine if intentional, but double-check alignment with gateway-runtime status names to avoid mismatches.components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
2051-2054
: Add the standardAccept
header parameterAll other collection-style
GET
operations in this spec expose the reusable#/components/parameters/Accept
parameter so SDKs can negotiate response media-types uniformly.
This new sub-resource breaks that contract symmetry.parameters: - $ref: '#/components/parameters/environmentId' + - $ref: '#/components/parameters/Accept'
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (1)
105-110
: Use thread pool instead of creating threads manually.Creating threads manually can lead to resource issues. Consider using the existing scheduler or a dedicated thread pool for gateway registration.
public void registerGateway() { if (log.isDebugEnabled()) { log.debug("Registering Gateway with ID: " + gatewayID); } - new Thread(new registerGateway()).start(); + scheduler.submit(new registerGateway()); }
🧹 Nitpick comments (2)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
5381-5386
: DeclarelastActive
as RFC-3339date-time
for tooling friendlinessTooling (code-gen, validation, UIs) can auto-parse timestamps when the property is annotated with
format: date-time
.
Keeping the field as plain string doesn’t change the wire format but loses the benefit.- lastActive: - type: string + lastActive: + type: string + format: date-timecomponents/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (1)
3469-3471
: Consider improving string concatenation formatting.While functionally correct, the line break in the middle of the string concatenation could be improved for better readability.
Apply this formatting improvement:
- public static final String NOTIFY_API_DEPLOYMENT_STATUS_BATCH_PATH = INTERNAL_WEB_APP_EP + "/notify-api" - + "-deployment-status"; + public static final String NOTIFY_API_DEPLOYMENT_STATUS_BATCH_PATH = INTERNAL_WEB_APP_EP + + "/notify-api-deployment-status";
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyGatewayApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/EnvironmentsApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/GatewayInstanceDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIRevisionDeploymentDTO.java
is excluded by!**/gen/**
📒 Files selected for processing (32)
components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
(5 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
🚧 Files skipped from review as they are similar to previous changes (24)
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
- components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like `/notify-api-deployment-status` in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: wso2/carbon-apimgt#13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (10)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:137-163
Timestamp: 2025-07-28T14:26:37.464Z
Learning: In the GatewayValidationScheduler class, the data retention cleanup is handled at the data insertion location rather than in the periodic GatewayValidationTask. The scheduler task only handles marking gateways as expired based on heartbeat inactivity.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java:0-0
Timestamp: 2025-07-28T03:41:10.644Z
Learning: In WSO2 Carbon API Manager, scheduler.scheduleAtFixedRate calls are not typically wrapped in try-catch blocks, following a consistent pattern across the codebase. This design decision prioritizes consistency with existing scheduler implementations over additional error handling.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/Environment.java:341-355
Timestamp: 2025-07-19T14:50:12.218Z
Learning: In WSO2 Carbon API Manager, input validation for model properties like apiDiscoveryScheduledWindow is performed at the REST API level rather than in individual setter methods, avoiding code duplication and ensuring validation occurs at the entry point.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AzureContentSafetyGuardrailProviderServiceImpl.java:75-84
Timestamp: 2025-06-30T06:50:20.514Z
Learning: In WSO2 Carbon API Manager, initialization of service components (like GuardrailProviderService implementations) is guaranteed to occur before service methods are called, so additional initialization validation checks in service methods are not needed.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (10)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/test/java/org/wso2/carbon/apimgt/spec/parser/definitions/OASParserUtilTest.java:174-176
Timestamp: 2025-06-18T08:15:46.118Z
Learning: CodeRabbit flagged duplicate production flags in OASParserUtilTest.java but provided incorrect line numbers (174-176). The actual issue exists at lines 403 and 430 where sandbox endpoint tests incorrectly use the true
flag instead of false
.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:11919-11923
Timestamp: 2025-06-30T06:27:48.390Z
Learning: In the WSO2 API Manager codebase, the input to the createCanonicalQueryString
method in APIUtil.java
is already URL encoded, so additional encoding within this method is not required and should be avoided to prevent double encoding.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:137-163
Timestamp: 2025-07-28T14:26:37.464Z
Learning: In the GatewayValidationScheduler class, the data retention cleanup is handled at the data insertion location rather than in the periodic GatewayValidationTask. The scheduler task only handles marking gateways as expired based on heartbeat inactivity.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (10)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/AsyncApiParserUtil.java:23-25
Timestamp: 2025-06-18T10:50:32.454Z
Learning: In WSO2 API Manager, when API specification parsing logic was extracted to org.wso2.carbon.apimgt.spec.parser component, the original classes in org.wso2.carbon.apimgt.impl.definitions (like AsyncApiParserUtil) were kept as deprecated wrapper classes that extend the new implementations. This inheritance is maintained for backward compatibility to support custom workflows that may extend these original classes, not removed as "needless inheritance".
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (15)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (18)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:262-276
Timestamp: 2025-06-18T10:07:57.821Z
Learning: In the GraphQLSchemaDefinition class (and potentially other areas of the WSO2 API Manager codebase), template.getAuthType() can return null, which creates NPE risks when calling .equalsIgnoreCase() on the result. This specific issue has been tracked in wso2/api-manager#3971.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConsumerImpl.java:3454-3476
Timestamp: 2025-06-18T09:51:26.533Z
Learning: When reviewing code movement/refactoring PRs, if logical issues are discovered in the moved code that existed before the refactoring, it's appropriate to defer fixing them to a separate effort with proper issue tracking, rather than expanding the scope of the refactoring PR.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3885-3891
Timestamp: 2025-07-28T13:03:45.797Z
Learning: In WSO2 Carbon API Manager, BiyonFernando prefers storing JSON data in BLOB columns as it can be visualized from DB clients, rather than using CLOB for human-readable text storage.
🧬 Code Graph Analysis (1)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (3)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (2)
APIConstants
(32-3519)GatewayNotification
(3460-3518)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java (1)
GatewayManagementDAO
(40-459)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java (1)
GatewayNotificationConfiguration
(24-210)
🪛 Gitleaks (8.27.2)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
2080-2080: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
2080-2080: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
🔇 Additional comments (11)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
2044-2082
: New endpoint definition looks consistent with existing Environment APIsThe path, parameter usage, success/error responses, and OAuth2 scope (
apim:environment_read
) follow the same patterns already used for the/environments
family of endpoints, so nothing blocks merging from a spec-consistency point of view.components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java (4)
53-67
: LGTM! Singleton implementation and field declarations are correct.The volatile instance field ensures thread-safe lazy initialization, and all configuration fields are properly declared as private instance fields rather than static, which addresses the thread safety concerns from previous reviews.
72-100
: LGTM! Constructor and singleton initialization are well-implemented.The constructor properly loads configuration from multiple sources and handles gateway ID generation with appropriate fallbacks. The synchronized getInstance method ensures thread-safe singleton creation.
218-244
: LGTM! HTTP response handling has been properly implemented.The response handling correctly uses try-with-resources blocks and reads from the inputStream variable to avoid the double reading issue flagged in previous reviews. Resource management is properly handled.
274-284
: LGTM! Heartbeat response handling is correct.The heartbeat response processing properly uses try-with-resources and reads from the inputStream variable, avoiding the resource leak and double reading issues identified in previous reviews.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (4)
37-59
: LGTM! Singleton implementation follows best practices.The class properly implements the singleton pattern with a volatile instance field for thread safety, and cleanly initializes its dependencies in the constructor.
64-91
: LGTM! Scheduler startup logic is well-implemented.The method properly checks for duplicate starts, loads configuration appropriately, and follows the established WSO2 pattern for scheduler initialization without wrapping scheduleAtFixedRate in try-catch blocks.
96-118
: LGTM! Scheduler shutdown logic follows best practices.The stop method properly implements graceful shutdown with timeout handling and correct interrupt management, following standard Java executor service shutdown patterns.
130-156
: LGTM! Task implementation correctly focuses on its intended scope.The GatewayValidationTask properly handles marking gateways as expired based on heartbeat inactivity. Based on the architectural decision mentioned in previous reviews, the data retention cleanup is handled at the data insertion location rather than in this periodic task, which explains why
deleteOldGatewayRecords
is not called here.components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (2)
3291-3293
: LGTM!The new constants for gateway data management during organization deletion are well-placed and follow the existing naming conventions.
3459-3518
: Well-structured gateway notification constants!The new
GatewayNotification
class is comprehensive and well-organized with:
- Clear logical grouping of related constants
- Appropriate default values for configuration parameters
- Consistent naming conventions
- Good coverage of all aspects of the gateway notification feature including registration, heartbeat, batch processing, and cleanup
@CodeRabbit review |
✅ Actions performedReview triggered.
|
f8b9d03
to
79fb538
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
5378-5387
: Adddate-time
format and harmonise status enum for GatewayInstance
lastActive
is still a plain string – generators will treat it as an arbitrary string rather than an RFC-3339 timestamp.
Likewise, thestatus
enum suddenly switches toEXPIRED
whereas earlier discussions revolved aroundINACTIVE
/STALE
. The enum should capture all intended states and remain stable across specs.- lastActive: - type: string - example: "2025-06-26T06:47:50Z" + lastActive: + type: string + format: date-time + example: "2025-06-26T06:47:50Z" - status: - example: ACTIVE - default: ACTIVE - enum: - - ACTIVE - - EXPIRED + status: + example: ACTIVE + default: ACTIVE + enum: + - ACTIVE + - INACTIVE + - STALEAdds typed metadata for tooling, and prevents future breaking renames of states.
Also applies to: 5388-5393
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
2051-2053
: Add theAccept
header parameter for contract symmetryAll other collection-style
GET
endpoints expose an optionalAccept
header via- $ref: '#/components/parameters/Accept'
Omitting it here silently breaks SDK generators that rely on a uniform interface.
parameters: - $ref: '#/components/parameters/environmentId' + - $ref: '#/components/parameters/Accept'
🧹 Nitpick comments (1)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
2048-2051
: Minor wording – use lowercase “instances”The phrase “gateway Instances” capitalises Instances mid-sentence:
Retrieve list of gateway Instances in the gateway environment.
- Retrieve list of gateway Instances in the gateway environment. + Retrieve list of gateway instances in the gateway environment.Purely cosmetic, but keeps prose consistent with the rest of the spec.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyGatewayApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/EnvironmentsApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/GatewayInstanceDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIRevisionDeploymentDTO.java
is excluded by!**/gen/**
📒 Files selected for processing (33)
components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
(5 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.default.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
🚧 Files skipped from review as they are similar to previous changes (27)
- components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.default.json
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
- components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like `/notify-api-deployment-status` in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: wso2/carbon-apimgt#13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (9)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:137-163
Timestamp: 2025-07-28T14:26:37.464Z
Learning: In the GatewayValidationScheduler class, the data retention cleanup is handled at the data insertion location rather than in the periodic GatewayValidationTask. The scheduler task only handles marking gateways as expired based on heartbeat inactivity.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java:0-0
Timestamp: 2025-07-28T03:41:10.644Z
Learning: In WSO2 Carbon API Manager, scheduler.scheduleAtFixedRate calls are not typically wrapped in try-catch blocks, following a consistent pattern across the codebase. This design decision prioritizes consistency with existing scheduler implementations over additional error handling.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/Environment.java:341-355
Timestamp: 2025-07-19T14:50:12.218Z
Learning: In WSO2 Carbon API Manager, input validation for model properties like apiDiscoveryScheduledWindow is performed at the REST API level rather than in individual setter methods, avoiding code duplication and ensuring validation occurs at the entry point.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AzureContentSafetyGuardrailProviderServiceImpl.java:75-84
Timestamp: 2025-06-30T06:50:20.514Z
Learning: In WSO2 Carbon API Manager, initialization of service components (like GuardrailProviderService implementations) is guaranteed to occur before service methods are called, so additional initialization validation checks in service methods are not needed.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (15)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (18)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:262-276
Timestamp: 2025-06-18T10:07:57.821Z
Learning: In the GraphQLSchemaDefinition class (and potentially other areas of the WSO2 API Manager codebase), template.getAuthType() can return null, which creates NPE risks when calling .equalsIgnoreCase() on the result. This specific issue has been tracked in wso2/api-manager#3971.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConsumerImpl.java:3454-3476
Timestamp: 2025-06-18T09:51:26.533Z
Learning: When reviewing code movement/refactoring PRs, if logical issues are discovered in the moved code that existed before the refactoring, it's appropriate to defer fixing them to a separate effort with proper issue tracking, rather than expanding the scope of the refactoring PR.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3885-3891
Timestamp: 2025-07-28T13:03:45.797Z
Learning: In WSO2 Carbon API Manager, BiyonFernando prefers storing JSON data in BLOB columns as it can be visualized from DB clients, rather than using CLOB for human-readable text storage.
🪛 Gitleaks (8.27.2)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
2080-2080: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
2080-2080: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: run-benchmark-test
- GitHub Check: build-product (4, group4)
- GitHub Check: build-product (1, group1)
- GitHub Check: build-product (2, group2)
- GitHub Check: build-product (3, group3)
- GitHub Check: build-carbon
🔇 Additional comments (7)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (7)
34-44
: LGTM! Proper singleton pattern implementation.The class fields are well-structured with appropriate types and access modifiers. The volatile keyword on the instance field ensures thread-safe singleton access.
46-49
: LGTM! Proper singleton constructor.The constructor correctly initializes the required components with appropriate access control for the singleton pattern.
51-59
: LGTM! Thread-safe singleton implementation.The synchronized method approach ensures thread safety and prevents multiple instance creation. This pattern is appropriate for the scheduler's usage context.
61-91
: LGTM! Well-structured scheduler startup.The method properly handles state checking, configuration loading, and task scheduling. The feature toggle and logging provide good operational control and visibility.
93-118
: LGTM! Excellent executor service shutdown implementation.The method follows best practices for graceful shutdown with proper timeout handling, fallback to forced shutdown, and correct InterruptedException handling that preserves thread interrupt status.
120-125
: LGTM! Simple and appropriate state accessor.The method provides necessary visibility into scheduler state for external components.
127-156
: LGTM! Focused and well-implemented cleanup task.The task correctly implements gateway expiration logic based on heartbeat inactivity. The time calculation, database interaction, and error handling are all properly implemented. The focused scope aligns with the architectural decision to handle data retention cleanup at the data insertion location.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
Show resolved
Hide resolved
79fb538
to
003486f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
♻️ Duplicate comments (3)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
5383-5389
: Addformat: date-time
tolastActive
to keep JSON<->object mapping preciseThe same point was raised earlier and is still unresolved – without the explicit format, many generated clients treat the field as an opaque string instead of a timestamp.
lastActive: type: string + format: date-time example: "2025-06-26T06:47:50Z"
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (1)
130-156
: LGTM: Task implementation aligns with design decision.Based on the retrieved learnings, the data retention cleanup is handled at the data insertion location rather than in this periodic task. The current implementation correctly focuses only on marking gateways as expired based on heartbeat inactivity, which aligns with the architectural design.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
2051-2054
: MissingAccept
header parameter breaks contract symmetryAll other collection‐style GET endpoints include an
Accept
header parameter ($ref: '#/components/parameters/Accept'
). Omitting it here makes SDKs that assume a uniform contract fail at compile‐time.parameters: - $ref: '#/components/parameters/environmentId' + - $ref: '#/components/parameters/Accept'
🧹 Nitpick comments (6)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (2)
35-35
: Fix typo in class documentation.The word "liveliness" should be "liveness" in the class documentation.
- * Scheduler for validating liveliness of gateway and expired them + * Scheduler for validating liveness of gateways and expiring them
52-52
: Fix incorrect class name in comment.The comment refers to "GatewayCleanupScheduler" but should refer to "GatewayValidationScheduler".
- * Returns the singleton instance of GatewayCleanupScheduler. + * Returns the singleton instance of GatewayValidationScheduler.components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
5381-5384
: Consider markinggatewayId
as required
gatewayId
uniquely identifies a gateway instance; returning objects without it is useless and causes nullable typings in generated SDKs.GatewayInstance: title: Gateway instance in the gateway environment type: object + required: + - gatewayIdcomponents/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java (2)
126-126
: Fix typo in error message constant.There's a typo in the constant name:
ERROR_HEARTBEAT_REGISTREATION
should beERROR_HEARTBEAT_REGISTRATION
.- error.setMessage(APIConstants.GatewayNotification.ERROR_HEARTBEAT_REGISTREATION + e.getMessage()); + error.setMessage(APIConstants.GatewayNotification.ERROR_HEARTBEAT_REGISTRATION + e.getMessage());
153-155
: Consider initializing gatewayManagementDAO consistently.The lazy initialization pattern here is inconsistent with how the DAO is used elsewhere in the class (lines 84, 111 use
GatewayManagementDAO.getInstance()
directly). Consider either:
- Initialize
gatewayManagementDAO
field in constructor, or- Use
GatewayManagementDAO.getInstance()
consistently throughout the class- if (gatewayManagementDAO == null) { - gatewayManagementDAO = GatewayManagementDAO.getInstance(); - } + GatewayManagementDAO dao = GatewayManagementDAO.getInstance();And update line 157:
- int deletedCount = gatewayManagementDAO.deleteOldGatewayRecords(retentionTimestamp); + int deletedCount = dao.deleteOldGatewayRecords(retentionTimestamp);components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml (1)
2301-2308
:ipAddress
restricts gateways to IPv4 only
format: ipv4
blocks legitimate IPv6 deployments (and dual-stack pods on Kubernetes).
Use a pattern that accepts both families or introduce a separateipv6Address
field.- ipAddress: - type: string - format: ipv4 - description: The IP address of the gateway instance. + ipAddress: + type: string + description: IPv4 or IPv6 address of the gateway instance. + pattern: '^([0-9]{1,3}(\\.[0-9]{1,3}){3}|([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4})$'
...imgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
Outdated
Show resolved
Hide resolved
...mgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
Show resolved
Hide resolved
...mgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
Show resolved
Hide resolved
...mgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
Show resolved
Hide resolved
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
Show resolved
Hide resolved
003486f
to
c63b58f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (4)
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (1)
61-61
: Consider adding queue size limits to prevent memory issuesThe
currentBatch
queue is unbounded (LinkedBlockingQueue without capacity). When the gateway is not registered, jobs are queued indefinitely which could lead to memory exhaustion if the gateway never registers.Define a maximum queue size:
-private static final BlockingQueue<DeploymentStatusJob> currentBatch = new LinkedBlockingQueue<>(); +private static final int MAX_QUEUE_SIZE = 10000; // configurable +private static final BlockingQueue<DeploymentStatusJob> currentBatch = new LinkedBlockingQueue<>(MAX_QUEUE_SIZE);Also update the queueing logic to handle full queue:
private void handleBatchedSubmission(DeploymentStatusJob job) { - currentBatch.offer(job); + if (!currentBatch.offer(job)) { + log.warn("Deployment status queue is full. Dropping job for API: " + job.apiId); + }components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (1)
3479-3479
: Fix typo in constant name.The constant name contains a typo - "REGISTREATION" should be "REGISTRATION".
Apply this diff to fix the typo:
- public static final String ERROR_HEARTBEAT_REGISTREATION = "Error during registering heartbeat: "; + public static final String ERROR_HEARTBEAT_REGISTRATION = "Error during registering heartbeat: ";components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
5378-5389
: Addformat: date-time
tolastActive
lastActive
represents an ISO-8601 timestamp but is currently declared only astype: string
.
Adding the explicit format improves client-side typing and generator output:lastActive: type: string + format: date-time example: "2025-06-26T06:47:50Z"
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
2044-2076
: MissingAccept
header parameter breaks contract symmetryAll other collection-style
GET
endpoints expose an optionalAccept
header (via#/components/parameters/Accept
) so that SDK generators can negotiate media types uniformly.
Omitting it here creates an outlier and silently breaks generated clients.@@ parameters: - $ref: '#/components/parameters/environmentId' + - $ref: '#/components/parameters/Accept'
🧹 Nitpick comments (1)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
2044-2074
: Remove 406 response or addAccept
header parameter for consistencyThe operation advertises a 406 Not Acceptable response but does not declare an
Accept
header parameter.
Either add the standardAccept
parameter (as used in many other collection endpoints) or drop the 406 response code to keep the contract internally coherent.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyGatewayApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/EnvironmentsApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/GatewayInstanceDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIRevisionDeploymentDTO.java
is excluded by!**/gen/**
📒 Files selected for processing (33)
components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
(5 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.default.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
🚧 Files skipped from review as they are similar to previous changes (28)
- components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
- components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.default.json
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
- components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:76-79
Timestamp: 2025-07-30T14:01:04.162Z
Learning: In WSO2 Carbon API Manager's GatewayNotificationConfiguration class, all fields including nested configuration objects (HeartbeatConfiguration, DeploymentAcknowledgementConfiguration, RegistrationConfiguration, GatewayCleanupConfiguration) are initialized with default values at field declaration level, ensuring that getGatewayNotificationConfiguration() and all its nested getters never return null.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like `/notify-api-deployment-status` in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:81-87
Timestamp: 2025-07-30T13:59:48.856Z
Learning: In WSO2 Carbon API Manager's GatewayNotificationConfiguration, all nested configuration objects including GatewayCleanupConfiguration are initialized with default values at field declaration level, and the configuration parsing only updates existing values through setters, ensuring that null checks are unnecessary as the objects are guaranteed to be non-null.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (17)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:76-79
Timestamp: 2025-07-30T14:01:04.162Z
Learning: In WSO2 Carbon API Manager's GatewayNotificationConfiguration class, all fields including nested configuration objects (HeartbeatConfiguration, DeploymentAcknowledgementConfiguration, RegistrationConfiguration, GatewayCleanupConfiguration) are initialized with default values at field declaration level, ensuring that getGatewayNotificationConfiguration() and all its nested getters never return null.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:76-79
Timestamp: 2025-07-30T14:01:04.162Z
Learning: In WSO2 Carbon API Manager's APIManagerConfiguration class, the gatewayNotificationConfiguration field is initialized with a new GatewayNotificationConfiguration() instance during object construction, making getGatewayNotificationConfiguration() guaranteed to never return null. The configuration parsing only updates existing values through setters rather than replacing the entire object.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:76-79
Timestamp: 2025-07-30T14:01:04.162Z
Learning: In WSO2 Carbon API Manager's APIManagerConfiguration class, the gatewayNotificationConfiguration field is initialized as "new GatewayNotificationConfiguration()" at field declaration level, making getGatewayNotificationConfiguration() guaranteed to never return null. The GatewayNotificationConfiguration class also initializes all its nested configuration objects with default values at field declaration level.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:81-87
Timestamp: 2025-07-30T13:59:48.856Z
Learning: In WSO2 Carbon API Manager's GatewayNotificationConfiguration, all nested configuration objects including GatewayCleanupConfiguration are initialized with default values at field declaration level, and the configuration parsing only updates existing values through setters, ensuring that null checks are unnecessary as the objects are guaranteed to be non-null.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:81-87
Timestamp: 2025-07-30T13:59:48.856Z
Learning: In WSO2 Carbon API Manager's GatewayValidationScheduler, the gatewayCleanupConfiguration is guaranteed to be non-null because GatewayNotificationConfiguration initializes it with default values in the constructor, and the configuration parsing only updates existing values rather than setting them to null.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:11919-11923
Timestamp: 2025-06-30T06:27:48.390Z
Learning: In the WSO2 API Manager codebase, the input to the createCanonicalQueryString
method in APIUtil.java
is already URL encoded, so additional encoding within this method is not required and should be avoided to prevent double encoding.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConsumerImpl.java:3454-3476
Timestamp: 2025-06-18T09:51:26.533Z
Learning: When reviewing code movement/refactoring PRs, if logical issues are discovered in the moved code that existed before the refactoring, it's appropriate to defer fixing them to a separate effort with proper issue tracking, rather than expanding the scope of the refactoring PR.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (13)
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:76-79
Timestamp: 2025-07-30T14:01:04.162Z
Learning: In WSO2 Carbon API Manager's APIManagerConfiguration class, the gatewayNotificationConfiguration field is initialized with a new GatewayNotificationConfiguration() instance during object construction, making getGatewayNotificationConfiguration() guaranteed to never return null. The configuration parsing only updates existing values through setters rather than replacing the entire object.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:76-79
Timestamp: 2025-07-30T14:01:04.162Z
Learning: In WSO2 Carbon API Manager's GatewayNotificationConfiguration class, all fields including nested configuration objects (HeartbeatConfiguration, DeploymentAcknowledgementConfiguration, RegistrationConfiguration, GatewayCleanupConfiguration) are initialized with default values at field declaration level, ensuring that getGatewayNotificationConfiguration() and all its nested getters never return null.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:81-87
Timestamp: 2025-07-30T13:59:48.856Z
Learning: In WSO2 Carbon API Manager's GatewayNotificationConfiguration, all nested configuration objects including GatewayCleanupConfiguration are initialized with default values at field declaration level, and the configuration parsing only updates existing values through setters, ensuring that null checks are unnecessary as the objects are guaranteed to be non-null.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:76-79
Timestamp: 2025-07-30T14:01:04.162Z
Learning: In WSO2 Carbon API Manager's APIManagerConfiguration class, the gatewayNotificationConfiguration field is initialized as "new GatewayNotificationConfiguration()" at field declaration level, making getGatewayNotificationConfiguration() guaranteed to never return null. The GatewayNotificationConfiguration class also initializes all its nested configuration objects with default values at field declaration level.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:81-87
Timestamp: 2025-07-30T13:59:48.856Z
Learning: In WSO2 Carbon API Manager's GatewayValidationScheduler, the gatewayCleanupConfiguration is guaranteed to be non-null because GatewayNotificationConfiguration initializes it with default values in the constructor, and the configuration parsing only updates existing values rather than setting them to null.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: nimsara66
PR: #13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AWSBedrockGuardrailProviderServiceImpl.java:110-111
Timestamp: 2025-06-30T08:32:41.219Z
Learning: In WSO2 Carbon API Manager callout service implementations, error messages should reference the actual parameter names/keys that callers provide in configuration maps, not the internal variable names used in the method implementation. This helps users understand what they need to configure.
Learnt from: Oshanath
PR: #13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (16)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:76-79
Timestamp: 2025-07-30T14:01:04.162Z
Learning: In WSO2 Carbon API Manager's APIManagerConfiguration class, the gatewayNotificationConfiguration field is initialized with a new GatewayNotificationConfiguration() instance during object construction, making getGatewayNotificationConfiguration() guaranteed to never return null. The configuration parsing only updates existing values through setters rather than replacing the entire object.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (18)
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: AnuGayan
PR: #13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Learnt from: tharindu1st
PR: #13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
is an automated copy file; changes should be made in the original source file, not in this generated copy.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like /notify-api-deployment-status
in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: tharindu1st
PR: #13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new /tenant-info
GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the TenantInfoList
schema.
Learnt from: BiyonFernando
PR: #13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:262-276
Timestamp: 2025-06-18T10:07:57.821Z
Learning: In the GraphQLSchemaDefinition class (and potentially other areas of the WSO2 API Manager codebase), template.getAuthType() can return null, which creates NPE risks when calling .equalsIgnoreCase() on the result. This specific issue has been tracked in wso2/api-manager#3971.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Learnt from: thisaltennakoon
PR: #13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConsumerImpl.java:3454-3476
Timestamp: 2025-06-18T09:51:26.533Z
Learning: When reviewing code movement/refactoring PRs, if logical issues are discovered in the moved code that existed before the refactoring, it's appropriate to defer fixing them to a separate effort with proper issue tracking, rather than expanding the scope of the refactoring PR.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
Learnt from: BiyonFernando
PR: #13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3885-3891
Timestamp: 2025-07-28T13:03:45.797Z
Learning: In WSO2 Carbon API Manager, BiyonFernando prefers storing JSON data in BLOB columns as it can be visualized from DB clients, rather than using CLOB for human-readable text storage.
🪛 Gitleaks (8.27.2)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
2080-2080: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
2080-2080: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build-product (1, group1)
- GitHub Check: run-benchmark-test
- GitHub Check: build-product (3, group3)
- GitHub Check: build-product (4, group4)
- GitHub Check: build-product (2, group2)
- GitHub Check: build-carbon
🔇 Additional comments (2)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (1)
3460-3518
: Well-structured gateway notification constants.The new
GatewayNotification
inner class is well-organized with clear logical groupings, appropriate default values, and follows the established naming conventions. The constants comprehensively cover all aspects of the gateway notification feature including payload types, status values, error messages, configuration keys, and sensible defaults for batch processing and retry mechanisms.components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
5364-5393
: Align GatewayInstance schema and verify status enums– The common GatewayInstance schema is missing its primary identifier.
Add arequired: ["gatewayId"]
block to:
• components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml– Ensure the
status
enum is consistent across your APIs.
Currently it’s defined as[ACTIVE, EXPIRED]
; if your gateway lifecycle also supportsINACTIVE
andOFFLINE
, include them (and mirror this in the v1 spec), or call out the breaking change in your release notes.Proposed diff in admin-api.yaml (common):
GatewayInstance: title: Gateway instance in the gateway environment type: object + required: + - gatewayId properties: gatewayId: type: string @@ - status: - example: ACTIVE - default: ACTIVE - enum: - - ACTIVE - - EXPIRED + status: + example: ACTIVE + default: ACTIVE + enum: + - ACTIVE + - INACTIVE # add if supported + - OFFLINE # add if supported + - EXPIRED # existing value, if still applicablePlease update both the common and v1 definitions as needed and verify there are no downstream breakages.
...mgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
Outdated
Show resolved
Hide resolved
c63b58f
to
e584eb5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (1)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml (1)
5364-5393
:gatewayId
still not marked as required & status enum deviates from previous agreementThe same feedback was given earlier and marked fixed, yet the generated copy still lacks it:
GatewayInstance: title: Gateway instance in the gateway environment type: object + required: + - gatewayId properties: @@ - status: - example: ACTIVE - default: ACTIVE - enum: - - ACTIVE - - EXPIRED + status: + example: ACTIVE + default: ACTIVE + enum: [ACTIVE, INACTIVE, OFFLINE, EXPIRED]• Marking
gatewayId
as mandatory prevents useless partial objects in SDKs.
• Extending the enum reflects the three recognised runtime states plus the newly introduced “EXPIRED”.
🧹 Nitpick comments (7)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (2)
35-35
: Fix grammatical error in class documentation.The comment contains a grammatical error. "expired them" should be "expire them".
- * Scheduler for validating liveliness of gateway and expired them + * Scheduler for validating liveness of gateway and expire them
52-52
: Fix incorrect class name in documentation.The comment refers to "GatewayCleanupScheduler" but this is "GatewayValidationScheduler".
- * Returns the singleton instance of GatewayCleanupScheduler. + * Returns the singleton instance of GatewayValidationScheduler.components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (1)
3460-3519
: Consider adding JavaDoc for the GatewayNotification class.The new
GatewayNotification
class is well-structured with comprehensive constants. However, for consistency with other documented inner classes in this file, consider adding JavaDoc comments to describe its purpose.+ /** + * Constants related to Gateway Notification functionality + */ public static class GatewayNotification {components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
5386-5388
: Addformat: date-time
forlastActive
OpenAPI tooling treats plain
string
differently from a timestamp.
Explicitly declaring the RFC 3339 format improves SDK generation and validation.- lastActive: - type: string - example: "2025-06-26T06:47:50Z" + lastActive: + type: string + format: date-time + example: "2025-06-26T06:47:50Z"components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml (3)
2254-2283
:gatewayId
description is misleading for REGISTER payloads
gatewayId
is optional and must be absent for a first-time registration, yet the description says “The unique identifier assigned to the newly registered gateway.” – wording that implies it is already known to the caller.Consider clarifying that:
gatewayId
is required for HEARTBEAT payloads (existing gateways)- It must be omitted for REGISTER payloads (new gateways)
If the team still prefers a single schema, at least tweak the docstring:
- description: The unique identifier assigned to the newly registered gateway. + description: Gateway identifier. Present in heartbeat requests; omitted when a gateway registers for the first time.
2310-2321
: List-level description mentions “APIs”, not acknowledgementsThe list wrapper is for
GatewayDeploymentStatusAcknowledgment
objects but the wording re-uses copy from unrelated API list schemas.- description: | - Number of APIs returned. + description: | + Number of deployment-status acknowledgements returned.
2323-2358
: Consider makingrevisionId
required for DEPLOY/UNDEPLOY actionsWhen
action
isDEPLOY
orUNDEPLOY
, therevisionId
uniquely identifies the revision being operated on and is necessary for idempotent processing.
Making it mandatory (or modelling two variants withoneOf
) would enable early validation and reduce server-side error handling.No change required if the implementation gracefully handles a missing
revisionId
, but stronger schema constraints would improve contract robustness.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/gen/java/org/wso2/carbon/apimgt/internal/service/NotifyGatewayApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/EnvironmentsApi.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/gen/java/org/wso2/carbon/apimgt/rest/api/admin/v1/dto/GatewayInstanceDTO.java
is excluded by!**/gen/**
components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1.common/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/dto/APIRevisionDeploymentDTO.java
is excluded by!**/gen/**
📒 Files selected for processing (33)
components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
(5 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
(4 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
(2 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
(1 hunks)components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.default.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
(1 hunks)features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml
- components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml
🚧 Files skipped from review as they are similar to previous changes (25)
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/test/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListenerTest.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyApiDeploymentStatusApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_23c.sql
- components/apimgt/org.wso2.carbon.apimgt.gateway/pom.xml
- components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/java/org/wso2/carbon/apimgt/internal/service/impl/NotifyGatewayApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.default.json
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mssql.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/GatewayManagementDAO.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/health/GatewayNotifier.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dto/GatewayNotificationConfiguration.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/constants/SQLConstants.java
- components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/listeners/GatewayJMSMessageListener.java
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/conf_templates/org.wso2.carbon.apimgt.core.unit-resolve.json
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql
- components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/admin/v1/impl/EnvironmentsApiServiceImpl.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql.sql
- components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/internal/APIManagerComponent.java
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/h2.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/db2.sql
- features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql
🧰 Additional context used
🧠 Learnings (35)
📓 Common learnings
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:76-79
Timestamp: 2025-07-30T14:01:04.162Z
Learning: In WSO2 Carbon API Manager's GatewayNotificationConfiguration class, all fields including nested configuration objects (HeartbeatConfiguration, DeploymentAcknowledgementConfiguration, RegistrationConfiguration, GatewayCleanupConfiguration) are initialized with default values at field declaration level, ensuring that getGatewayNotificationConfiguration() and all its nested getters never return null.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like `/notify-api-deployment-status` in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:81-87
Timestamp: 2025-07-30T13:59:48.856Z
Learning: In WSO2 Carbon API Manager's GatewayNotificationConfiguration, all nested configuration objects including GatewayCleanupConfiguration are initialized with default values at field declaration level, and the configuration parsing only updates existing values through setters, ensuring that null checks are unnecessary as the objects are guaranteed to be non-null.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
📚 Learning: for fire-and-forget api mechanisms like `/notify-api-deployment-status` in wso2 carbon api manager, ...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1180-1202
Timestamp: 2025-07-29T03:22:44.306Z
Learning: For fire-and-forget API mechanisms like `/notify-api-deployment-status` in WSO2 Carbon API Manager, lightweight response schemas (simple status objects) are preferred over echoing back potentially large request payloads like GatewayDeploymentStatusAcknowledgmentList, as the primary purpose is acknowledgment rather than data exchange.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager's gatewaynotificationconfiguration class, all fields including nested con...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:76-79
Timestamp: 2025-07-30T14:01:04.162Z
Learning: In WSO2 Carbon API Manager's GatewayNotificationConfiguration class, all fields including nested configuration objects (HeartbeatConfiguration, DeploymentAcknowledgementConfiguration, RegistrationConfiguration, GatewayCleanupConfiguration) are initialized with default values at field declaration level, ensuring that getGatewayNotificationConfiguration() and all its nested getters never return null.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
📚 Learning: in wso2 carbon api manager's apimanagerconfiguration class, the gatewaynotificationconfiguration fie...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:76-79
Timestamp: 2025-07-30T14:01:04.162Z
Learning: In WSO2 Carbon API Manager's APIManagerConfiguration class, the gatewayNotificationConfiguration field is initialized with a new GatewayNotificationConfiguration() instance during object construction, making getGatewayNotificationConfiguration() guaranteed to never return null. The configuration parsing only updates existing values through setters rather than replacing the entire object.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager's apimanagerconfiguration class, the gatewaynotificationconfiguration fie...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:76-79
Timestamp: 2025-07-30T14:01:04.162Z
Learning: In WSO2 Carbon API Manager's APIManagerConfiguration class, the gatewayNotificationConfiguration field is initialized as "new GatewayNotificationConfiguration()" at field declaration level, making getGatewayNotificationConfiguration() guaranteed to never return null. The GatewayNotificationConfiguration class also initializes all its nested configuration objects with default values at field declaration level.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
📚 Learning: in wso2 carbon api manager am_gw_revision_deployment table design, only one revision can be deployed...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2961-2971
Timestamp: 2025-07-28T14:36:35.061Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, only one revision can be deployed per API per gateway at any given time, making the primary key (GATEWAY_ID, API_ID) appropriate without including the revision identifier in the primary key.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager's gateway notification system, the heartbeat payload can serve dual purpo...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:2255-2281
Timestamp: 2025-07-28T02:36:45.367Z
Learning: In WSO2 Carbon API Manager's gateway notification system, the heartbeat payload can serve dual purposes - both as a regular heartbeat and as a registration mechanism when needed. This design choice makes gatewayId optional in the unified NotifyGatewayPayload schema, allowing heartbeat requests to function as registration if required.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager's gatewaynotificationconfiguration, all nested configuration objects incl...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:81-87
Timestamp: 2025-07-30T13:59:48.856Z
Learning: In WSO2 Carbon API Manager's GatewayNotificationConfiguration, all nested configuration objects including GatewayCleanupConfiguration are initialized with default values at field declaration level, and the configuration parsing only updates existing values through setters, ensuring that null checks are unnecessary as the objects are guaranteed to be non-null.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
📚 Learning: in wso2 carbon api manager am_gw_revision_deployment table design, when a foreign key for api_id ref...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle.sql:4208-4217
Timestamp: 2025-07-27T19:20:51.530Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table design, when a foreign key for API_ID referencing AM_API(API_UUID) is added, it establishes proper referential integrity for tracking API revision deployments across gateway instances.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager am_gw_instances table, the last_updated column stores the deployment ackn...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/mysql_cluster.sql:2946-2952
Timestamp: 2025-07-28T13:36:36.027Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCES table, the LAST_UPDATED column stores the deployment acknowledgment timestamp from gateway notification payloads, not the database insertion time. It should not have DEFAULT CURRENT_TIMESTAMP as the timestamp comes from the gateway's heartbeat/notification message and must be set explicitly by the application code.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager's gatewayvalidationscheduler, the gatewaycleanupconfiguration is guarante...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:81-87
Timestamp: 2025-07-30T13:59:48.856Z
Learning: In WSO2 Carbon API Manager's GatewayValidationScheduler, the gatewayCleanupConfiguration is guaranteed to be non-null because GatewayNotificationConfiguration initializes it with default values in the constructor, and the configuration parsing only updates existing values rather than setting them to null.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
📚 Learning: when reviewing refactored/moved code in wso2 carbon api manager, if pre-existing issues are found th...
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:249-257
Timestamp: 2025-06-18T10:07:41.656Z
Learning: When reviewing refactored/moved code in WSO2 Carbon API Manager, if pre-existing issues are found that are outside the scope of the current PR (like code moves/refactoring), the team creates separate GitHub issues to track fixes rather than addressing them in the refactoring PR. This helps maintain focused PR scope.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager, the validateandschedulefederatedgatewayapidiscovery method should not th...
Learnt from: AnuGayan
PR: wso2/carbon-apimgt#13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:0-0
Timestamp: 2025-07-19T14:47:03.856Z
Learning: In WSO2 Carbon API Manager, the validateAndScheduleFederatedGatewayAPIDiscovery method should not throw exceptions or perform a null check on the environment parameter, as errors are only logged and the environment is validated earlier in the call chain to avoid impacting server startup.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon apimgt gateway service, when checking if registry properties should be updated in the...
Learnt from: Oshanath
PR: wso2/carbon-apimgt#13117
File: components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java:0-0
Timestamp: 2025-05-26T06:53:40.902Z
Learning: In WSO2 Carbon APIMGT gateway service, when checking if registry properties should be updated in the shouldUpdateRegistry method: if the secure vault resource doesn't exist in the registry, an exception should be thrown (not a graceful return true). The registry should only be updated (return true) when the secure vault exists but the specific property doesn't exist within it.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
📚 Learning: in the wso2 api manager codebase, the input to the `createcanonicalquerystring` method in `apiutil.j...
Learnt from: nimsara66
PR: wso2/carbon-apimgt#13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java:11919-11923
Timestamp: 2025-06-30T06:27:48.390Z
Learning: In the WSO2 API Manager codebase, the input to the `createCanonicalQueryString` method in `APIUtil.java` is already URL encoded, so additional encoding within this method is not required and should be avoided to prevent double encoding.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
📚 Learning: in the wso2 carbon api manager repository, `components/apimgt/org.wso2.carbon.apimgt.rest.api.common...
Learnt from: tharindu1st
PR: wso2/carbon-apimgt#13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml:12880-12892
Timestamp: 2025-07-20T17:30:51.843Z
Learning: In the WSO2 Carbon API Manager repository, `components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/publisher-api.yaml` is an automated copy file; changes should be made in the original source file, not in this generated copy.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: when reviewing code movement/refactoring prs, if logical issues are discovered in the moved code tha...
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConsumerImpl.java:3454-3476
Timestamp: 2025-06-18T09:51:26.533Z
Learning: When reviewing code movement/refactoring PRs, if logical issues are discovered in the moved code that existed before the refactoring, it's appropriate to defer fixing them to a separate effort with proper issue tracking, rather than expanding the scope of the refactoring PR.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager, the federatedapidiscovery abstract class internally manages scheduler li...
Learnt from: AnuGayan
PR: wso2/carbon-apimgt#13182
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/factory/GatewayHolder.java:75-111
Timestamp: 2025-07-17T13:51:10.322Z
Learning: In WSO2 Carbon API Manager, the FederatedAPIDiscovery abstract class internally manages scheduler lifecycle with a thread pool executor and concurrent map of scheduled tasks keyed by environment name, including a shutdown() method for cleanup. External storage of these instances is not required as the lifecycle management is handled within the abstract class itself.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
📚 Learning: in the wso2 carbon api manager internal service api specification (api.yaml), not all endpoints incl...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml:1126-1166
Timestamp: 2025-08-04T03:03:47.989Z
Learning: In the WSO2 Carbon API Manager internal service API specification (api.yaml), not all endpoints include the xWSO2Tenant header parameter. Several endpoints like /block, /revokedjwt, /apis/deployed-revisions, /notify, and /correlation-configs do not include this parameter, making it acceptable for some internal service endpoints to omit the xWSO2Tenant header without breaking consistency.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in the wso2 carbon api manager repository, sample bearer tokens used in openapi yaml documentation (...
Learnt from: tharindu1st
PR: wso2/carbon-apimgt#13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml:0-0
Timestamp: 2025-08-03T09:31:12.930Z
Learning: In the WSO2 Carbon API Manager repository, sample bearer tokens used in OpenAPI YAML documentation (e.g., in cURL examples) are not considered a Gitleaks issue unless they are actually flagged by the tool.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager am_gw_instance_env_mapping table, the primary key is defined as just (gat...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager AM_GW_INSTANCE_ENV_MAPPING table, the primary key is defined as just (GATEWAY_ID), which allows only one environment label per gateway. If multiple environment labels per gateway are needed, the primary key should be (GATEWAY_ID, ENV_LABEL).
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager database design, biyonfernando prefers using string-based varchar columns...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T14:23:12.679Z
Learning: In WSO2 Carbon API Manager database design, BiyonFernando prefers using string-based VARCHAR columns over normalized lookup tables for fields like STATUS in gateway-related tables, prioritizing implementation simplicity and maintainability over complex normalization structures.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in the wso2 carbon api manager openapi schema, the `modelprovider` object's `name` property refers t...
Learnt from: tharindu1st
PR: wso2/carbon-apimgt#13144
File: components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/resources/publisher-api.yaml:13034-13046
Timestamp: 2025-08-03T18:53:40.759Z
Learning: In the WSO2 Carbon API Manager OpenAPI schema, the `ModelProvider` object's `name` property refers to the model provider's name (not vendor), and should remain as `name` for consistency and correctness.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager am_gw_revision_deployment table, the column name revision_uuid is used co...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:3179-3189
Timestamp: 2025-07-28T18:53:01.550Z
Learning: In WSO2 Carbon API Manager AM_GW_REVISION_DEPLOYMENT table, the column name REVISION_UUID is used consistently across all database types (PostgreSQL, MySQL, Oracle, MSSQL, DB2, H2), not REVISION_ID. This column stores the revision identifier for tracking API revision deployments.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: the new `/tenant-info` get endpoint in the internal service api has proper response documentation in...
Learnt from: tharindu1st
PR: wso2/carbon-apimgt#13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:55:13.824Z
Learning: The new `/tenant-info` GET endpoint in the internal service API has proper response documentation in the OpenAPI specification, including a 200 response that references the `TenantInfoList` schema.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager database schema, when creating foreign key relationships between am_revis...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3894-3903
Timestamp: 2025-07-27T19:20:05.981Z
Learning: In WSO2 Carbon API Manager database schema, when creating foreign key relationships between AM_REVISION and AM_GW_REVISION_DEPLOYMENT tables, do not use CASCADE DELETE on the REVISION_ID foreign key. Revision records should not cascade delete deployment records because deployment history and current deployment state information should be preserved even if the revision record needs to be cleaned up. The relationship should prevent deletion of revisions that have active deployments, not cascade the deletion to deployment records.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: the new `/tenant-info` get endpoint in the internal service api is different from existing `/tenant-...
Learnt from: tharindu1st
PR: wso2/carbon-apimgt#13092
File: components/apimgt/org.wso2.carbon.apimgt.internal.service/.openapi-generator/api.yaml.sha256:0-0
Timestamp: 2025-05-26T07:46:05.429Z
Learning: The new `/tenant-info` GET endpoint in the internal service API is different from existing `/tenant-info/{username}` endpoints in other APIs. The new endpoint accepts filter parameters and returns lists of tenants, while the existing endpoints are for user-specific tenant information.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml
📚 Learning: in the gatewayvalidationscheduler class, the data retention cleanup is handled at the data insertion...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java:137-163
Timestamp: 2025-07-28T14:26:37.464Z
Learning: In the GatewayValidationScheduler class, the data retention cleanup is handled at the data insertion location rather than in the periodic GatewayValidationTask. The scheduler task only handles marking gateways as expired based on heartbeat inactivity.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
📚 Learning: in wso2 carbon api manager, scheduler.scheduleatfixedrate calls are not typically wrapped in try-cat...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayCleanupScheduler.java:0-0
Timestamp: 2025-07-28T03:41:10.644Z
Learning: In WSO2 Carbon API Manager, scheduler.scheduleAtFixedRate calls are not typically wrapped in try-catch blocks, following a consistent pattern across the codebase. This design decision prioritizes consistency with existing scheduler implementations over additional error handling.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java
📚 Learning: functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with cu...
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/AsyncApiParserUtil.java:51-60
Timestamp: 2025-06-18T11:14:40.788Z
Learning: Functions in org.wso2.carbon.apimgt.spec.parser may be maintained for backward compatibility with custom workflows, even if they're not actively used in the core codebase.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
📚 Learning: in wso2 carbon api manager callout service implementations, error messages should reference the actu...
Learnt from: nimsara66
PR: wso2/carbon-apimgt#13158
File: components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AWSBedrockGuardrailProviderServiceImpl.java:110-111
Timestamp: 2025-06-30T08:32:41.219Z
Learning: In WSO2 Carbon API Manager callout service implementations, error messages should reference the actual parameter names/keys that callers provide in configuration maps, not the internal variable names used in the method implementation. This helps users understand what they need to configure.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
📚 Learning: in wso2 carbon api manager database schema, the am_gw_instances table's env_labels column has been p...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/postgresql.sql:0-0
Timestamp: 2025-07-28T13:25:39.885Z
Learning: In WSO2 Carbon API Manager database schema, the AM_GW_INSTANCES table's ENV_LABELS column has been properly normalized by creating a separate AM_GW_INSTANCE_ENV_MAPPING table that establishes a one-to-many relationship between gateway instances and environment labels, improving referential integrity and query performance.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager, environment names are unique keys across the entire system, making it sa...
Learnt from: AnuGayan
PR: wso2/carbon-apimgt#13182
File: components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/FederatedAPIDiscovery.java:45-45
Timestamp: 2025-07-19T14:55:09.461Z
Learning: In WSO2 Carbon API Manager, environment names are unique keys across the entire system, making it safe to use them as keys in static maps for managing shared resources like scheduled discovery tasks without risk of conflicts between different instances.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in the graphqlschemadefinition class (and potentially other areas of the wso2 api manager codebase),...
Learnt from: thisaltennakoon
PR: wso2/carbon-apimgt#13149
File: components/apimgt/org.wso2.carbon.apimgt.spec.parser/src/main/java/org/wso2/carbon/apimgt/spec/parser/definitions/GraphQLSchemaDefinition.java:262-276
Timestamp: 2025-06-18T10:07:57.821Z
Learning: In the GraphQLSchemaDefinition class (and potentially other areas of the WSO2 API Manager codebase), template.getAuthType() can return null, which creates NPE risks when calling .equalsIgnoreCase() on the result. This specific issue has been tracked in https://github.com/wso2/api-manager/issues/3971.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
📚 Learning: in wso2 carbon api manager, biyonfernando prefers storing json data in blob columns as it can be vis...
Learnt from: BiyonFernando
PR: wso2/carbon-apimgt#13191
File: features/apimgt/org.wso2.carbon.apimgt.core.feature/src/main/resources/sql/oracle_rac.sql:3885-3891
Timestamp: 2025-07-28T13:03:45.797Z
Learning: In WSO2 Carbon API Manager, BiyonFernando prefers storing JSON data in BLOB columns as it can be visualized from DB clients, rather than using CLOB for human-readable text storage.
Applied to files:
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
🪛 Gitleaks (8.27.2)
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml
2080-2080: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
2080-2080: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: build-product (4, group4)
- GitHub Check: build-product (1, group1)
- GitHub Check: build-product (3, group3)
- GitHub Check: run-benchmark-test
- GitHub Check: build-product (2, group2)
- GitHub Check: build-carbon
🔇 Additional comments (7)
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/scheduler/GatewayValidationScheduler.java (1)
130-156
: LGTM - Task implementation follows established design.The cleanup task correctly focuses on marking expired gateways based on heartbeat inactivity. The implementation properly handles configuration access, timestamp calculations, DAO interactions, and error handling.
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java (1)
3291-3293
: LGTM!The new constants for gateway-related organization deletion operations follow the established naming patterns and integrate well with the existing constants.
components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/DeploymentStatusNotifier.java (2)
199-227
: LGTM! Queue capacity limits properly implemented.The implementation correctly addresses the unbounded queue growth concern by:
- Checking the return value of
offer()
to detect when queue is full- Logging detailed error messages with current and max queue sizes
- Preventing memory exhaustion by dropping jobs when queue reaches capacity
311-320
: LGTM! Resource management properly implemented.The implementation correctly handles resources by:
- Using nested try-with-resources blocks for both CloseableHttpResponse and InputStream
- Reading response content only once through the InputStream
- Ensuring all resources are properly closed
This addresses the previous concerns about resource leaks and double-reading of response content.
components/apimgt/org.wso2.carbon.apimgt.rest.api.admin.v1/src/main/resources/admin-api.yaml (1)
5390-5394
: Confirm status vocabulary matches runtime valuesThe schema exposes
ACTIVE | EXPIRED
, whereas earlier discussions (and other status-style enums) mentionedINACTIVE
orSTALE
.
Please verify the backend actually emits only these two literals to avoid contract drift.
If additional states are possible, expand the enum here before it becomes locked-in.components/apimgt/org.wso2.carbon.apimgt.internal.service/src/main/resources/api.yaml (2)
1126-1165
: Add tenant header to keep multi-tenant contract intactNeither
/notify-gateway
nor its response model carries tenant context.
Most internal-service endpoints that can be called by multiple tenants includexWSO2Tenant
(see/keymanagers
,/apis
, …). Omitting it here forces implementers to rely on out-of-band mechanisms to determine tenant, which breaks the uniform contract the spec already follows elsewhere.post: + parameters: + - $ref: '#/components/parameters/requestedTenant'Aligning the new endpoint with the existing pattern avoids surprises for SDK generators and consumers.
1166-1208
: Repeat the tenant header for the deployment-status endpointFor the same reason as the previous comment, include the shared
requestedTenant
parameter on/notify-api-deployment-status
to preserve consistency and avoid implicit tenant resolution.
// Thread pool configuration constants | ||
public static final int BATCH_PROCESSOR_MIN_THREAD = 2; | ||
public static final int BATCH_PROCESSOR_MAX_THREAD = 8; | ||
public static final long BATCH_PROCESSOR_KEEP_ALIVE = 60000L; | ||
public static final int BATCH_PROCESSOR_QUEUE_SIZE = 50; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify thread pool configuration values for the batch processor.
The batch processor thread pool is configured with:
- Min threads: 2
- Max threads: 8
- Queue size: 50
Please verify these values are appropriate for the expected gateway notification load in production environments.
🌐 Web query:
What are the recommended thread pool configuration values for batch processing in high-throughput systems, specifically for min/max threads and queue size?
💡 Result:
Recommended thread pool configuration values for batch processing in high-throughput systems depend on whether your tasks are CPU-intensive or I/O-intensive, but the key is to balance throughput, latency, and resource usage while preventing overload or resource exhaustion.
Thread Pool Size (min/max threads):
-
For CPU-intensive batch tasks: Set the pool size (min and max) to the number of CPU cores (N) or cores + 1—this ensures maximum CPU utilization without excessive context switching[1][2][5].
-
For I/O-intensive batch tasks: Configure the pool to 2N or higher, as threads spend significant time waiting for I/O, and more threads can be used without exhausting the CPU. Some sources even suggest experimenting with higher multiples of N for highly asynchronous workloads[1][5].
-
General best practice: Start with
corePoolSize = N
or2N
depending on workload, and adjustmaximumPoolSize
upward only if you see underutilization and no resource contention; avoid "unbounded" thread pools as they easily lead to resource exhaustion[1][9][10].
Queue Size:
- Batch processing with high throughput: Use a bounded queue to buffer tasks; an unbounded queue may eventually exhaust system memory and is not recommended in most scenarios[1][7][5].
- Queue sizing tip: The optimal queue size can be estimated using Little’s Law:
where
L = λ * W
L
is the number of parallel tasks (queue + active),λ
is the average task arrival rate, andW
is the average execution time[5]. Set the queue size based on the maximum number of pending tasks the system can handle without excessive memory or latency.
Example Recommendations:
- For a machine with 16 CPU cores performing I/O-bound batch processing:
corePoolSize
: 32 (2 x CPUs)maxPoolSize
: 32–64 (test for appropriate scaling)queueCapacity
: 1000–5000 (monitor memory and task wait time to fine-tune)[1][5][8][9]
- For a CPU-bound batch ETL job on an 8-core server:
corePoolSize
: 8–9maxPoolSize
: 8–10queueCapacity
: 100–500
Other Considerations:
- For latency-sensitive workloads, increase the thread count and decrease queue size; for pure throughput, buffer with a larger queue and set thread count to available resources[1][3][5].
- Monitor thread pool metrics in production (active threads, queue wait time, queue size) and adjust conservatively if you observe saturation, high latencies, or frequent application-level throttling/rejection[5][6][8].
- Never set queue size to unbounded for batch; this risks out-of-memory errors and unpredictable latencies[7].
Summary Table:
Workload Type | corePoolSize | maxPoolSize | queueCapacity |
---|---|---|---|
CPU-intensive | N or (N+1) | N or (N+1) | Small (<1000) |
I/O-intensive | 2N or higher | 2N–4N (test upper bound) | Moderate (500–5000) |
High-throughput batch | As above, balance to avoid overload | As above | Bounded only |
Always validate configuration through load testing under production-like conditions before deploying to live workloads[5][9][6][8].
Citations:
- 1: https://www.alibabacloud.com/blog/java-thread-pool-implementation-and-best-practices-in-business-applications_601528
- 2: https://pythonspeed.com/articles/two-thread-pools/
- 3: https://www.alibabacloud.com/blog/601528
- 4: https://docs.oracle.com/middleware/12213/wls/PERFM/wls_tuning.htm
- 5: https://engineering.zalando.com/posts/2019/04/how-to-set-an-ideal-thread-pool-size.html
- 6: https://blog.devops.dev/how-to-determine-java-thread-pool-size-a-comprehensive-guide-4f73a4758273
- 7: https://discuss.elastic.co/t/change-threadpool-queue-size-for-batch-process/110788
- 8: https://discuss.elastic.co/t/thread-pool-configuration-max-thread-pool-size/228089
- 9: https://softwaremill.com/threadpools-executors-and-java/
- 10: https://openliberty.io/docs/latest/thread-pool-tuning.html
Adjust batch‐processor thread‐pool settings to match workload and available cores
The hard-coded values in
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
(lines ~3503–3507)
may be too low for high-throughput or I/O-bound workloads. Rather than 2/8 threads with a 50-task queue, configure based on CPU cores (N) and task characteristics:
• For CPU-bound work:
– corePoolSize ≈ N (or N+1)
– maxPoolSize ≈ N (or N+1)
– queueCapacity: modest (e.g. < 1000)
• For I/O-bound/high-throughput work:
– corePoolSize ≈ 2 × N
– maxPoolSize ≈ 2 × N up to 4 × N (tuned under load)
– queueCapacity: bounded moderate (500–5 000), based on λ×W
• Always avoid unbounded queues; monitor active threads, queue wait times, and adjust conservatively under production load.
Recommendation:
- Externalize these constants to config (e.g. system properties or deployment files).
- Initialize thread counts at runtime using
Runtime.getRuntime().availableProcessors()
. - Perform load tests under expected gateway notification rates to fine-tune corePoolSize, maxPoolSize, and queueSize.
🤖 Prompt for AI Agents
In
components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIConstants.java
around lines 3503 to 3507, the batch processor thread pool settings are
hard-coded and may not suit all workloads. Refactor these constants to be
configurable via external configuration such as system properties or deployment
files. Modify the initialization to dynamically set corePoolSize and maxPoolSize
based on Runtime.getRuntime().availableProcessors(), adjusting queue size
accordingly. Ensure the configuration supports tuning for CPU-bound or I/O-bound
workloads and avoid unbounded queues by setting reasonable limits. Finally,
recommend load testing to fine-tune these values under expected production
conditions.
/environments/{environmentId}/gateways: | ||
get: | ||
tags: | ||
- Environments | ||
summary: Get Gateway Instances in a Gateway Environment | ||
description: | | ||
Retrieve list of gateway Instances in the gateway environment. | ||
parameters: | ||
- $ref: '#/components/parameters/environmentId' | ||
responses: | ||
200: | ||
description: | | ||
OK. | ||
List of gateway Instances in the gateway environment returned | ||
headers: | ||
Content-Type: | ||
description: | | ||
The content type of the body. | ||
schema: | ||
type: string | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/GatewayInstanceList' | ||
400: | ||
$ref: '#/components/responses/BadRequest' | ||
404: | ||
$ref: '#/components/responses/NotFound' | ||
406: | ||
$ref: '#/components/responses/NotAcceptable' | ||
security: | ||
- OAuth2Security: | ||
- apim:admin | ||
- apim:environment_read | ||
x-code-samples: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add missing Accept
header & drop atypical 400 to match contract of all other collection GETs
Every collection‐level GET in this spec advertises an optional Accept
header and omits 400
.
This fresh /environments/{environmentId}/gateways
operation diverges from that convention, which breaks client uniformity and Swagger-codegen templates that rely on a stable surface.
parameters:
- $ref: '#/components/parameters/environmentId'
+ - $ref: '#/components/parameters/Accept'
@@
- 400:
- $ref: '#/components/responses/BadRequest'
While touching the block, consider lower-casing “gateway Instances” in the description to avoid mid-sentence capitalisation drift.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
/environments/{environmentId}/gateways: | |
get: | |
tags: | |
- Environments | |
summary: Get Gateway Instances in a Gateway Environment | |
description: | | |
Retrieve list of gateway Instances in the gateway environment. | |
parameters: | |
- $ref: '#/components/parameters/environmentId' | |
responses: | |
200: | |
description: | | |
OK. | |
List of gateway Instances in the gateway environment returned | |
headers: | |
Content-Type: | |
description: | | |
The content type of the body. | |
schema: | |
type: string | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/GatewayInstanceList' | |
400: | |
$ref: '#/components/responses/BadRequest' | |
404: | |
$ref: '#/components/responses/NotFound' | |
406: | |
$ref: '#/components/responses/NotAcceptable' | |
security: | |
- OAuth2Security: | |
- apim:admin | |
- apim:environment_read | |
x-code-samples: | |
/environments/{environmentId}/gateways: | |
get: | |
tags: | |
- Environments | |
summary: Get Gateway Instances in a Gateway Environment | |
description: | | |
Retrieve list of gateway Instances in the gateway environment. | |
parameters: | |
- $ref: '#/components/parameters/environmentId' | |
- $ref: '#/components/parameters/Accept' | |
responses: | |
200: | |
description: | | |
OK. | |
List of gateway Instances in the gateway environment returned | |
headers: | |
Content-Type: | |
description: | | |
The content type of the body. | |
schema: | |
type: string | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/GatewayInstanceList' | |
404: | |
$ref: '#/components/responses/NotFound' | |
406: | |
$ref: '#/components/responses/NotAcceptable' | |
security: | |
- OAuth2Security: | |
- apim:admin | |
- apim:environment_read | |
x-code-samples: |
🤖 Prompt for AI Agents
In
components/apimgt/org.wso2.carbon.apimgt.rest.api.common/src/main/resources/admin-api.yaml
between lines 2044 and 2078, add an optional Accept header parameter to the GET
/environments/{environmentId}/gateways operation to align with other collection
GETs, and remove the 400 response to maintain consistency with the spec. Also,
update the description text to use lowercase "gateway instances" instead of
"gateway Instances" for consistent capitalization.
Purpose
This PR include implementation of API Revision Deployment Monitoring. The breakdown of the implementation is as bellow
Healthcheck implementation
Revision deployment status implementation
Cleanup logic implementation
Publisher Portal Related implementation
Admin Portal