Solo Dev嘅更安全Deploy:我點樣用AI Ship(一個Feature Flag故事)
我差啲就直接ship一個major TTS engine swap然後「hope for the best」——直到我嘅AI assistants flag咗風險,幫我build咗一個bulletproof嘅feature flag策略。
佢live喇,而且冇嘢著火。對任何run緊live application嘅solo developer嚟講,呢個感覺係世界上最好嘅感覺之一。:D 呢個係deploy之後屏住呼吸然後慢慢呼出嘅quiet exhale。過去幾日,我一直喺replace DIALØGUE嘅一個critical部分——generate所有audio嘅text-to-speech engine——而我最大嘅恐懼係醒來發現app壞咗同一大堆用戶email。
呢個唔淨止係一個成功feature launch嘅故事。呢個係一個成功_避免_咗disaster嘅故事,同埋我點樣學用一隊AI assistants去build、test同deploy software,比我一個人做更安全。
新玩具 vs 穩定嘅Product
誘惑開始嘅時候,同往常一樣,係一個新玩具。幾個月前,OpenAI release咗一個新嘅、更advanced嘅TTS model(gpt-4o-mini-tts),promise更高質素、更自然嘅voices。呢個interesting,但真正吸引我目光嘅係價錢:佢比我目前用緊嘅legacy model平20%。對一個bootstrapped project嚟講,core API平20%係massive win。
問題?換掉infrastructure嘅core部分係有風險嘅。啲voices係最終product。如果新model fail、或者聽落差啲、或者有啲weird incompatibility,成個application都會degraded。作為solo dev,我點樣有信心咁roll out呢個change?
一個Naive計劃同我嘅AI-Powered Sanity Check
老實講:我第一個naive計劃係淨係swap個model name喺code入面,push去production,然後hope for the best。呢個係經典嘅「move fast and break things」approach,而且感覺deeply wrong。
所以,喺做任何嘢之前,我轉向我嘅AI team。
首先,我叫Claude Code,我嘅AI collaborator,佢excels at implementation planning,嚟create一個robust嘅deployment strategy。我俾咗佢我嘅system context同目標。Claude即刻flag咗我「hope for the best」approach嘅風險,然後帶返一個圍繞feature flag嘅更smart計劃。
呢個理論上好正,但我需要確認佢對我嘅actual codebase係practical嘅。所以,我轉向Gemini CLI,我嘅AI assistant做validation同verification。我叫Gemini分析我嘅existing architecture睇吓Claude嘅計劃係咪feasible。Gemini confirm咗一個key detail:我已經有一個PodcastStyle definitions嘅system(例如Tech News show vs Long-form Interview)。
呢個係「aha!」moment。Claude嘅計劃suggest leverage嗰個existing system。我可以將新voice「vibes」直接map到我已經build好嘅podcast styles。前路清晰喇,而且比我開始嗰個approach安全infinite倍。
Solution:我嘅AI Team幫我Build嘅兩部分策略
以下係我consult完AI assistants之後最終確定嘅兩部分策略。呢個係一個我以後每次major feature release都會用嘅playbook。
第1部分:萬能Feature Flag
Feature flag其實淨係你code入面嘅一個on/off switch。佢係一個我可以喺code之外控制嘅variable(我嘅case係server上嘅environment variable),話個application行邊個code path。
以下係simplified嘅Python code:
# A simple boolean flag controlled by a server environment variable
use_new_model_flag = True
def synthesize_speech(text, voice, instructions=None):
# Select the model based on the flag
model_to_use = "new-tts-model" if use_new_model_flag else "legacy-tts-model"
api_params = {
"model": model_to_use,
"voice": voice,
"input": text
}
# Only add the new 'instructions' parameter if we're using the new model
if use_new_model_flag and instructions:
api_params["instructions"] = instructions
# ... make the API call
呢個簡單嘅if/else statement係superpower。佢代表我可以deploy新code到production但keep佢dormant,將flag留喺False。然後我可以淨係為自己開,或者為少量用戶開,唔影響其他人。如果有任何嘢出錯,fix唔係frantic rollback;只係將switch翻返False。
第2部分:唔好重新發明輪子(Integrate!)
Claude最好嘅insight,Gemini validate過同我嘅codebase一致嘅,係將新voice instructions connect到我existing嘅podcast styles。唔係build一個全新UI俾用戶type一個「vibe」,我可以透過為每個style create一個default vibe嚟提供即時value。
大概係咁嘅:
# A dictionary mapping existing styles to the new voice instructions
STYLE_INSTRUCTIONS = {
"TECH_STYLE": "Use a sharp, business-focused, and analytical tone...",
"STORYTELLING_STYLE": "Use a conversational, relaxed, and intimate tone...",
# ... and so on for all 8 styles
}
呢個係game-changer。佢代表initial deployment需要零frontend changes。Feature由第一日起就feel integrated同intelligent。
結果:一個Boringly Successful嘅Deployment(最好嗰種)
Rollout幾乎係anticlimactic,呢個正正係你想要嘅。我deploy咗code,feature flag設為OFF。冇嘢變。然後我為自己嘅account enable咗,run咗幾個tests。新voices聽落好好。Style mapping work。Logs確認咗20%成本減少。
Monitor咗幾個鐘之後,我為所有人enable咗。結果?Product嘅core feature完全被replaced成更好、更平嘅版本,而冇人留意到。零downtime,零errors。呢個係win。
Lesson同未來:我嘅Key Takeaway
我最大嘅lesson係一個solo developer可以被一隊specialized AI assistants amplify幾多。透過用Claude Code做implementation strategy同Gemini CLI做architectural validation同verification,我可以deploy呢個feature嘅安全同信心程度,係我預期一個大好多嘅engineering team先有嘅。佢將一個stressful、risky嘅deployment變成calm、controlled嘅process。
而因為呢個backend work咁solid,Phase 2好清晰:我而家可以focus build一個simple UI expose呢個power俾用戶,等佢哋customize佢哋podcast hosts嘅「vibe」。
喺一個stable foundation上面build嘅感覺真好。:)
你點用你嘅工具?
呢次就講到呢度喇。但我知我唔係唯一一個喺度figure out呢啲嘅——你點樣喺你嘅workflow入面用AI assistants?你ship新features而唔break嘢嘅favourite techniques係咩?我好想聽吓你嘅war stories。
祝好,
Chandler





