Skip to content

Commit 356b554

Browse files
authored
Merge pull request #1280 from LeanerCloud/feat/archera-cli-pitch-web-link
feat(archera): soft-pitch insurance after CLI purchase + update web signup link
2 parents b96b05e + b0086af commit 356b554

2 files changed

Lines changed: 81 additions & 0 deletions

File tree

‎cmd/multi_service_stats.go‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ func printSuccessRate(success, failed int) {
167167
}
168168
}
169169

170+
// archeraSignupURL is the Archera signup link with CUDly attribution, shared
171+
// with the web interface (frontend ARCHERA_SIGNUP_URL).
172+
const archeraSignupURL = "https://www.archera.ai/cudly"
173+
170174
// printFinalMessage prints the final message based on mode and results
171175
func printFinalMessage(isDryRun bool, riSuccess int) {
172176
if isDryRun {
@@ -175,9 +179,32 @@ func printFinalMessage(isDryRun bool, riSuccess int) {
175179
} else if riSuccess > 0 {
176180
AppLogger.Println("\n🎉 Purchase operations completed!")
177181
AppLogger.Println("⏰ Allow up to 15 minutes for RIs to appear in your account")
182+
printArcheraPitch()
178183
}
179184
}
180185

186+
// printArcheraPitch prints a soft, non-blocking suggestion to insure the
187+
// just-purchased commitments through Archera, followed by the two Archera
188+
// partnership disclosures CUDly commits to keeping visible everywhere the
189+
// integration is surfaced (see project_archera_partnership memory):
190+
// 1. Non-gating: CUDly works fully without Archera.
191+
// 2. Sponsorship: Archera funds part of CUDly's development.
192+
//
193+
// Shown only after a successful real purchase. Archera is a third-party
194+
// service independent of CUDly.
195+
func printArcheraPitch() {
196+
AppLogger.Println("\n🛡️ Want to push your coverage to 100% without the risk that a future")
197+
AppLogger.Println(" capacity decrease leaves you paying for commitments you no longer use?")
198+
AppLogger.Println(" You can buy underutilization insurance for Reserved Instances and")
199+
AppLogger.Println(" Savings Plans from Archera by signing up at:")
200+
AppLogger.Printf(" %s\n", archeraSignupURL)
201+
AppLogger.Println(" within the first 7 days of the purchase.")
202+
AppLogger.Println("\n This is entirely optional. CUDly's purchase and management features")
203+
AppLogger.Println(" work fully without Archera.")
204+
AppLogger.Println("\n For full disclosure, Archera sponsors CUDly's Open Source development")
205+
AppLogger.Println(" from a fraction of their insurance premiums.")
206+
}
207+
181208
// printSavingsPlansSection prints the Savings Plans summary section
182209
func printSavingsPlansSection(allRecommendations []common.Recommendation, spStats ServiceProcessingStats) {
183210
AppLogger.Println("\n📊 SAVINGS PLANS:")

‎cmd/multi_service_stats_test.go‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,3 +504,57 @@ func TestPrintComparisonSection(t *testing.T) {
504504
})
505505
}
506506
}
507+
508+
func TestPrintFinalMessage(t *testing.T) {
509+
tests := []struct {
510+
name string
511+
isDryRun bool
512+
riSuccess int
513+
wantOutput []string
514+
notWanted []string
515+
}{
516+
{
517+
name: "Dry run shows no Archera pitch",
518+
isDryRun: true,
519+
riSuccess: 5,
520+
notWanted: []string{"Archera", archeraSignupURL},
521+
},
522+
{
523+
name: "No successful purchases shows no pitch",
524+
isDryRun: false,
525+
riSuccess: 0,
526+
notWanted: []string{"Purchase operations completed", "Archera", archeraSignupURL},
527+
},
528+
{
529+
name: "Successful purchase shows Archera pitch with URL and disclosure",
530+
isDryRun: false,
531+
riSuccess: 3,
532+
wantOutput: []string{
533+
"Purchase operations completed",
534+
"underutilization insurance",
535+
"https://www.archera.ai/cudly",
536+
"first 7 days",
537+
// Non-gating partnership disclosure (project_archera_partnership memory).
538+
"entirely optional",
539+
"work fully without Archera",
540+
// Sponsorship partnership disclosure (project_archera_partnership memory).
541+
"sponsors CUDly's Open Source",
542+
},
543+
},
544+
}
545+
546+
for _, tt := range tests {
547+
t.Run(tt.name, func(t *testing.T) {
548+
output := captureAppOutput(t, func() {
549+
printFinalMessage(tt.isDryRun, tt.riSuccess)
550+
})
551+
552+
for _, want := range tt.wantOutput {
553+
assert.Contains(t, output, want)
554+
}
555+
for _, notWant := range tt.notWanted {
556+
assert.NotContains(t, output, notWant)
557+
}
558+
})
559+
}
560+
}

0 commit comments

Comments
 (0)