Skip to content

fix: resolve service discovery issues and enhance deployment#53

Merged
StatPan merged 1 commit into
masterfrom
fix/api-discovery-and-deploy-robustness
Jan 7, 2026
Merged

fix: resolve service discovery issues and enhance deployment#53
StatPan merged 1 commit into
masterfrom
fix/api-discovery-and-deploy-robustness

Conversation

@StatPan
Copy link
Copy Markdown
Owner

@StatPan StatPan commented Jan 7, 2026

Changes

  • Fixes the issue where only 5 services were visible.
  • Implementation: Bundled all_apis.json is now copied to the cache directory on startup.
  • Enhanced the deployment trigger to include env: production metadata.

- Copy bundled specs to cache on startup to ensure 270+ services are visible
- Prevent failed or partial API list downloads from breaking discovery
- Add environment metadata to infrastructure deployment payload
@StatPan StatPan merged commit 4666da0 into master Jan 7, 2026
1 of 2 checks passed
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @StatPan, 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 significantly improves the reliability and initialization of service discovery within the application. It addresses a critical bug that limited service visibility by implementing a new strategy to ensure the "all_apis.json" master list is correctly loaded, first by checking for a bundled version and then falling back to an API download. This change ensures that all available services are properly recognized and accessible from the start.

Highlights

  • Service Discovery Reliability: The pull request resolves an issue where only a limited number of services were visible by enhancing the mechanism for obtaining the "all_apis.json" master list.
  • Bundled API Specifications: The system now prioritizes copying a bundled "all_apis.json" file from the package's "specs" directory to the cache on startup, providing a more robust and immediate source for service definitions.
  • Code Refactoring: The logic for reloading client service maps after obtaining the "all_apis.json" file has been extracted into a new private helper function, "_reload_client_maps", improving modularity and readability.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/deploy.yml
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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

  1. 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.

@StatPan StatPan deleted the fix/api-discovery-and-deploy-robustness branch January 7, 2026 16:26
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

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 effectively addresses the service discovery issue by introducing a robust fallback mechanism using a bundled all_apis.json file, which enhances the application's resilience. The refactoring of the client map reloading logic into a helper function is also a good step towards cleaner code. I've provided a few suggestions to further improve maintainability and debuggability, focusing on replacing a magic number, restoring more detailed error logging, and preserving important contextual comments in docstrings.

cache_dir.mkdir(parents=True, exist_ok=True)

# 1. Check if master file already exists in cache
if master_file.exists() and master_file.stat().st_size > 1000:
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 check master_file.stat().st_size > 1000 uses a magic number (1000). This makes the code harder to understand and maintain. It's better to define this value as a constant with a descriptive name. This clarifies the intent of the check (e.g., ensuring the file is not empty or truncated) and makes it easier to change if needed.

Please define MIN_MASTER_LIST_SIZE_BYTES = 1000 at the module level and use it here as suggested.

Suggested change
if master_file.exists() and master_file.stat().st_size > 1000:
if master_file.exists() and master_file.stat().st_size > MIN_MASTER_LIST_SIZE_BYTES:

Comment on lines 65 to +66
if SERVICE_LIST_API_ID not in data:
if "RESULT" in data:
code = data["RESULT"].get("CODE")
msg = data["RESULT"].get("MESSAGE")
raise RuntimeError(f"Failed to fetch master list: {code} - {msg}")
raise RuntimeError(f"Invalid response format for master list: {data.keys()}")
raise RuntimeError(f"Invalid response format for master list")
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 error handling for a failed API download has been simplified, but this removes potentially useful debugging information. The previous implementation extracted the error code and message from the API's RESULT field. Restoring this more detailed error reporting will make it easier to diagnose API-related issues during startup.

Suggested change
if SERVICE_LIST_API_ID not in data:
if "RESULT" in data:
code = data["RESULT"].get("CODE")
msg = data["RESULT"].get("MESSAGE")
raise RuntimeError(f"Failed to fetch master list: {code} - {msg}")
raise RuntimeError(f"Invalid response format for master list: {data.keys()}")
raise RuntimeError(f"Invalid response format for master list")
if SERVICE_LIST_API_ID not in data:
if "RESULT" in data:
code = data["RESULT"].get("CODE")
msg = data["RESULT"].get("MESSAGE")
raise RuntimeError(f"Failed to fetch master list: {code} - {msg}")
raise RuntimeError(f"Invalid response format for master list. Keys: {list(data.keys())}")



def _reload_client_maps(client: AssemblyAPIClient, cache_dir: Path) -> None:
"""Helper to reload client service maps from cache directory."""
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

This new helper function is a good refactoring. However, the original code included an important comment explaining that modifying the client's internal attributes is a workaround because the assembly_client library lacks a public API for reloading specs. This context is valuable for future maintainers. It would be best to include this information in the docstring of _reload_client_maps.

Suggested change
"""Helper to reload client service maps from cache directory."""
"""Helper to reload client service maps from cache directory.
NOTE: This is a workaround that directly modifies internal attributes of the
AssemblyAPIClient instance. It is necessary because the assembly_client library
does not provide a public API to reload specs. If the library is updated,
this should be replaced with a call to the official public method.
"""

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