Skip to content

fix(doctor): improve UX for version resolution errors and diagnostics#514

Draft
sonupreetam wants to merge 1 commit into
complytime:mainfrom
sonupreetam:fix/doctor-version-ux
Draft

fix(doctor): improve UX for version resolution errors and diagnostics#514
sonupreetam wants to merge 1 commit into
complytime:mainfrom
sonupreetam:fix/doctor-version-ux

Conversation

@sonupreetam
Copy link
Copy Markdown
Contributor

Summary

Addresses all 5 sub-issues from #503:

  • Pinned version staleness (item 1): Doctor no longer warns "run complyctl get to update" when the user deliberately pinned a version. Reports "(pinned)" with optional latest-available info.
  • "registry unreachable" misdiagnosis (item 2): Introduces ErrVersionNotFound sentinel in internal/registry to classify 404 responses. Doctor now says "latest tag not found — pin a specific version with @" instead of "unreachable".
  • Error message nesting (item 3): Flattens the 5-layer error wrapping chain. SyncPolicy classifies errors; syncSinglePolicy passes errors through directly without re-wrapping.
  • Configured-vs-cached mismatch (item 4): Doctor detects when the configured pin (@v2.0.0) differs from cached version (v1.0.0) and suggests running complyctl get.
  • Nil panic in CheckCollector (item 5): Adds cfg == nil guard to prevent SIGSEGV when complytime.yaml is absent.

Closes #503

Test plan

Made with Cursor

Address all 5 sub-issues from complytime#503:

1. Pinned versions no longer trigger misleading staleness warnings.
   Doctor now reports "(pinned)" when cached matches pin, with optional
   note about latest availability.

2. "registry unreachable" is no longer reported when the real problem
   is a missing tag. A new ErrVersionNotFound sentinel in
   internal/registry classifies 404 responses, enabling doctor and
   sync to emit "latest tag not found — pin a specific version" or
   "version not found in registry" as appropriate.

3. Error message nesting is flattened: SyncPolicy no longer wraps with
   redundant "registry unreachable" + "(cached data may still be
   available)" boilerplate. syncSinglePolicy passes the sync error
   through directly instead of re-wrapping with the policy name and
   cached policy list.

4. Configured-vs-cached version mismatch is now detected: if a user
   pins @v2.0.0 but cache holds v1.0.0, doctor reports the mismatch
   with guidance to run complyctl get.

5. Nil panic in CheckCollector is fixed: a cfg == nil guard prevents
   the SIGSEGV when complytime.yaml is absent.

Closes complytime#503

Signed-off-by: Sonu Preetam <sonupreetam@gmail.com>
Signed-off-by: sonupreetam <spreetam@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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.

fix: improve UX for version resolution error messages and doctor diagnostics

1 participant