Skip to content

feat(data): add endpoints for set subgraph property data - #127

Open
robigupt wants to merge 6 commits into
AudioReach:feature/use-case-designerfrom
robigupt:feature/set-sg-property-data
Open

robigupt wants to merge 6 commits into
AudioReach:feature/use-case-designerfrom
robigupt:feature/set-sg-property-data

Conversation

@robigupt

Copy link
Copy Markdown
Contributor

add requirements for set subgraph property data

@robigupt
robigupt requested review from a team August 24, 2026 12:28
@robigupt robigupt changed the title feat(data): add endpoints for set property data feat(data): add endpoints for set subgraph property data Aug 24, 2026
@robigupt
robigupt force-pushed the feature/set-sg-property-data branch 4 times, most recently from 1fdf6fe to d6cb7f8 Compare August 30, 2026 06:48

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files Not Fully Analyzed

  • packages/api/src/infrastructure-wrapper/persistence/unit-of-work/typeorm-unit-of-work.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/command-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/query-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/query-services.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/subgraph-property-definition/subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/vcpm-definition/vcpm-definition-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/dto/subgraph-write-result-types.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-property/update-subgraph-property.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-scenario/update-subgraph-scenario.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-vsid/update-subgraph-vsid.command.ts - Full file content skipped due to token limit
  • packages/core/src/index.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/subgraph-property-definition/db-subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/typeorm-query-services.ts - Full file content skipped due to token limit

Qualcomm AI Review

@robigupt
robigupt force-pushed the feature/set-sg-property-data branch from 790591b to 5d968ff Compare August 30, 2026 12:15

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files Not Fully Analyzed

  • packages/api/src/infrastructure-wrapper/persistence/unit-of-work/typeorm-unit-of-work.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/command-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/query-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/query-services.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/subgraph-property-definition/subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/vcpm-definition/vcpm-definition-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/repositories/module/module.repository.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/build-subgraph-with-defaults.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/dto/subgraph-write-result-types.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/get-property/get-subgraph-property.query.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/patch/patch-subgraph.handler.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/subgraph-property-ids/subgraph-property-ids.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-property/update-subgraph-property.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-scenario/update-subgraph-scenario.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-vsid/update-subgraph-vsid.command.ts - Full file content skipped due to token limit
  • packages/core/src/index.ts - Full file content skipped due to token limit
  • packages/core/tests/unit/application/usecase-designer/subgraph/build-subgraph-with-defaults.spec.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/subgraph-property-definition/db-subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/typeorm-query-services.ts - Full file content skipped due to token limit

Qualcomm AI Review

@robigupt
robigupt force-pushed the feature/set-sg-property-data branch from 5d968ff to 3c9f276 Compare August 30, 2026 12:41

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files Not Fully Analyzed

  • packages/api/src/infrastructure-wrapper/persistence/unit-of-work/typeorm-unit-of-work.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/command-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/query-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/query-services.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/subgraph-property-definition/subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/vcpm-definition/vcpm-definition-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/repositories/module/module.repository.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/shared/serialize-elements.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/dto/subgraph-write-result-types.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/subgraph-property-ids/subgraph-property-ids.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-property/update-subgraph-property.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-scenario/update-subgraph-scenario.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-vsid/update-subgraph-vsid.command.ts - Full file content skipped due to token limit
  • packages/core/src/index.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/typeorm-query-services.ts - Full file content skipped due to token limit

Qualcomm AI Review

@robigupt
robigupt force-pushed the feature/set-sg-property-data branch from 3c9f276 to 9717fc0 Compare August 30, 2026 15:13

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files Not Fully Analyzed

  • packages/api/src/infrastructure-wrapper/persistence/unit-of-work/typeorm-unit-of-work.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/command-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/query-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/subgraph-property-definition/subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/vcpm-definition/vcpm-definition-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/repositories/module/module.repository.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/shared/serialize-elements.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/dto/subgraph-write-result-types.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/subgraph-property-ids/subgraph-property-ids.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-property/update-subgraph-property.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-scenario/update-subgraph-scenario.command.ts - Full file content skipped due to token limit
  • packages/core/src/index.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/subgraph-property-definition/db-subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/typeorm-query-services.ts - Full file content skipped due to token limit

Qualcomm AI Review

@robigupt
robigupt force-pushed the feature/set-sg-property-data branch from 9717fc0 to 38295a8 Compare August 30, 2026 15:54

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files Not Fully Analyzed

  • packages/api/src/infrastructure-wrapper/persistence/unit-of-work/typeorm-unit-of-work.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/command-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/query-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/query-services.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/subgraph-property-definition/subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/vcpm-definition/vcpm-definition-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/repositories/module/module.repository.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/shared/serialize-elements.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/dto/subgraph-write-result-types.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/subgraph-property-ids/subgraph-property-ids.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-scenario/update-subgraph-scenario.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-vsid/update-subgraph-vsid.command.ts - Full file content skipped due to token limit
  • packages/core/src/index.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/subgraph-property-definition/db-subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/typeorm-query-services.ts - Full file content skipped due to token limit

Qualcomm AI Review

@robigupt
robigupt force-pushed the feature/set-sg-property-data branch from 38295a8 to 41bf049 Compare August 30, 2026 16:26

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files Not Fully Analyzed

  • packages/api/src/infrastructure-wrapper/persistence/unit-of-work/typeorm-unit-of-work.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/command-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/query-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/query-services.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/subgraph-property-definition/subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/vcpm-definition/vcpm-definition-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/repositories/module/module.repository.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/shared/serialize-elements.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/dto/subgraph-write-result-types.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/get-property/get-subgraph-property.query.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/patch/patch-subgraph.handler.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-property/update-subgraph-property.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-scenario/update-subgraph-scenario.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-vsid/update-subgraph-vsid.command.ts - Full file content skipped due to token limit
  • packages/core/src/index.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/subgraph-property-definition/db-subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/typeorm-query-services.ts - Full file content skipped due to token limit

Qualcomm AI Review

@robigupt
robigupt force-pushed the feature/set-sg-property-data branch from 41bf049 to c7506a4 Compare August 30, 2026 16:42

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files Not Fully Analyzed

  • packages/api/src/infrastructure-wrapper/persistence/unit-of-work/typeorm-unit-of-work.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/command-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/query-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/query-services.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/subgraph-property-definition/subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/vcpm-definition/vcpm-definition-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/repositories/module/module.repository.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/shared/serialize-elements.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/dto/subgraph-write-result-types.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/get-property/get-subgraph-property.query.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/patch/patch-subgraph.handler.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/subgraph-property-ids/subgraph-property-ids.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-property/update-subgraph-property.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-scenario/update-subgraph-scenario.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-vsid/update-subgraph-vsid.command.ts - Full file content skipped due to token limit
  • packages/core/src/index.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/subgraph-property-definition/db-subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/typeorm-query-services.ts - Full file content skipped due to token limit

Qualcomm AI Review

@robigupt
robigupt force-pushed the feature/set-sg-property-data branch from c7506a4 to c22eeae Compare August 30, 2026 17:04

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files Not Fully Analyzed

  • packages/api/src/infrastructure-wrapper/persistence/unit-of-work/typeorm-unit-of-work.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/command-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/query-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/query-services.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/subgraph-property-definition/subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/vcpm-definition/vcpm-definition-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/repositories/module/module.repository.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/shared/serialize-elements.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/build-subgraph-with-defaults.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/dto/subgraph-write-result-types.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/patch/patch-subgraph.handler.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/subgraph-property-ids/subgraph-property-ids.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-property/update-subgraph-property.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-scenario/update-subgraph-scenario.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-vsid/update-subgraph-vsid.command.ts - Full file content skipped due to token limit
  • packages/core/src/index.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/subgraph-property-definition/db-subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/queries/typeorm-query-services.ts - Full file content skipped due to token limit

Qualcomm AI Review

* Wipes all CKV/TKV/tag cal data for a module and resets zero-CKV payloads
* to their factory defaults. Returns a mutation log.
*/
wipeCalData(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add 2 methods
wipeAllCkvData
wipeAllTkvData

adding zero ckv data is a business logic, it should be in core layer

switch (def.elementType) {
case PARAMETER_ELEMENT_TYPE.ConfigElement: {
return {
name: def.name ?? '',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't assign default values if fields have no value.

command.elements as unknown as ElementCalData[],
);
if (!serialized.ok) {
throw new InvalidOperationException(serialized.error);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this invalid operation or on invalid input?

@NithinSimon

Copy link
Copy Markdown
Contributor

Review Findings

  1. P1 subgraph.repository.ts:192 looks up new properties only in base tables. A property created earlier in the same edit session cannot receive data because it has not been committed yet. Use the overlay fetcher.
  2. P1 subgraph.repository.ts:345 removes VCPM instances only from base rows. An Audio-to-Voice-to-Audio transition in one session leaves pending VCPM CREATE actions intact and commits unwanted VCPM data.
  3. P1 update-subgraph-vsid.handler.ts:198 and update-subgraph-scenario.handler.ts:453 continue graph traversal through Audio nodes. A Voice A → Audio B → Voice C chain can incorrectly update or conflict with Voice C. Only enqueue Voice nodes.
  4. P2 serialize-elements.ts:458 uses 0 for formula-sized default arrays rather than evaluating arrayLenFormulaStr. Defaults such as count = 2 followed by an array sized by count fail serialization and persist null.
  5. P2 update-subgraph-property.handler.ts:32 and patch-subgraph.handler.ts:20 call base-table subgraphExists(). Subgraphs created or deleted in the active edit session are therefore handled incorrectly.

@robigupt
robigupt force-pushed the feature/set-sg-property-data branch from c22eeae to 64f8522 Compare September 2, 2026 18:00

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files Not Fully Analyzed

  • packages/api/src/infrastructure-wrapper/persistence/unit-of-work/typeorm-unit-of-work.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/command-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/orchestration/cqrs/registries/query-handler-registry.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/subgraph-property-definition/subgraph-property-def-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/query-services/vcpm-definition/vcpm-definition-query-service.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/repositories/module/module.repository.ts - Full file content skipped due to token limit
  • packages/core/src/application/ports/persistence/repositories/subgraph/subgraph.repository.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/dto/subgraph-write-result-types.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/subgraph-property-ids/subgraph-property-ids.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-property/update-subgraph-property.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-scenario/update-subgraph-scenario.command.ts - Full file content skipped due to token limit
  • packages/core/src/application/usecase-designer/subgraph/update-vsid/update-subgraph-vsid.command.ts - Full file content skipped due to token limit
  • packages/core/src/index.ts - Full file content skipped due to token limit
  • packages/infrastructure/persistence/src/persistence-typeorm-sqllite/repositories/subgraph/subgraph.repository.ts - Full file content skipped due to token limit

Qualcomm AI Review

Comment on lines 34 to 42
export class TypeOrmModuleRepository implements ModuleRepository {
private readonly spfModuleFetcher: SpfModuleOverlayFetcher;
private readonly nodeFetcher: NodeOverlayFetcher;
private readonly portFetcher: PortOverlayFetcher;
private readonly ckvOverlayFetcher: CkvOverlayFetcher;
private readonly tkvOverlayFetcher: TkvOverlayFetcher;

constructor(
private readonly writer: PendingChangeWriter,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[FUNCTIONALITY - High] Missing moduleNodeFetcher initialization causes runtime error

The TypeOrmModuleRepository class references this.moduleNodeFetcher in the getModulesBySubgraphId and wipeCalData methods (lines 441-461 and 596-600), but this field is never initialized in the constructor. This will cause a runtime error when these methods are called.

Impact: Any attempt to call getModulesBySubgraphId or wipeCalData will result in a TypeError: "Cannot read property 'loadBaselineNodeIdsForSubgraph' of undefined".

Fixed Code Snippet
export class TypeOrmModuleRepository implements ModuleRepository {
  private readonly spfModuleFetcher: SpfModuleOverlayFetcher;
  private readonly nodeFetcher: NodeOverlayFetcher;
  private readonly portFetcher: PortOverlayFetcher;
  private readonly ckvOverlayFetcher: CkvOverlayFetcher;
  private readonly tkvOverlayFetcher: TkvOverlayFetcher;
  private readonly moduleNodeFetcher: ModuleNodeFetcher; // Add this field

  constructor(
    private readonly writer: PendingChangeWriter,
    private readonly manager: EntityManager,
    private readonly uow: UnitOfWork,
  ) {
    const editActionsQs = new EditActionsQueryService(manager);
    this.spfModuleFetcher = new SpfModuleOverlayFetcher(manager, editActionsQs);
    this.nodeFetcher = new NodeOverlayFetcher(manager, editActionsQs);
    this.portFetcher = new PortOverlayFetcher(
      manager,
      editActionsQs,
      new IntentFetcher(manager, editActionsQs),
    );
    this.ckvOverlayFetcher = new CkvOverlayFetcher(
      manager,
      editActionsQs,
      new CkvParameterPayloadFetcher(manager, editActionsQs),
    );
    this.tkvOverlayFetcher = new TkvOverlayFetcher(manager, editActionsQs);
    this.moduleNodeFetcher = new ModuleNodeFetcher(manager, editActionsQs); // Initialize here
  }

Comment on lines +722 to +732
}),
);
}

private async writeZeroCkvResets(
resets: Array<{payloadSystemId: number; defaultValue: Uint8Array | null}>,
zeroCkvSystemId: number | undefined,
moduleSystemId: number,
sessionId: number,
groupId: string,
): Promise<number[]> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[PERFORMANCE - Medium] Potential N+1 query pattern in module calibration wipe

In the wipeCalData method of TypeOrmModuleRepository (lines 464-508), the writeZeroCkvResets method iterates over resets and calls writeDelta for each one sequentially (lines 735-747). This creates N separate database operations instead of batching them.

Impact: For modules with many parameters, this could result in hundreds of individual database writes, significantly impacting performance during scenario transitions.

Fixed Code Snippet
private async writeZeroCkvResets(
  resets: Array<{payloadSystemId: number; defaultValue: Uint8Array | null}>,
  zeroCkvSystemId: number | undefined,
  moduleSystemId: number,
  sessionId: number,
  groupId: string,
): Promise<number[]> {
  if (!zeroCkvSystemId || resets.length === 0) return [];
  
  // Batch all payload updates into a single operation
  await this.writer.writeDeltaBatch(
    resets.map(reset => ({
      targetTable: ENTITY_NAMES.CkvParameterPayload,
      targetSystemId: reset.payloadSystemId,
      aggregateId: moduleSystemId,
      delta: {payload: reset.defaultValue},
    })),
    sessionId,
    groupId,
    this.manager,
  );
  
  return [zeroCkvSystemId];
}

@robigupt
robigupt force-pushed the feature/set-sg-property-data branch 4 times, most recently from a39ae9c to af5bc51 Compare September 14, 2026 07:43
add requirements for set subgraph property data

Signed-off-by: Robin Gupta <robigupt@qti.qualcomm.com>
add llds for set subgraph property data

Signed-off-by: Robin Gupta <robigupt@qti.qualcomm.com>
add llds for set subgraph property data

Signed-off-by: Robin Gupta <robigupt@qti.qualcomm.com>
add end-to-end support for set subgraph data

Signed-off-by: Robin Gupta <robigupt@qti.qualcomm.com>
add lld for review comments

Signed-off-by: Robin Gupta <robigupt@qti.qualcomm.com>
fixed review comments

Signed-off-by: Robin Gupta <robigupt@qti.qualcomm.com>
@robigupt
robigupt force-pushed the feature/set-sg-property-data branch from af5bc51 to 38babd2 Compare September 15, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants