Server heirarchy removal - #13
Conversation
- Add NewEnergyChart with smooth Catmull-Rom curves and time-aligned data positioning - Add NewTimeContextToggle for 1day/3day/1week/1month/3month/1year views - Implement time bucket aggregation with placeholder points for natural curves - Add precise time label positioning with 23-notch hourly grid system - Update data service with context-aware filtering and alignment logic - Integrate new chart components into Home screen navigation
- Extract Chat functionality into dedicated Chat screen component - Clean up Home.tsx by removing chat-related code (570→160 lines) - Add useChatInputFocus hook for input focus management - Configure Chat as formSheet modal in MainNavigator - Maintain Home as background with energy chart and time context - Remove unused imports and navigation listeners from Home
…ameters - Add ChartDisplayContext with 29 exported parameters for chart display management - Integrate time range shortcuts (1day, 3day, 1week, 1month, 3month, 1year) - Implement smart date range calculations with timezone support - Add formatted labels for ChartHeader (headerTopLabel, headerBottomLabel) - Include special handling for 'today' view with different display options - Fix month abbreviations to show 'Sept' instead of 'Sep' - Update TimeDisplayToggle to use context with backward compatibility - Modify ChartHeader to use context-provided formatted labels - Wrap Home screen with ChartDisplayContextProvider Provides centralized chart display logic with automatic dateStart/dateEnd calculation from shortcuts, scalable for custom date ranges.
…edundant code - Fix race conditions between TimeContext and ChartDisplayContext intervals - Eliminate 60+ lines of duplicate astronomical calculation logic - Create shared dateFormatters utility for consistent month formatting - Implement reactive dependency pattern using timeInfo timestamp - Consolidate formatMonthDay logic into reusable utility - Simplify TimeDisplayToggle backward compatibility logic - Add comprehensive refactoring documentation and validation report Architecture improvement: Single source of truth pattern with TimeContext managing intervals and ChartDisplayContext reacting to changes.
…docs - Complete modular architecture implementation - Remove temporary ChartHeader-analysis.md file - Consolidate chart display and time context improvements - Maintain 86% code reduction in Home.tsx - Preserve all functionality with cleaner separation of concerns
- Cut 402 to 225 lines by eliminating debug code and verbosity - Remove console logs and debug styling (pink/red/lightblue backgrounds) - Simplify category icon mapping and tool list rendering - Consolidate StyleSheet definitions and remove redundant patterns - Fix TypeScript errors with proper typing for toolsByCategory and icons - Add missing matchedTriggers property to DetectedToolSuggestion
- Cut ChatContext from 330 to 205 lines by eliminating verbose patterns - Fix ChatToolbar formatting and type annotations - Maintain all functionality while improving readability and maintainability
…hooks and contexts - Extract TideContext from ChatContext for tide-specific state management - Add useChatMessaging hook to bridge all contexts for message handling - Simplify ChatContext to focus on UI state (input, tools, toolbar) - Create tideTypes for shared type definitions across contexts - Remove agentCommandUtils in favor of centralized bridge pattern - Update ChatInput to use new hook architecture for cleaner separation - Implement message persistence and tide state management - Streamline TimeContext with reduced complexity - Add comprehensive documentation of implementation status
…_type field - Remove ADR-003 hierarchical tide system across entire codebase - Delete parent_tide_id, date_start, date_end, auto_created columns from schema - Remove flow_type field from all interfaces, storage, and tools - Eliminate tide-context.ts and tide-hierarchical-flow.ts modules - Simplify tide creation to generic Focus - Date format - Update all tests to use status instead of flow_type assertions - Clean daily/weekly/monthly tide terminology to generic 'tide' - Archive ADR-003 document to docs/archive/ - Maintain backward compatibility for existing tide data This refactor simplifies the tide model and removes unused complexity while preserving core functionality. All tests pass.
There was a problem hiding this comment.
Summary of Changes
Hello @masonomara, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces a significant architectural shift, moving away from a rigid server hierarchy and explicit hierarchical tide management towards a more streamlined, agent-based system. This involves simplifying core data models, decoupling mobile app components from direct server environment concerns, and updating tool interactions to align with the new distributed approach. The changes aim to enhance the flexibility and maintainability of the system by reducing complexity in server-side data structures and client-side context management.
Highlights
- New Agent-Server Integration Architecture: Introduces a comprehensive guide for integrating the @apps/agents and @apps/server layers to deliver AI-powered productivity insights via the MCP protocol. It outlines a phased implementation strategy covering server enhancements, agent intelligence, and mobile UI integration.
- Monorepo Documentation Update: The main CLAUDE.md documentation has been updated to reflect the simplified monorepo structure, removing explicit server/mobile hierarchy descriptions and reorganizing development commands for clarity.
- Tide Data Model Simplification: The flow_type property has been removed from the TideInfo interface and related tide fetching/analysis logic within the agent application, simplifying the tide data model.
- Mobile App Context Streamlining: The ServerEnvironmentProvider has been removed from the root App.tsx component, simplifying the mobile application's context hierarchy and reducing its direct dependency on server environment selection.
- Energy Chart Component Update: The EnergyChart.tsx component has been largely commented out, indicating a shift towards a new implementation, likely NewEnergyChart.tsx, for displaying energy data.
- Tool Configuration Refinement: Updates to tool configurations in toolPhrases.ts and toolsConfig.ts reflect a simplified approach to tide creation and flow management, removing flow_type and adjusting parameters for tide_flow.
- MCP Context Simplification: The MCPContext has been significantly simplified by removing hierarchical tide management functions and hardcoding the server URL, indicating a move away from dynamic server environment selection within the context.
- Database Schema Simplification: The tide_index table in the database schema has been simplified by removing columns related to hierarchical tide management (flow_type, parent_tide_id, date_start, date_end, auto_created) and their associated indexes.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces a significant refactoring, primarily focused on removing the server-side hierarchical tide structure. This simplification is consistently applied across the backend, from the database schema to the API handlers. The mobile application has also undergone a major overhaul, with improved context management through the new TideContext and ChartDisplayContext. While these changes streamline the architecture, the removal of the ServerEnvironmentContext and the subsequent hardcoding of server URLs reduce the application's flexibility. Additionally, there are a few areas in the mobile app's UI and navigation that could be improved for better maintainability and user experience.
| backgroundColor: colors.background.primary, | ||
| }} | ||
| /> | ||
| <KeyboardAvoidingView |
There was a problem hiding this comment.
The View that previously handled the top safe area inset has been removed. This could cause the UI to render underneath the device's status bar, especially on iOS devices with a notch. It's recommended to add a view to account for the top inset to ensure consistent layout across devices, similar to how it was implemented before this change.
| // Configure authService and mcpService with hardcoded server URL | ||
| useEffect(() => { | ||
| if (getEnvironmentServerUrl) { | ||
| authService.setUrlProvider(getEnvironmentServerUrl); | ||
| mcpService.setUrlProvider(getEnvironmentServerUrl); | ||
| loggingService.info( | ||
| "MCPContext", | ||
| "AuthService and MCPService configured with environment URL provider" | ||
| ); | ||
| } | ||
| }, [getEnvironmentServerUrl]); | ||
| const hardcodedUrl = "https://tides-006.mpazbot.workers.dev"; | ||
| const urlProvider = () => hardcodedUrl; | ||
|
|
||
| authService.setUrlProvider(urlProvider); | ||
| mcpService.setUrlProvider(urlProvider); | ||
|
|
||
| loggingService.info( | ||
| "MCPContext", | ||
| "AuthService and MCPService configured with hardcoded URL", | ||
| { url: hardcodedUrl } | ||
| ); | ||
| }, []); |
There was a problem hiding this comment.
The ServerEnvironmentContext has been removed and the server URL is now hardcoded in multiple places (here, agentService.ts, authService.ts). This removes the flexibility to switch between different server environments (e.g., dev, staging, prod). It's recommended to use environment variables (e.g., via a .env file and a library like react-native-config) to manage server URLs. This would make it easier to build the app for different environments without changing the code and improves maintainability.
| useEffect(() => navigation.navigate(Routes.main.chat, {}), [navigation]); | ||
| useFocusEffect( | ||
| useCallback(() => navigation.navigate(Routes.main.chat, {}), [navigation]) | ||
| ); | ||
| useFocusEffect(() => navigation.navigate(Routes.main.chat, {})); |
There was a problem hiding this comment.
The triple navigation to the Chat screen is an unconventional approach. While the comment in the code acknowledges it as an "intentional hack," this can lead to confusing navigation behavior, potential performance issues, and make debugging difficult. A cleaner approach would be to make the Chat screen the initial route in MainNavigator.tsx if it's the intended entry point, and provide the necessary contexts to it directly. If Home.tsx must be used for setup, consider a single navigation action within a useEffect with an empty dependency array to ensure it runs only once on mount.
No description provided.