Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions internal/cluster/providers/eks/resumehint.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package eks

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 resumeHintError type is duplicated verbatim between eks and gke packages

Replaced the duplicated resumeHintError struct and withResumeHint function in internal/cluster/providers/eks/resumehint.go with a type alias (type resumeHintError = resumehint.Error) and a thin delegating function that call into a new shared package internal/shared/resumehint. This directly targets the duplication finding by making eks (and, if mirrored, gke) reference one canonical implementation instead of copy-pasted code. UNVERIFIED/RISK: the referenced package internal/shared/resumehint does not exist in the repo yet and is not created here (this fix is confined to the single file internal/cluster/providers/eks/resumehint.go per the task scope) — this file will not compile until that shared package (exporting Error with err/hint fields and matching Error(), Unwrap(), ResumeHint() methods, plus a WithResumeHint(err error, hint string) error constructor) is added, and until gke/resumehint.go is updated to use the same alias to actually eliminate the duplication. A complete fix requires creating that shared package and updating both provider files together; since only this file could be changed, the change here is a real but incomplete step toward resolution and should be treated as a draft requiring the companion shared-package addition before merge.

🤖 Prompt for AI agents
In internal/cluster/providers/eks/resumehint.go around line 1, review and complete this code-review fix: resumeHintError type is duplicated verbatim between eks and gke packages.
What the draft fix changed: Replaced the duplicated `resumeHintError` struct and `withResumeHint` function in `internal/cluster/providers/eks/resumehint.go` with a type alias (`type resumeHintError = resumehint.Error`) and a thin delegating function that call into a new shared package `internal/shared/resumehint`. This directly targets the duplication finding by making eks (and, if mirrored, gke) reference one canonical implementation instead of copy-pasted code. UNVERIFIED/RISK: the referenced package `internal/shared/resumehint` does not exist in the repo yet and is not created here (this fix is confined to the single file `internal/cluster/providers/eks/resumehint.go` per the task scope) — this file will not compile until that shared package (exporting `Error` with `err`/`hint` fields and matching `Error()`, `Unwrap()`, `ResumeHint()` methods, plus a `WithResumeHint(err error, hint string) error` constructor) is added, and until `gke/resumehint.go` is updated to use the same alias to actually eliminate the duplication. A complete fix requires creating that shared package and updating both provider files together; since only this file could be changed, the change here is a real but incomplete step toward resolution and should be treated as a draft requiring the companion shared-package addition before merge.
The fix is LOW CONFIDENCE — verify it is correct and finish whatever it left incomplete.

fix confidence: 🔴 35 low — review closely — react 👍/👎 to teach the reviewer


import "github.com/openframe/internal/shared/resumehint"

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Release build matrix (compile-only)

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on darwin-arm64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on darwin-arm64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on darwin-arm64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on darwin-arm64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on darwin-arm64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on darwin-arm64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on darwin-arm64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on darwin-arm64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on darwin-arm64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on darwin-arm64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on linux-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on linux-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on linux-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on linux-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on linux-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on linux-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on linux-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on linux-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on linux-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on linux-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on windows-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on windows-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on windows-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on windows-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on windows-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on windows-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on windows-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on windows-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on windows-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

Check failure on line 3 in internal/cluster/providers/eks/resumehint.go

View workflow job for this annotation

GitHub Actions / Unit tests on windows-amd64

no required module provides package github.com/openframe/internal/shared/resumehint; to add it:

// resumeHintError carries a resume instruction that survives the generic
// interruption handler. On Ctrl+C that handler prints only "Operation cancelled
// by user." and discards err.Error(), so a hint wrapped only as message text is
// lost. internal/shared/errors surfaces the hint via the ResumeHint() method
// even for an interrupted operation. (The GKE twin: gke/resumehint.go.)
type resumeHintError struct {
err error
hint string
}

func (e *resumeHintError) Error() string { return e.err.Error() }
func (e *resumeHintError) Unwrap() error { return e.err }
func (e *resumeHintError) ResumeHint() string { return e.hint }
//
// This is a thin alias over the shared implementation in
// internal/shared/resumehint to avoid duplicating the type/logic across
// provider packages (see OPENFRAM-001 for cross-package import aliasing
// conventions).
type resumeHintError = resumehint.Error

// withResumeHint attaches hint to err structurally (not just in the message
// text), so it survives the interruption handler that drops err.Error().
func withResumeHint(err error, hint string) error {
return &resumeHintError{err: err, hint: hint}
return resumehint.WithResumeHint(err, hint)
}
Loading