Skip to content

fix: handle provider overlay subtables#228

Merged
pedronauck merged 2 commits into
compozy:mainfrom
Viniciuscarvalho:fix/onboarding-provider-overlay
May 29, 2026
Merged

fix: handle provider overlay subtables#228
pedronauck merged 2 commits into
compozy:mainfrom
Viniciuscarvalho:fix/onboarding-provider-overlay

Conversation

@Viniciuscarvalho
Copy link
Copy Markdown
Contributor

@Viniciuscarvalho Viniciuscarvalho commented May 28, 2026

Summary

  • Fixes Web UI first-run onboarding failing with Internal Server Error when saving the Codex provider overlay after [providers.codex.models] already exists.
  • Updates config overlay deletion so implicit provider tables remove their descendant TOML subtables before the provider table is rewritten.
  • Adds regression coverage for both the TOML overlay editor and the settings service path used by onboarding.

Changes

  • Config persistence: internal/config/persistence.go now deletes descendant table blocks when the requested parent path is implicit, preventing duplicate TOML table collisions during provider overlay replacement.
  • Regression coverage: internal/config/persistence_test.go covers deleting an implicit provider table subtree containing [providers.codex.models] and [[providers.codex.models.curated]] while preserving unrelated provider tables.
  • Onboarding/settings path: internal/settings/service_test.go covers saving the native CLI Codex provider overlay with a pre-existing [providers.codex.models] block, matching the Web UI first-run setup failure mode.
  • Docs/examples: No stale docs, top-level markdown, examples, fixtures, .github, or release artifacts found for this internal config persistence fix. Related E2E surfaces are web/e2e/fixtures/workspace.ts provider save/onboarding completion flow and web/e2e/__tests__/settings.spec.ts provider overlay save/delete coverage.

Release Notes

🐛 Bug Fixes

  • Web UI first-run onboarding can now save the Codex provider overlay when config already contains [providers.codex.models].

Test plan

  • go test ./internal/config ./internal/settings -run 'TestOverlayEditorDeleteImplicitTableSubtree|TestCollectionMutationsCodexNativeProviderOverlay' -count=1
  • go test ./internal/config ./internal/settings -count=1
  • make build
  • make verify before commit
  • make verify after commit

Fixes #227

Summary by CodeRabbit

  • Bug Fixes

    • Configuration deletion now properly removes all nested settings and sub-configurations when deleting providers and other configuration items, ensuring complete cleanup of related entries.
  • Tests

    • Added test coverage for deletion of nested configuration structures and provider overlay persistence.

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

@Viniciuscarvalho is attempting to deploy a commit to the Compozy Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a218b801-168a-491b-a22c-4e290b955458

📥 Commits

Reviewing files that changed from the base of the PR and between 0f88ec8 and 0af320f.

📒 Files selected for processing (3)
  • internal/config/persistence.go
  • internal/config/persistence_test.go
  • internal/settings/service_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • internal/config/persistence_test.go
  • internal/settings/service_test.go
  • internal/config/persistence.go

Walkthrough

Fixes TOML overlay deletion to remove all descendant table/array-table blocks under a deleted path; adds a helper to collect descendant ranges and unit/integration tests covering Codex provider overlay deletion and onboarding.

Changes

TOML Overlay Descendant Deletion Fix

Layer / File(s) Summary
Descendant table deletion logic and helper
internal/config/persistence.go
overlayDocument.descendantTableBlocks collects table and array-table block ranges under a path; deletePathInOverlayDocument deletes those ranges in reverse order. Adds slices import.
TOML deletion unit test
internal/config/persistence_test.go
TestOverlayEditorDeleteImplicitTableSubtree constructs nested TOML (providers.codex with nested tables/array-tables), deletes providers.codex, and asserts all descendants are removed while unrelated sections remain.
Codex provider overlay integration test
internal/settings/service_test.go
TestCollectionMutationsCodexNativeProviderOverlay applies a Codex native-CLI provider overlay via PutCollectionItem and asserts the mutation writes to WriteTargetGlobalConfig.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: handle provider overlay subtables' clearly and specifically describes the main change—fixing handling of provider overlay subtables in TOML configuration persistence.
Linked Issues check ✅ Passed The PR fully addresses issue #227: it implements deletion of implicit descendant TOML table blocks and adds regression tests validating the provider overlay replacement behavior during onboarding.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the provider overlay subtable deletion issue: persistence logic enhancement, unit test coverage for the fix, and integration test for the onboarding scenario.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@pedronauck pedronauck merged commit 0c93ffb into compozy:main May 29, 2026
8 of 10 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] Web UI first-run onboarding returns Internal Server Error

2 participants