DEV Community

Cover image for We Merged 3 Repositories Into 1. Then AI Said: Roll It All Back.
πŸŽ“ Navid Ishaq
πŸŽ“ Navid Ishaq

Posted on

We Merged 3 Repositories Into 1. Then AI Said: Roll It All Back.

We Merged 3 Repositories Into 1. Then AI Said: β€œRoll It All Back.”

Three repositories. Two Render services. One website. And a debugging lesson worth sharing.

We set out to simplify the architecture behind DeTLeng Case Studies, a production website featuring an AI analytics assistant and 100 verified BigQuery analytics tools.

The goal was not to rebuild a working website. It was to remove a fragile dependency without losing the work already done.

The Architecture: Before and After

BEFORE                               AFTER
────────────────────────────         ────────────────────────────
 GitHub Pages Website                 GitHub Pages Website
          β”‚                                     β”‚
          β–Ό                                     β–Ό
 FastAPI Chatbot (Render)             Unified FastAPI (Render)
          β”‚                                     β”‚
          β–Ό                                     β–Ό
 Remote MCP Service (Render)          100 Allow-Listed Python Tools
          β”‚                                     β”‚
          β–Ό                                     β–Ό
     Google BigQuery                        Google BigQuery

 2 backend services                    1 backend service
 Remote MCP session                    Direct Python calls
 Cold-start dependency                 No second service to wake
Enter fullscreen mode Exit fullscreen mode
Engineering concern Before After
Runtime services Two Render backends One unified backend
Analytics execution Remote MCP session Direct, registered Python calls
Cold-start behavior Second service could stall Single-service recovery and bounded retries
Data access Verified BigQuery tools Same allow-listed, read-only tools
Website Existing GitHub Pages site Existing design and URLs preserved

The integration brought together the static website, the FastAPI chatbot, and the verified analytics tools. Local tests passed, the consolidated repository was pushed, and then GitHub displayed a red ❌.

The Advice That Almost Undid the Migration

The AI assistant's suggestion was simple: roll everything back.

After all that integration work?

I couldn't resist asking: β€œPeople at the office ask who hired me. Now I have to askβ€”who made you an AI?” πŸ˜„

But the joke exposed an important engineering distinction:

A failed check is a request for evidence, not an automatic instruction to reverse an architecture.

Rollback can be the correct response to a live incident. Here, however, the failure was in CI, and we had not yet established that production was broken.

The Root Cause Was One Boolean Condition

The warmup cache started with an empty timestamp:

_warm_ok = 0
Enter fullscreen mode Exit fullscreen mode

The original condition was:

if time.monotonic() - _warm_ok < WARM_TTL:
Enter fullscreen mode Exit fullscreen mode

On a freshly started GitHub Actions runner, monotonic uptime could still be below the cache TTL. The application therefore treated zero as if a successful warmup had occurred.

Two CI tests failed. The targeted correction was:

if _warm_ok and time.monotonic() - _warm_ok < WARM_TTL:
Enter fullscreen mode Exit fullscreen mode

One guard condition. Not a three-repository rollback.

The fix passed local tests, and the next GitHub Actions run went green. We then deployed the unified Render backend, configured Google Cloud access, updated the website's API URL, and obtained live analytics responses for executive, sales, customer, delivery, and payment summaries.

That was functional validationβ€”not a claim that every cold-start scenario or all 100 tasks had already been exhaustively tested.

What AI-Assisted Engineering Should Learn

Before recommending a destructive reversal, an assistant should help establish:

  1. Scope: Is this a CI failure, deployment failure, or live customer incident?
  2. Evidence: Which exact test, log, or request failed?
  3. Reproduction: Can we explain the failure deterministically?
  4. Smallest safe fix: Can we correct the defect while preserving working code?
  5. Rollback threshold: Is there actual production risk that justifies reversal?

AI can accelerate implementation. But its real value is measured by judgment under uncertainty, not by how quickly it proposes the most dramatic command.

Don't let an AI turn a debugging problem into a demolition project.

Explore the Project

Have you ever been advised to roll back something that only needed a small fix? Share the diagnosisβ€”not just the disaster.


About the Author

Muhammad Naveed Ishaque is a multidisciplinary thinker, educator, and founder of the DeTLeng Ecosystem, exploring AI, data, technology, business, and human-centered innovation through continuous learning and practical research.

🌐 Explore DeTLeng: www.detleng.com

Top comments (1)

Collapse
 
navidishaq profile image
πŸŽ“ Navid Ishaq •

A red ❌ in CI doesn't always mean your architecture is broken. Sometimes the fix is just one line of code.

Before accepting an AI-suggested rollback, ask: Did we diagnose the failure, or are we simply undoing the effort?

Fellow developers, have you ever challenged an AI's advice and saved your project? I'd love to hear your story. πŸ‘‡