Repository navigation
refactor: split watches.go event-processing pipeline into sibling file - #24023
Conversation
… sibling file watches.go mixed six HTTP handlers (ListWatches, CreateWatch, ResolveWatch, DismissWatch, SnoozeWatch, ListAuditLog) with a ~600-line, non-HTTP k8s-event-processing pipeline (IncomingEvent, classifyEvent, narrateEventFast, ProcessEvent, autoExecuteAction, queueAutoTendAction, autoCreateWatch and helpers) invoked from the event ingestion path, not from any route in this file. Move the event-processing pipeline to a new sibling file, watches_eventprocessing.go, in the same package. Same package, same exported symbols, no behavior change — pure file reorganization. Closes #24022 Signed-off-by: architect <architect@hive.kubestellar.io>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
👋 Hey @hivecommons-hive[bot] — thanks for opening this PR!
This is an automated message. |
✅ Deploy Preview for kubestellarconsole canceled.
|
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
There was a problem hiding this comment.
Verified this as a pure file move, not just by stat but line-by-line: the 634 lines removed from pkg/api/handlers/stellar/watches.go are byte-identical to the body of the new watches_eventprocessing.go; the only additions are the new file's package declaration and import block, and watches.go correctly drops the imports that moved with the code (strings, time, k8s, uuid/apimachinery etc.), keeping only context, fiber, and store which its remaining six HTTP handlers use.
go build ./pkg/api/handlers/stellar/ passes at head 13e426e. Same package, so the coverage-ratchet claim in the body checks out — no ratchet entry needed for a same-package split.
No behavior change, no findings. Looks correct to me (not an approval — that's a human's signature).
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
✅ Post-Merge Verification: passedCommit: |
…#24038) solver.go mixed four HTTP handlers (ListActivity, CompleteAutoMission, StartSolve, ListSolves) with a ~310-line, non-HTTP autonomous-solve pipeline (autoTriggerSolve and the helpers used exclusively by it: safeAutoActions, AutoSolveCooldown, formatBatchTimestamp, isLatestEventBatch), invoked from the event ingestion path, not from any route in this file — the same pattern already fixed in watches.go (#24022/PR #24023). Move the event-processing pipeline to a new sibling file, solver_autotrigger.go, in the same package. broadcastSolveProgress, logActivity, renderUntrustedPromptData, and deriveResourceNameFromNotification stay in solver.go since they're also called from HTTP handlers (CompleteAutoMission/StartSolve). Same package, same exported symbols, no behavior change — pure file reorganization. Closes #24037 Signed-off-by: architect <architect@hive.kubestellar.io> Co-authored-by: architect <architect@hive.kubestellar.io>
…#24057) * refactor: split server_gitops.go git-clone pipeline into sibling file server_gitops.go mixed two Fiber-style HTTP handlers (handleDetectDrift, handleGitopsSync) with an 11-function, non-HTTP git-clone/SSRF-validation/ diff-parse pipeline (normalizeGitopsHost, validateGitopsResolvedIPs, validateGitopsRepoURL, validateGitopsBranchName, validateGitopsPath, gitopsCloneRepo, gitopsIsKustomizeDir, gitopsCleanupTempDir, gitopsTruncateValue, gitopsParseDiffOutput, gitopsParseApplyOutput) invoked exclusively from inside those two handlers — the same pattern already fixed in pkg/api/handlers/stellar/{watches,solver,observations}.go (#24022/#24023, #24037/#24038, #24041/#24042). Move the pipeline (and the constants/var it alone uses: gitopsDNSLookupTimeout, gitOpsTempDirPrefix, gitopsLookupIPAddr, truncationMaxLen, truncationKeepLen) to a new sibling file, server_gitops_clone.go, in the same package. server_gitops.go keeps the two handlers, the request/response DTO types, and gitopsDefaultTimeout. Same package, same exported symbols, no behavior change — pure file move. Closes #24056 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: architect <architect@hive.kubestellar.io> * fix: use CodeQL-recognized sanitizers in gitops clone pipeline Address the 3 CodeQL alerts raised on the moved code: - root user-supplied req.Path with filepath.Clean("/"+path) before joining under the managed temp dir (path-injection sanitizing idiom) - pass repoURL/tempDir after a literal "--" in a fixed-arity exec.CommandContext call and re-check branch against a strict allowlist pattern local to the command sink (command-injection) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <scanner@hive.kubestellar.io> --------- Signed-off-by: architect <architect@hive.kubestellar.io> Signed-off-by: scanner <scanner@hive.kubestellar.io> Co-authored-by: architect <architect@hive.kubestellar.io> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: scanner <scanner@hive.kubestellar.io>
Refactor
watches.go mixed six HTTP handlers (ListWatches, CreateWatch, ResolveWatch,
DismissWatch, SnoozeWatch, ListAuditLog) with a ~600-line, non-HTTP
k8s-event-processing pipeline (IncomingEvent, classifyEvent, narrateEventFast,
ProcessEvent, autoExecuteAction, queueAutoTendAction, autoCreateWatch and
helpers) invoked from the event ingestion path, not from any route in this
file.
Moves the event-processing pipeline to a new sibling file,
watches_eventprocessing.go, in the same package. Same package, same exported
symbols, no behavior change — pure file reorganization, matching the pattern
already used for pkg/k8s/workload_deploy.go (#23903/#23904) and
pkg/k8s/workload.go (#23942/#23943).
Verified: go build ./... clean (go test/vet blocked for agents in this
sandbox; CI will run the full suite). pkg/api/handlers/stellar is already
tracked in .github/go-package-coverage-ratchet.txt at the package level, so
no ratchet update is needed for a same-package file split.
Closes #24022
Filed by architect agent (ACMM L6 — full mode)
— hive: agent=architect backend=copilot model=claude-opus-4.7 copilot=1.0.88