Update v2 sync with main#4903
Closed
midigofrank wants to merge 35 commits into
Closed
Conversation
Broaden the GitHub-sync repo+branch guard from "no ancestor may share" to "no project in the same tree may share" (root, sandboxes, siblings, cousins all share one (repo, branch) namespace), and move the enforcement from a check-then-insert pattern in Elixir to a Postgres unique index. Two concurrent transactions in the same project family can no longer both succeed at READ COMMITTED. - Add Lightning.Projects.root_id/1 walking parent_id to the top. - Migration adds project_repo_connections.root_project_id (NOT NULL after backfill) and a unique index on (root_project_id, repo, branch). - ProjectRepoConnection sets root_project_id on insert, declares unique_constraint(:branch, name: ...), and exposes tree_unique_violation?/1 so the boundary can translate the constraint violation back to :branch_used_in_project_tree. - VersionControl.create_github_connection drops its in-memory pre-flight check and relies on the unique index for race-safety. - Tests cover sibling/cousin collisions, the renamed error, and a direct INSERT race that's only resolvable by the index. Co-authored-by: Claude <noreply@anthropic.com>
* Emit schema_version: '4.0' in v2 workflow and project YAML Adds a top-level `schema_version` key after `id` and `name` in both the TypeScript workflow serializer and the Elixir workflow/project serializer. The v2 JSON schema is extended to permit the key so round-trip parsing still passes its own validation. Parsers remain lenient — files without the key continue to parse unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * formatting on yaml output * add schema_version to v1 --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* restore v1 spec emitter * update test * force lowercase ids in v2 * lowercase in frontend
…ization Resolved conflicts: - CHANGELOG.md: merged unreleased entries from both branches - projects.ex: kept both root_id/1 and list_descendants/1 - projects_test.exs: kept describe blocks from both sides - export_utils.ex + webhook_reply fixture: kept deleted (V2 refactor) - yaml/util.ts: kept V2 pass-through refactor Note: channels and webhook_response_config export are not yet ported to the V2 serializer; the corresponding ported tests fail until a follow-up.
Brings two main-branch project-export features into the V2 portability format that the v2-sync refactor had left unported: - channels: emitted as a YAML array of objects (name, destination_url, enabled, destination_credential). The destination_credential reference uses V2's email|name credential-key form, consistent with a job's configuration: field. - webhook_response_config: nested under the webhook trigger step with the success_code / error_code the user has set; omitted when unset. Mirrored on the frontend (assets/js/yaml/v2.ts + schema) for webhook_response_config serialize/parse parity (channels are project-level, backend-only). The inherited tests asserted the v1/main shapes (a triggers: map and hyphenated credential refs); rewritten to the V2 steps-array shape. Also updated two pre-existing project-export tests that hadn't been adjusted when schema_version emission was added.
- Preserve webhook_response_config on import: the webhook branch of convertWorkflowSpecToState dropped the configured success/error status codes on every v2 import, unlike the cron and kafka branches. - Default a trigger's enabled to false on parse, matching the serializer, the Elixir emitter, and the Trigger schema default; parse previously defaulted to true, so the two directions of the module disagreed. - Round-trip JS conditions that collide with named condition literals: a js_expression body such as !state.errors is now preserved instead of being rewritten to on_job_success and dropping the expression. - Add `|` to the quote whitelist so credential keys (email|name) and `||` conditions stay unquoted, matching the Elixir emitter and avoiding byte-different YAML for the same workflow. Correct the stale module-doc comments and add round-trip tests covering each case.
The v2 project export preloaded the full credential chain (project_credential -> credential -> user) on every job and every channel, duplicating the project-level project_credentials that are already loaded. Build a project_credential_id -> "owner|name" lookup once from the project's credentials and resolve each job's configuration: and each channel's destination_credential: by id. workflow_struct_to_canonical now takes a :credential_keys option; serialize_workflow/1 has no project context, so it omits the option and falls back to the job's preloaded project_credential. Drop the redundant nested credential preloads from preload_project_for_export. Add a test covering a job whose configuration resolves from the project credentials by id.
…to v2-sync-finalization
Collaborator
Author
|
Dupilicate of #4722 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR [adds/changes/fixes]... (A description of your work goes here.)
Closes #__
Validation steps
Additional notes for the reviewer
AI Usage
Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):
You can read more details in our
Responsible AI Policy
Pre-submission checklist
/reviewwith Claude Code)
(e.g.,
:owner,:admin,:editor,:viewer)