Skip to content

refactor(cli): remove the legacy exit shim and enforce it in CI - #491

Open
Caesarsage wants to merge 4 commits into
microcks:masterfrom
Caesarsage:pr3/remove-legacy-shim
Open

refactor(cli): remove the legacy exit shim and enforce it in CI#491
Caesarsage wants to merge 4 commits into
microcks:masterfrom
Caesarsage:pr3/remove-legacy-shim

Conversation

@Caesarsage

Copy link
Copy Markdown
Contributor

Part of the Microcks CLI v2 work (#255). Stacked on PR #490.

  • Deletes the now-unused CheckError/CheckConfigNil/Fatal + ErrorGeneric shim from pkg/errors; converts the standalone watcher/ binary to handle errors inline.
  • Adds go test ./... to build-verify.yml (the pipeline previously only built) and a guard step that fails if os.Exit/log.Fatal/panic reappears outside cmd/exit.go.
  • Documents the rule in CONTRIBUTING.md.

Scope

Pure cleanup: nothing referenced the shim after PR #490.

The only process exits left in the tree are the two main entrypoints and cmd.Handle.

@Caesarsage

Copy link
Copy Markdown
Contributor Author

HOLD til #490 and #489 are review and merged

Comment thread pkg/connectors/microcks_client.go Outdated
Comment on lines +251 to +259
return "", errors.Wrap(errors.KindAPI, fmt.Errorf("parsing Keycloak config response: %w", err))
}

// Retrieve auth server url and realm name.
enabled := configResp["enabled"].(bool)
authServerURL := configResp["auth-server-url"].(string)
realmName := configResp["realm"].(string)
// Return 'null' if Keycloak is disabled.
if enabled, _ := configResp["enabled"].(bool); !enabled {
return "null", nil
}

// Return a proper URL or 'null' if Keycloak is disables.
if enabled {
return authServerURL + "/realms/" + realmName + "/", nil
authServerURL, _ := configResp["auth-server-url"].(string)

@Vaishnav88sk Vaishnav88sk Jul 31, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please check this as the same issue as previous PRs. This silently discards the malformed-response case again. Check all such cases to ensure code consistency.
Rebase

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The empty-string check catches most malformed cases, but explicit ok is cleaner and I will implement that. Thanks

Comment thread pkg/errors/error.go

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Needs a rebase, so the previous copyright block will be there

Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
@Caesarsage

Caesarsage commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Hello @Vaishnav88sk and @Harsh4902

I have attended to all the issues here and from the other PR (merged) here instead of raising a separate PR. And i also added a CI guard to check for missing policies, like missing copyright header, ignored-error and stray-exit

@Vaishnav88sk Vaishnav88sk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@Harsh4902 Please review the workflows/ files.

Comment on lines +42 to +45
if grep -rnE '(^|[^[:alnum:]_])_ =|, _ :=|fmt\.Println\(err\)' --include='*.go' cmd pkg; then
echo "::error::Potential silently ignored error found. Handle it explicitly or return errors.Wrap(kind, err)."
exit 1
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The silently-ignored-error grep pattern _ =|, _ :=|fmt\.Println\(err\) is a nice guard, but it's a blunt regex; it'll false-positive on any deliberate _ = x (e.g. explicitly discarding a value that's genuinely fine to ignore, if that ever comes up) with no allowlist mechanism. Not blocking, just flag it as something that may need a // nolint-style escape hatch down the line if a legitimate case shows up.

@Vaishnav88sk

Copy link
Copy Markdown

LGTM 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants