refactor: parameterize deploy/stop pipeline status to eliminate SQL literal duplication#147
Merged
intel352 merged 2 commits intofeat/issue-86-admin-crud-decompfrom Feb 23, 2026
Merged
Conversation
3 tasks
…tus step Replace hardcoded status literals in SQL UPDATE queries with a parameterized approach using step.set to declare target_status at the top of each pipeline. - Deploy pipeline: set-target-status sets target_status = "active" - Stop pipeline: set-target-status sets target_status = "stopped" - update-status query now uses ? placeholder for status value - status is passed as first param referencing set-target-status.target_status The only structural difference between the two pipelines is now the value in set-target-status, making the semantic intent of each pipeline clear while the update logic (SQL query, param pattern) is identical. Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Decompose V1 CRUD routes into pipeline primitives
refactor: parameterize deploy/stop pipeline status to eliminate SQL literal duplication
Feb 23, 2026
intel352
added a commit
that referenced
this pull request
Feb 23, 2026
* feat: decompose V1 CRUD routes into pipeline primitives (#86) Replace 6 V1 CRUD routes that delegated to V1APIHandler with declarative pipeline primitives using step.request_parse, step.set, step.db_exec, step.db_query, step.conditional, and step.json_response: - POST /api/v1/admin/organizations/{id}/projects (create project) - POST /api/v1/admin/projects/{id}/workflows (create workflow) - POST /api/v1/admin/workflows (create workflow standalone) - PUT /api/v1/admin/workflows/{id} (update workflow with versioning) - POST /api/v1/admin/workflows/{id}/deploy (activate workflow) - POST /api/v1/admin/workflows/{id}/stop (stop workflow) Closes #86 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: parameterize deploy/stop pipeline status to eliminate SQL literal duplication (#147) * Initial plan * refactor: encapsulate deploy/stop status difference in set-target-status step Replace hardcoded status literals in SQL UPDATE queries with a parameterized approach using step.set to declare target_status at the top of each pipeline. - Deploy pipeline: set-target-status sets target_status = "active" - Stop pipeline: set-target-status sets target_status = "stopped" - update-status query now uses ? placeholder for status value - status is passed as first param referencing set-target-status.target_status The only structural difference between the two pipelines is now the value in set-target-status, making the semantic intent of each pipeline clear while the update logic (SQL query, param pattern) is identical. Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> * fix: resolve two syntax errors causing CI failures on PR #135 Bug 1 (admin/admin_test.go:189): TestMergeInto_WithRealAdminConfig had a broken function ending — the closing brace used 2-space indent and was followed by ')' instead of a proper '}'. Replace ' }\n)' with tab-indented '\t}\n}' to correctly close the if-block and the function. Bug 2 (cmd/server/main.go): The if *databaseDSN != "" block in main() was missing its closing '}'. The block contained a full inline multi-workflow implementation that duplicated the existing runMultiWorkflow() function. Fix by replacing the entire inline block with a delegation call to runMultiWorkflow(logger), which is the canonical implementation. Additional fixes applied while resolving Bug 2: - Remove duplicate "errors" import that caused redeclaration error - Fix loadConfig() call in runMultiWorkflow to accept all 3 return values (was missing the appCfg return value, causing assignment mismatch) - Wire *multiWorkflowAddr flag into runMultiWorkflow (was incorrectly using *addr, leaving multiWorkflowAddr unused and triggering lint failure) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
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.
The deploy and stop workflow pipelines were ~95% identical, differing only in the hardcoded status string literal (
'active'vs'stopped') embedded directly in the SQL UPDATE query.Changes
admin/config.yaml— both pipelines (/deploy,/stop):set-target-statusstep (step.set) that declares the semantic difference at the top of each pipelineupdate-statusSQL fromstatus = 'hardcoded'tostatus = ?placeholderset-target-status.target_statusas the first param inupdate-statusThe
update-statusstep and SQL query are now structurally identical between the two routes. The sole difference is isolated toset-target-status:🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.