Skip to content

Enhance deployment and CI/CD workflows with API improvements and integrations#71

Merged
stenwire merged 2 commits into
stagingfrom
main
Jul 4, 2026
Merged

Enhance deployment and CI/CD workflows with API improvements and integrations#71
stenwire merged 2 commits into
stagingfrom
main

Conversation

@stenwire

@stenwire stenwire commented Jul 4, 2026

Copy link
Copy Markdown
Owner

No description provided.

stenwire and others added 2 commits July 4, 2026 21:14
- Migration d88681a7b3d0: drop ADK tables conditionally — they won't
  exist on a fresh DB, causing ProgrammingError on first deploy
- widget-settings: double-cast res.data through unknown to satisfy TS
  strict check when extracting numeric limit fields from BusinessProfile

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: resolve staging deploy failures in migration and frontend build
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

🤖 Hi @stenwire, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the database migration script to conditionally drop tables only if they exist, and refactors the frontend widget settings page to simplify property extraction from the business profile response. The reviewer pointed out that the TypeScript casting used in the frontend is redundant and bypasses type safety, as the response data is already typed.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +82 to 87
const d = res.data as unknown as Record<string, number | undefined>;
setLimits({
allocated_messages_per_session: (res.data as Record<string, unknown>).allocated_messages_per_session,
allocated_daily_sessions: (res.data as Record<string, unknown>).allocated_daily_sessions,
allocated_whitelisted_domains: (res.data as Record<string, unknown>).allocated_whitelisted_domains,
allocated_messages_per_session: d.allocated_messages_per_session,
allocated_daily_sessions: d.allocated_daily_sessions,
allocated_whitelisted_domains: d.allocated_whitelisted_domains,
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The res.data object is already typed as BusinessProfile (returned by getBusinessProfile), which contains the optional fields allocated_messages_per_session, allocated_daily_sessions, and allocated_whitelisted_domains. Casting it to unknown and then to Record<string, number | undefined> is redundant and bypasses TypeScript's type safety. You can access these properties directly from res.data safely.

        setLimits({
          allocated_messages_per_session: res.data.allocated_messages_per_session,
          allocated_daily_sessions: res.data.allocated_daily_sessions,
          allocated_whitelisted_domains: res.data.allocated_whitelisted_domains,
        });

@stenwire
stenwire merged commit 6322b37 into staging Jul 4, 2026
4 checks passed

@github-actions github-actions Bot 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.

📋 Review Summary

This pull request enhances deployment and CI/CD workflows. The changes include making database migrations more robust and refactoring frontend code for better readability and type safety. The changes are positive and move the codebase in the right direction.

🔍 General Feedback

  • The Alembic migration change is a solid improvement for robustness.
  • The frontend refactoring improves conciseness, and with the suggested typing improvement, it will also be more type-safe.

Comment on lines 83 to 88
setLimits({
allocated_messages_per_session: (res.data as Record<string, unknown>).allocated_messages_per_session,
allocated_daily_sessions: (res.data as Record<string, unknown>).allocated_daily_sessions,
allocated_whitelisted_domains: (res.data as Record<string, unknown>).allocated_whitelisted_domains,
allocated_messages_per_session: d.allocated_messages_per_session,
allocated_daily_sessions: d.allocated_daily_sessions,
allocated_whitelisted_domains: d.allocated_whitelisted_domains,
});
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 This refactor is good for conciseness. To further improve type safety and make the expected data shape more explicit, you could use a more specific inline type for res.data instead of a generic Record.

Suggested change
setLimits({
allocated_messages_per_session: (res.data as Record<string, unknown>).allocated_messages_per_session,
allocated_daily_sessions: (res.data as Record<string, unknown>).allocated_daily_sessions,
allocated_whitelisted_domains: (res.data as Record<string, unknown>).allocated_whitelisted_domains,
allocated_messages_per_session: d.allocated_messages_per_session,
allocated_daily_sessions: d.allocated_daily_sessions,
allocated_whitelisted_domains: d.allocated_whitelisted_domains,
});
}
const data = res.data as {
allocated_messages_per_session?: number;
allocated_daily_sessions?: number;
allocated_whitelisted_domains?: number;
};
setLimits({
allocated_messages_per_session: data.allocated_messages_per_session,
allocated_daily_sessions: data.allocated_daily_sessions,
allocated_whitelisted_domains: data.allocated_whitelisted_domains,
});

@github-actions github-actions Bot 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.

## 📋 Security Analysis Summary
    The pull request enhances deployment and CI/CD workflows. The changes are mostly related to database migrations and frontend type safety.

    ## 🔍 General Feedback

    - The change in `frontend/src/app/dashboard/widget-settings/page.tsx` improves type safety, but still relies on an unsafe type assertion. It is recommended to use a type guard or a validation library to ensure the data has the correct shape before using it.
    </SUMMARY>

const res = await getBusinessProfile();
if (res.status === 'success' && res.data) {
setBusiness(res.data);
const d = res.data as unknown as Record<string, number | undefined>;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LOW Unsafe type assertion

The code uses an unsafe type assertion as unknown as Record<string, number | undefined> on the data received from the getBusinessProfile API call. This assumes the API response will always have the expected shape and types. If the API response changes, this could lead to runtime errors or unexpected behavior.

Suggested change
const d = res.data as unknown as Record<string, number | undefined>;
// A better approach would be to use a type guard or a validation library (like Zod)
// to ensure the data has the correct shape before using it.
// For example:
const isBusinessProfile = (data: any): data is BusinessProfile => {
return (
typeof data === 'object' &&
data !== null &&
typeof data.allocated_messages_per_session === 'number' &&
typeof data.allocated_daily_sessions === 'number' &&
typeof data.allocated_whitelisted_domains === 'number'
);
};
if (isBusinessProfile(res.data)) {
setLimits({
allocated_messages_per_session: res.data.allocated_messages_per_session,
allocated_daily_sessions: res.data.allocated_daily_sessions,
allocated_whitelisted_domains: res.data.allocated_whitelisted_domains,
});
}

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