Skip to content

PROD-89: Early auth/GUID failure detection#119

Open
AaronAgility wants to merge 4 commits intolatest-betafrom
PROD-89/early-auth-failure-detection
Open

PROD-89: Early auth/GUID failure detection#119
AaronAgility wants to merge 4 commits intolatest-betafrom
PROD-89/early-auth-failure-detection

Conversation

@AaronAgility
Copy link
Collaborator

@AaronAgility AaronAgility commented Mar 10, 2026

Summary

  • When all GUIDs fail API key retrieval (e.g. HTTP 500 on GetPreviewKey), the CLI now exits immediately with a clear error message instead of continuing
  • The locale detection catch block now distinguishes between auth problems (keys also failed → hard error) and transient issues (keys succeeded → graceful handling)
  • Removed the silent en-us fallback that masked auth failures and caused confusing downstream errors like "Unable to retrieve sitemap"

Before

Warning: Could not get keys for GUID XXX: HTTP 500: Internal Server Error
Warning: Could not get keys for GUID XXX: HTTP 500: Internal Server Error
Note: Could not auto-detect locales: Unable to retrieve locales.
📝 Using fallback mapping: all GUIDs → en-us
Error: Unable to retrieve sitemap.  ← confusing, real problem is auth

After

Error: Failed to retrieve API keys for one or more specified GUIDs.
This usually means either:
  1. Your authentication has expired — run 'agility login' to re-authenticate
  2. The GUID(s) are incorrect — verify your --sourceGuid / --targetGuid values
  3. Your account does not have access to these instances

Test plan

  • Run a clone/sync command with made-up GUIDs → should get the early auth error
  • Run with valid GUIDs and valid auth → should work as before
  • Run with valid GUIDs but expired auth → should get the early auth error
  • Run with --locale en-us when locale auto-detect fails (but keys succeed) → should use specified locale

AaronAgility and others added 4 commits March 10, 2026 14:38
…back

When all GUIDs fail API key retrieval (HTTP 500), bail immediately with
a clear error pointing to auth expiry or bad GUIDs. In the locale
detection catch block, distinguish between auth problems (keys also
failed) and transient issues, and stop silently falling back to en-us.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
console.log(ansiColors.red(` 1. Your authentication has expired — run 'agility login' to re-authenticate`));
console.log(ansiColors.red(` 2. The GUID(s) are incorrect — verify your --sourceGuid / --targetGuid values`));
console.log(ansiColors.red(` 3. Your account does not have access to these instances\n`));
return false;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

kick out early, previously was cascading failures into SDK calls.

// No explicit locales and auto-detect failed — can't safely assume en-us
console.log(ansiColors.red(`Error: Could not detect available locales and no --locale flag was provided.`));
console.log(ansiColors.red(`Please specify locales explicitly with --locale (e.g., --locale en-us)\n`));
return false;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Previously we had a fallback into en-us, but if those locales don't exist, the sync cascades into failures.

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.

1 participant