Repository navigation
Conversation
When POST /variable returns 409 and the existing variable sits at a strictly higher scope, is a value, file or override, and has the same secret kind, the conflict toast offers "Create an override". It opens the override modal with the existing variable as parent and the value and scope the user typed. Other conflicts keep the link to the existing variable.
A variable overridden at a lower scope is muted and labelled "Overridden in <scope>"; the override is labelled "Overrides <scope>". Both labels scroll to the other row.
|
Qovery can create a Preview Environment for this PR.
This comment has been generated from Qovery AI 🤖.
|
|
View your CI Pipeline Execution ↗ for commit ec45943
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
All reported issues were addressed across 10 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## staging #3141 +/- ##
===========================================
- Coverage 53.39% 52.24% -1.15%
===========================================
Files 1444 592 -852
Lines 32446 16409 -16037
Branches 9657 5198 -4459
===========================================
- Hits 17323 8573 -8750
+ Misses 12384 6394 -5990
+ Partials 2739 1442 -1297
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A 409 can also come from a mount path clash with a variable of another key; that case now keeps the link to the existing variable instead of offering an override of an unrelated variable. The override modal replaced the creation modal at the same tree position, so it reused the creation form state (file format, mount path, interpolation toggle). A distinct key now forces a remount so the override form starts from the parent variable.
…e variable kind - Detect the 409 with isHttpStatus instead of the code the interceptor copies from the body. - Only offer an override when the request and the existing variable are the same kind (file or value). An existing override only carries its kind through the variable it overrides, which the 409 body does not include, so it keeps the link. - Clear the unsaved-changes guard armed by the creation form before swapping in the override form.
Jira: QOV-2445
Related changes:
Two changes that make variable inheritance easier to follow. We keep the explicit OVERRIDE type and fix the UX around it.
"Create an override" on a creation conflict
When
POST /variablereturns a 409 status, the toast now offers Create an override if the existing variable:VALUEorFILEvariable of the same kind as the request (a file when the request has a mount path, a value otherwise),is_secretas the request.Clicking it swaps the creation modal for the existing override modal, with the existing variable as parent and the value and scope the user had typed. Every other conflict keeps the "Go to the conflicting variable" link. That includes an existing
OVERRIDE: q-core stores overrides without a mount path and the 409 body doesn't include the overridden variable, so the Console can't tell a file override from a value override. The toast description is the API'sdetail, so the scope-aware message q-core is adding shows up as is.The rules mirror q-core's override validation and live in
@qovery/domains/variables/util(canOverrideConflictingVariable).useCreateVariable()takes an optionalonCreateOverride; the other callers (service and job creation flows, external secrets tab) don't pass it and keep today's behavior.Dependency: q-core's 409
existing_variableneedsvariable_type,is_secretandmount_path(q-core!4207). Without them the toast falls back to the link, so this PR is safe to merge first.Provenance in the service variable list
The service list already returned rows from every visible scope, with an OVERRIDE badge and the parent key under the override. Nothing marked the parent row, so you couldn't tell which value applied. Now:
Both labels scroll to the other row.
Testing
yarn nx test domains-variables-util --maxWorkers=2: 18 passed.yarn nx test domains-variables-feature --maxWorkers=2: 80 passed. New hook spec covers the eligible conflict, same scope, another key (mount path clash), an override of unknown kind, different secret kind, missing type in the body, no handler, noexisting_variable, and non-409 errors. Modal and list specs cover the prefill, the modal swap (fresh form, guard cleared), and both labels.nx run-many -t linton both variables libs: clean. Prettier on the changed files: clean.Summary by cubic
Makes variable inheritance easier to follow by converting eligible creation conflicts into override creation and by labeling which scope wins in the variable list.
VALUE/FILE, or anOVERRIDEwhose overridden variable reveals the kind) as the request, has the sameis_secret, and matches the requested key; it opens the override modal prefilled with the typed value and scope. Other conflicts—including a mount path clash with another key—keep the link to the existing variable.useCreateVariable()callers keep today's behavior: the override action only appears when anonCreateOverridehandler is passed.Dependency: the action requires
variable_typeandis_secretin the 409 body'sexisting_variable. Until q-core sends them, the toast falls back to the link, so this PR is safe to merge first.Written for commit ec45943. Summary will update on new commits.