Skip to content

fix: preserve array config entries on save#92

Merged
danny-avila merged 7 commits into
mainfrom
danny-avila/fix-indexed-array-config-saves
Jun 25, 2026
Merged

fix: preserve array config entries on save#92
danny-avila merged 7 commits into
mainfrom
danny-avila/fix-indexed-array-config-saves

Conversation

@danny-avila

Copy link
Copy Markdown
Contributor

Summary

I fixed array-object configuration saves so newly-added model spec entries and scoped overrides preserve array shape instead of overwriting index 0 or persisting numeric-key objects.

  • Extracted the config edit-map update logic into applyConfigEdit so a pending whole-array edit remains authoritative when a newly-added entry is typed into.
  • Normalized indexed array entries in scoped profile saves before PATCHing the Admin API, using scope overrides first and base config as the fallback array source.
  • Added regression coverage for the add-then-edit path that previously converted modelSpecs.list back into modelSpecs.list.0.

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • Ran bun test src/components/configuration/utils.test.ts
  • Ran bun run lint
  • Ran bun run build
  • Ran SESSION_SECRET=0123456789abcdef0123456789abcdef bun run test
  • Ran Prettier check on the changed files

Test Configuration:

  • Bun 1.3.13
  • Vitest 4.1.9
  • Vite 8.0.16

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes

Copy link
Copy Markdown
Contributor Author

@codex review

Comment thread src/server/scopes.ts

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19a94734d0

ℹ️ 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".

Comment thread src/server/scopes.ts
Comment thread src/components/configuration/utils.ts
Comment thread src/server/scopes.ts Outdated
const restByPath = new Map<string, number>();

for (const entry of entries) {
const match = INDEXED_ARRAY_RE.exec(entry.fieldPath);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Don't classify numeric record keys as array indexes

This treats every profile field path ending in a numeric segment as an array element. Profile imports flatten ordinary objects before calling bulkSaveProfileValuesFn (src/components/configuration/ConfigPage.tsx:672-675), so a valid numeric record key such as mcpServers.foo.headers.404 is now grouped as an update to array path mcpServers.foo.headers; because the existing source is an object, the merge builds [] and PATCHes headers as an array with index 404 instead of preserving the record key. The previous scoped bulk save sent that flattened record path directly, so this corrupts scoped imports/updates for configs containing numeric object keys.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

@codex review

@danny-avila

Copy link
Copy Markdown
Contributor Author

@codex review

Comment thread src/server/scopes.ts
Comment thread src/server/scopes.ts
@danny-avila

Copy link
Copy Markdown
Contributor Author

@codex review

@danny-avila

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 21256edd05

ℹ️ 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".

Comment thread src/server/config.ts
@danny-avila

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5aa1a79a9

ℹ️ 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".

Comment thread src/server/scopes.ts Outdated
@danny-avila

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 9e59163629

ℹ️ 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".

@danny-avila

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 9e59163629

ℹ️ 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".

@danny-avila danny-avila changed the title 🧬 fix: Preserve Array Config Entries On Save fix: preserve array config entries on save Jun 24, 2026
@danny-avila danny-avila merged commit 64bc4b6 into main Jun 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Admin Panel: adding a new modelSpecs.list entry overwrites index 0 and group-specific model specs are not rendered correctly after save

2 participants