Skip to content

fix(import): preserve workbench subtypes and include serialization - #237

Merged
ThePlenkov merged 4 commits into
mainfrom
fix/tr-workbench-subtype-import
Oct 22, 2026
Merged

ThePlenkov merged 4 commits into
mainfrom
fix/tr-workbench-subtype-import

Conversation

@ThePlenkov

@ThePlenkov ThePlenkov commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Preserve registered workbench subtypes during transport and single-object imports while checking format support using the CTS base type.
  • Resolve exact registered subtypes before the base type, including Include and legacy Include identifiers, and recognize subtype-only registrations.
  • Serialize Include, executable report, module-pool, and subroutine-pool metadata with the corresponding program subtype.
  • Preserve subtype metadata and generated source contents during reverse mapping and source handoff.
  • Normalize CTS base types before transport import fallback.

Validation

  • 80 focused current-source tests covering transport imports, registry resolution, Includes, and single-object imports.
  • 5 serializer tests covering generated XML, generated ABAP contents, source handoff, and program subtype mappings.
  • Scoped format validation and diff checks.

@netlify

netlify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for adt-cli canceled.

Name Link
🔨 Latest commit 2ed8643
🔍 Latest deploy log https://app.netlify.com/projects/adt-cli/deploys/6ada497784cb9acce09b85ad

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9816bd8a-4894-477f-a14b-c9e2db3dd31f
📥 Commits

Reviewing files that changed from the base of the PR and between 4658f98 and 2ed8643.

📒 Files selected for processing: 7
  • packages/adk/src/base/registry.ts
  • packages/adk/src/objects/cts/transport-import.ts
  • packages/adk/tests/registry.test.ts
  • packages/adk/tests/transport-import.test.ts
  • packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts
  • packages/adt-plugin-abapgit/tests/serializer.test.ts
  • packages/adt-services/tests/services/import/object.test.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 90e96890-9ae6-47e1-9af0-f92d6c6c3bb1
📥 Commits

Reviewing files that changed from the base of the PR and between ae995a7 and 4658f98.

📒 Files selected for processing: 9
  • packages/adk/src/objects/cts/transport-import.ts
  • packages/adk/src/objects/repository/incl/incl.model.ts
  • packages/adk/tests/incl.test.ts
  • packages/adk/tests/transport-import.test.ts
  • packages/adt-plugin-abapgit/src/lib/handlers/adk.ts
  • packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts
  • packages/adt-plugin-abapgit/tests/serializer.test.ts
  • packages/adt-services/src/services/import/service.ts
  • packages/adt-services/tests/services/import/object.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The changes add subtype-aware ADK lookup and import behavior. They register includes as PROG/I and update the abapGit program handler to serialize and deserialize includes and executable programs.

Changes: Subtype-aware object support

Layer / File(s) Summary
Register and resolve ADK subtypes
packages/adk/src/objects/repository/incl/incl.model.ts, packages/adk/src/objects/cts/transport-import.ts, packages/adk/tests/incl.test.ts, packages/adk/tests/transport-import.test.ts
The include registry key changes to PROG/I, while legacy INCL still resolves to AdkInclude. Transport loading uses a registered workbench subtype when it matches the CTS type, and otherwise uses the CTS type.
Preserve subtype during import
packages/adt-services/src/services/import/service.ts, packages/adt-services/tests/services/import/object.test.ts
Import passes the full search-result type to the ADK factory. Format support checks and the returned object type continue to use the base type.
Serialize and deserialize program subtypes
packages/adt-plugin-abapgit/src/lib/handlers/adk.ts, packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts, packages/adt-plugin-abapgit/tests/serializer.test.ts
The program handler accepts AdkProgram and AdkInclude. It writes SUBC as I for includes and 1 for other objects. Deserialization maps I to PROG/I and other values to PROG/P. Tests cover serialization and round trips.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 4658f

The reviewed subtype import and include deserialization paths have no remaining identified blocker to merging.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main changes: preserving workbench subtypes during import and adding include serialization support.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 9…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 9 files.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

❤️ Share

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

@sourcery-ai

sourcery-ai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Preserve registered workbench subtypes and ABAP include identity across transport and single-object imports by using full ADT types for object resolution, while retaining CTS base types for compatibility and format selection; extend abapGit serialization to distinguish PROG/I includes from executable reports.

Sequence diagram for subtype-aware transport import

sequenceDiagram
    participant Transport as TransportImport
    participant Registry as TypeRegistry
    participant Factory as ADKFactory
    participant Endpoint as ObjectEndpoint

    Transport->>Registry: getRegisteredTypes()
    Transport->>Factory: get(name, workbenchType)
    Factory->>Endpoint: load()
    Endpoint-->>Factory: subtypeObject
    Factory-->>Transport: loadedObject
Loading

Sequence diagram for full-type single-object import

sequenceDiagram
    participant Import as ImportService
    participant Factory as ADKFactory
    participant Endpoint as SubtypeEndpoint
    participant Format as FormatRegistry

    Import->>Factory: get(name, fullType)
    Factory->>Endpoint: load()
    Endpoint-->>Factory: loadedObject
    Import->>Format: serialize(baseType)
    Format-->>Import: serializedObject
Loading

Flow diagram for include and report ABAP serialization

flowchart LR
    Source[ABAP object] --> Handler[ProgramHandler]
    Handler -->|AdkInclude| Include[PROG/I]
    Handler -->|AdkProgram| Report[PROG/P]
    Include --> IncludeFiles[.prog.abap and .prog.xml with SUBC I]
    Report --> ReportFiles[.prog.abap and .prog.xml with SUBC 1]
Loading

File-Level Changes

Change Details Files
Resolve registered workbench subtypes during transport and single-object imports while retaining CTS base-type compatibility for fallback and format selection.
  • Select a registered, valid workbench subtype for transport factory loading.
  • Pass the full search result type to the import factory while keeping the requested CTS type for format support and result metadata.
  • Add tests covering subtype selection, fallback behavior, and single-object imports.
packages/adk/src/objects/cts/transport-import.ts
packages/adk/tests/transport-import.test.ts
packages/adt-services/src/services/import/service.ts
packages/adt-services/tests/services/import/object.test.ts
Register ABAP includes under the PROG/I workbench type without removing legacy INCL compatibility.
  • Map PROG/I and INCL to the include model and programs/includes endpoint.
  • Verify both type registrations resolve to the include implementation.
packages/adk/src/objects/repository/incl/incl.model.ts
packages/adk/tests/incl.test.ts
Preserve include versus executable-program metadata in abapGit program serialization and deserialization.
  • Export the include model through the abapGit ADK handlers.
  • Serialize includes as .prog.abap and .prog.xml with SUBC I, while reports retain SUBC 1.
  • Deserialize SUBC I as PROG/I and SUBC 1 as PROG/P with corresponding program kinds.
  • Test include/report file output, metadata, source round trips, and namespaced serialization compatibility.
packages/adt-plugin-abapgit/src/lib/handlers/adk.ts
packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts
packages/adt-plugin-abapgit/tests/serializer.test.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepsource-io

deepsource-io Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in ae995a7...2ed8643 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Secrets Oct 22, 2026 5:37p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@amazon-q-developer amazon-q-developer Bot left a comment

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.

Review Summary

This PR correctly addresses the core problem: workbench subtypes (e.g. PROG/I) being collapsed to their CTS base type during transport import, and adds PROG/I include serialization as .prog.abap/.prog.xml.

Critical Issue Found

packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts — fromAbapGit type asymmetry

The toAbapGit serializer is correctly updated to emit SUBC: 'I' for includes, but fromAbapGit still hard-codes type: 'PROG/P' for all objects regardless of SUBC. When deserializing (Git → SAP) an include, the reconstructed ADK data will carry PROG/P instead of PROG/I, which will cause the factory to resolve it against the executable-program endpoint rather than the includes endpoint. The fix is to return type: subc === 'I' ? 'PROG/I' : 'PROG/P' in fromAbapGit.

Changes That Look Correct

  • transport-import.ts: The wbtype lookup logic (startsWith(${ctsType}/) + registry check) correctly selects the registered workbench subtype for factory resolution while falling back to the CTS base type.
  • incl.model.ts: Dual registration of INCL and PROG/I is the right approach for backward compatibility.
  • service.ts (importObject): Passing fullType (e.g. PROG/I) instead of baseType to factory.get() ensures the correct ADK endpoint is used while still using baseType for the format registry — this is the correct fix.
  • adk.ts: AdkInclude export added correctly.

You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Comment thread packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts Outdated
@codacy-production

codacy-production Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 39 complexity · 0 duplication

Metric Results
Complexity 39
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@nx-cloud

nx-cloud Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit b5394ab

Command Status Duration Result
nx affected -t lint test build e2e-ci --verbose... ✅ Succeeded 44s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-10-22 17:37:17 UTC

@ThePlenkov
ThePlenkov marked this pull request as ready for review October 22, 2026 16:39
@codeant-ai

codeant-ai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 4658f98 Oct 22, 2026 · 16:39 16:46

@codeant-ai

codeant-ai Bot commented Oct 22, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T17:48:45.039985Z 2ed8643 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@baz-reviewer

baz-reviewer Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review this PR on Baz

Merger   🟠 Needs Review

The non-trivial import/serialization change has no recorded CI run, violating the organization’s requirement that CI be green. Discussions are resolved, but CI verification is still required before merging.


@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Oct 22, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 4 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts" line_range="9" />
<code_context>
 import { createHandler } from '../base';

-export const programHandler = createHandler(AdkProgram, {
+export const programHandler = createHandler<AdkProgram | AdkInclude>('PROG', {
   schema: prog,
   version: 'v1.0.0',
</code_context>
<issue_to_address>
**Same-name includes overwrite reports**

When a transport contains an include and executable report with the same name, `importTransport` processes objects in parallel, and the PROG handler gives both includes and executable programs the same `.prog.abap` and `.prog.xml` paths. If a transport contains a same-named include and report, their writes race and one object’s files overwrite the other’s.

Detect conflicting output paths before writing, or serialize each object to a distinct path when names collide.
</issue_to_address>

### Comment 2
<location path="packages/adk/src/objects/repository/incl/incl.model.ts" line_range="178" />
<code_context>
 registerObjectType('INCL', IncludeKind, AdkInclude, {
   endpoint: 'programs/includes',
 });
+registerObjectType('PROG/I', IncludeKind, AdkInclude, {
+  endpoint: 'programs/includes',
+});
</code_context>
<issue_to_address>
**Includes resolve as programs**

When a caller asks for the kind of `PROG/I`, `getKindForType` strips the subtype and looks up `PROG`, returning `ProgramKind`; callers using the type-to-kind mapping therefore classify includes as programs.

Preserve the `PROG/I` subtype in type-to-kind resolution and return `IncludeKind`.
</issue_to_address>

### Comment 3
<location path="packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts" line_range="43" />
<code_context>
     return {
       name: (PROGDIR?.NAME ?? '').toUpperCase(),
-      type: 'PROG/P',
+      type: subc === 'I' ? 'PROG/I' : 'PROG/P',
       description: descriptionEntry?.ENTRY ?? 'Program',
       fixPointArithmetic: PROGDIR?.FIXPT === 'X',
</code_context>
<issue_to_address>
**Include metadata says subroutine pool**

When abapGit metadata has `PROGDIR.SUBC` equal to `I`, `fromAbapGit` sets `type` to `PROG/I` for an include but sets `programType` to `subroutinePool` for every `SUBC` other than `1`. Deserialized include data therefore carries conflicting type metadata to callers.

Map `SUBC === 'I'` to an include-specific `programType`, or omit `programType` when that property does not apply to includes.
</issue_to_address>

### Comment 4
<location path="packages/adt-services/tests/services/import/object.test.ts" line_range="125" />
<code_context>
+    });
+
+    expect(factoryGet).toHaveBeenCalledWith('ZAPI_STRUCTURE', 'TABL/DS');
+    expect(result.objectType).toBe('TABL');
+  });
 });
</code_context>
<issue_to_address>
**Subtype format check goes unverified**

When the import implementation checks format support using the full search type instead of the CTS base type, when `ImportService.importObject()` passes `TABL/DS` to the format support check, the test's `isSupported: vi.fn(() => true)` mock accepts it, and `result.objectType` still comes from the base type, so this test passes without verifying that format support is checked with `TABL`.

Mock `isSupported` with an argument-sensitive implementation and assert it is called with `TABL`.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 4 findings to address first, and if a subtype resolves to the wrong object or an include is serialized incorrectly, the import can leave incorrect .prog.abap or metadata files in the output directory. Reverting restores the old behavior, but already-generated files remain until removed or regenerated; the damage is bounded and repairable.

Blocking findings: packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts:9, packages/adk/src/objects/repository/incl/incl.model.ts:178, packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts:43, packages/adt-services/tests/services/import/object.test.ts:125


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts Outdated
Comment thread packages/adk/src/objects/repository/incl/incl.model.ts
Comment thread packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts Outdated
Comment thread packages/adt-services/tests/services/import/object.test.ts
@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues remain.

Summary

This PR preserves registered workbench subtypes during imports and adds Include serialization.

  • Imports keep registered ADT subtypes when selecting objects.
  • Program exports keep Include and program kinds in abapGit metadata.

The earlier createHandler type-argument finding remains fixed. No new actionable issues were found.

Reviews (3) · Last reviewed commit: "fix(adk): recognize exact subtypes and n..." · Reviewed by Greptile

Comment thread packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts Outdated
Comment thread packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts Outdated
@codeant-ai

codeant-ai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

CodeAnt PR Risk: Low Risk

  • The PR appears safe to merge; program serialization preserves include, executable, module-pool, and subroutine-pool types, with tests covering the mappings.

Assessed commit: b5394ab96baf

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 9 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/adt-services/tests/services/import/object.test.ts
Comment thread packages/adt-plugin-abapgit/tests/serializer.test.ts Outdated
Comment thread packages/adk/src/objects/repository/incl/incl.model.ts
Comment thread packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts Outdated
Comment thread packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts Outdated
@gitar-bot

gitar-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Gitar is working

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

Gitar

@ThePlenkov

Copy link
Copy Markdown
Member Author

/q review

@ThePlenkov

Copy link
Copy Markdown
Member Author

@greptileai Please review the current head b5394ab. The prior schema-generic finding has been addressed and current-head CI has passed.

@amazon-q-developer amazon-q-developer Bot left a comment

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.

Review Summary

This PR correctly introduces PROG/I subtype preservation during transport/single-object imports and adds AdkInclude serialization support to the abapGit plugin. The structural approach — registering PROG/I as an alias in the registry and using wbtype to select the right factory type — is sound. However, there are several logic errors introduced that need to be fixed before merge:

Critical Issues

  1. kindToAdt overwrite (incl.model.ts) — Registering PROG/I with IncludeKind overwrites kindToAdt entry set by the earlier INCL registration. getTypeForKind(Include) and resolveKind(Include) will return PROG/I after module load, breaking any code that relies on the reverse kind→type mapping for the Include kind.

  2. isTypeRegistered misses exact subtype (registry.ts) — The function only checks getMainType(), so isTypeRegistered('PROG/I') returns false even though PROG/I is registered. Since getKindForType was already updated to prefer exact matches, isTypeRegistered must be updated consistently.

  3. factoryType fallback uses raw this.type (transport-import.ts) — The fallback for factoryType is this.type (the raw, possibly-dirty string) rather than the already-trimmed/uppercased ctsType. Additionally, getRegisteredTypes().includes() performs an O(n) linear scan on every load() call; resolveType(workbenchType) !== undefined achieves the same check in O(1).

  4. programSubc type narrowing (prog.ts) — The function accesses obj.dataSync.programType on a AdkProgram | AdkInclude union. While the kind check guards the AdkInclude branch at runtime, TypeScript can't statically guarantee the narrowing inside the switch, and the property access is not type-safe for AdkInclude. Explicitly narrowing to AdkProgram before accessing program-specific properties would prevent future regressions if the guard is accidentally moved or removed.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Comment thread packages/adk/src/base/registry.ts
Comment thread packages/adk/src/base/registry.ts
Comment thread packages/adk/src/objects/cts/transport-import.ts Outdated
Comment thread packages/adk/src/objects/cts/transport-import.ts Outdated
Comment thread packages/adk/src/objects/repository/incl/incl.model.ts
Comment thread packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 39 complexity · 0 duplication

Metric Results
Complexity 39
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@sonarqubecloud

Copy link
Copy Markdown

@ThePlenkov

Copy link
Copy Markdown
Member Author

@codex review

@ThePlenkov
ThePlenkov merged commit bfca592 into main Oct 22, 2026
23 checks passed
@ThePlenkov
ThePlenkov deleted the fix/tr-workbench-subtype-import branch October 22, 2026 17:47
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 2ed86430ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThePlenkov

Copy link
Copy Markdown
Member Author

@coderabbitai review

@ThePlenkov

Copy link
Copy Markdown
Member Author

@greptileai review

@ThePlenkov

Copy link
Copy Markdown
Member Author

/q review

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Pull request is closed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@amazon-q-developer amazon-q-developer Bot left a comment

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.

Review Summary

This PR correctly addresses the core goal of preserving workbench subtypes (e.g., PROG/I) during transport imports, registering PROG/I as a distinct subtype for includes, and serializing program subtypes (M, S, I) in the abapGit handler. The logic for resolveType and isTypeRegistered fixes are sound improvements.

Critical issues found:

  1. registry.ts — kindToAdt last-writer-wins collision (getKindForType, line 190-191 diff): The dual registration of INCL and PROG/I for the same IncludeKind in incl.model.ts means kindToAdt will store whichever was registered last as the canonical type for includes. resolveKind(IncludeKind) and getTypeForKind(IncludeKind) will return PROG/I, not INCL. Any code relying on kind-to-type reverse lookup for includes will see the wrong type.

  2. transport-import.ts — wbtype-preservation logic edge case (lines 192-199): The startsWith(${ctsType}/) condition correctly handles PROG → PROG/I, but will silently fall back to ctsType for any case where wbtype equals ctsType (no slash in wbtype, e.g., INCL). This is likely intentional, but worth confirming it doesn't regress include transport imports where both type and wbtype are INCL.

  3. prog.ts — programSubc type narrowing (lines 9-12): The switch on obj.dataSync.programType is reached only for non-include objects guarded by isLoaded, but dataSync is typed from the union AdkProgram | AdkInclude. If AdkInclude does not have a dataSync property on its public type, TypeScript may still compile (due to the union) but runtime access could fail for any object that bypasses the kind guard. Verify that accessing dataSync on the union type does not introduce a runtime crash path.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Comment thread packages/adk/src/base/registry.ts
Comment thread packages/adk/src/objects/cts/transport-import.ts
Comment thread packages/adt-plugin-abapgit/src/lib/handlers/objects/prog.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

baz: needs human review size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant