Skip to content

feat: support ai dump and sync#2143

Open
harshadixit12 wants to merge 14 commits into
feat/ai-gateway-file-convertfrom
feat/deck-ai-sync-diff-dump
Open

feat: support ai dump and sync#2143
harshadixit12 wants to merge 14 commits into
feat/ai-gateway-file-convertfrom
feat/deck-ai-sync-diff-dump

Conversation

@harshadixit12

@harshadixit12 harshadixit12 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

In this PR, we are supporting two commands - deck ai sync and deck ai dump - which will accept, and return declarative config containing the AI Gateway entities - and internally convert to Kong 3.x format and sync with on-prem AI Gateway.

Depends on -
Kong/go-database-reconciler#496
Kong/go-kong#624

@harshadixit12 harshadixit12 force-pushed the feat/deck-ai-sync-diff-dump branch from b0c8cb5 to 8713afd Compare July 14, 2026 09:17
@codecov-commenter

codecov-commenter commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 14.17625% with 224 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.63%. Comparing base (fb7de74) to head (25fdbde).

Files with missing lines Patch % Lines
cmd/ai_dump.go 0.00% 82 Missing ⚠️
cmd/ai_sync.go 0.00% 70 Missing ⚠️
tests/integration/test_utils.go 0.00% 26 Missing ⚠️
cmd/ai.go 64.91% 16 Missing and 4 partials ⚠️
cmd/common.go 0.00% 16 Missing ⚠️
cmd/gateway_dump.go 0.00% 4 Missing ⚠️
cmd/root.go 0.00% 4 Missing ⚠️
cmd/file_ai2kong.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@                       Coverage Diff                        @@
##           feat/ai-gateway-file-convert    #2143      +/-   ##
================================================================
- Coverage                         36.32%   35.63%   -0.69%     
================================================================
  Files                                79       82       +3     
  Lines                              7504     7753     +249     
================================================================
+ Hits                               2726     2763      +37     
- Misses                             4532     4740     +208     
- Partials                            246      250       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@harshadixit12 harshadixit12 force-pushed the feat/deck-ai-sync-diff-dump branch from 316bbe0 to 31d033c Compare July 15, 2026 04:32
@harshadixit12 harshadixit12 marked this pull request as ready for review July 15, 2026 04:59
Comment thread cmd/ai_sync.go
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

GitHub Action actions/checkout persist Git credentials in workflow - low severity
actions/checkout v2 and above persist the default GITHUB_TOKEN in the repository's local git config when persist-credentials is not set to false, during the workflow run. Subsequent workflow steps or third-party actions can read this token from git configuration, increasing the risk of credential theft or misuse within the pipeline. In order to limit the attack surface when external actions are compromised, ensure persist-credentials is set to false.

Show fix

Remediation: Set persist-credentials: false on actions/checkout steps that do not need to push commits back to the repository. Only keep persist-credentials: true when the workflow explicitly performs authenticated git push operations.

Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

@harshadixit12

Copy link
Copy Markdown
Contributor Author

@Prashansa-K - The UX isnt perfect - I'm doing a self review and will add 1-2 more commits. Opened for review so that I could get another set of eyes on the integration tests for ai sync and dump - using the inputs and outputs from file_ai2kong itself.

Comment thread cmd/ai.go Outdated
Comment thread cmd/ai.go
Comment thread cmd/ai_dump.go
Comment thread cmd/ai_dump.go Outdated
Comment thread cmd/ai_dump.go
SelectTags: dumpConfig.SelectorTags,
Workspace: aiDumpWorkspace,
Filename: "",
WithID: false,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

revert layer of ai-deck-converter does not support retaining IDs

Comment thread cmd/ai_sync.go Outdated
@harshadixit12 harshadixit12 changed the title feat: support diff and dump feat: support ai dump and sync Jul 15, 2026
Comment thread cmd/ai_dump.go Outdated
Comment thread tests/integration/test_utils.go
Comment thread tests/integration/ai_dump_test.go Outdated
Comment thread tests/integration/ai_sync_test.go Outdated
// orders plugins by name and foreign-key ID (see FPlugin.sortKey in
// go-database-reconciler), so entities that share a name and route - such as
// the two ai-proxy-advanced plugins bound to one route - are emitted in a
// server-ID-dependent order that differs between independent syncs. A KeyAuth

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.

Can this create unnecessary diffs for our endusers?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

verifying

@harshadixit12 harshadixit12 Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Shouldn't - we already use sorting before comparing state for plugins in the integration tests (src) - it was missing model as part of its sort key
This needed a new function with own sorting logic because it is not comparing against a static kong state - let me check if this duplication can be resolved.

@harshadixit12 harshadixit12 Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Gave it some more thought - existing way of testing kong state in tests does this - creates a dump, and then compares with hardcoded kong state - but here we are comparing two dumps which have happened - and not hardcoded state.
Because these dumps are from different syncs - the IDs will be different, hence the custom comparison by parsing into file.Content.

Comment thread tests/integration/ai_sync_test.go Outdated
Comment thread cmd/common.go
Comment thread cmd/common.go Outdated
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.

3 participants