@@ -143,7 +143,7 @@ func TestIsCommitSHA(t *testing.T) {
143143 assert .True (t , isCommitSHA ("AABBCCDD11223344AABBCCDD11223344AABBCCDD" ))
144144 assert .False (t , isCommitSHA ("2.6.2" ))
145145 assert .False (t , isCommitSHA ("" ))
146- assert .False (t , isCommitSHA ("5dd95b4efd7e9b668c361bbddb8d7f1e56c32ac" )) // 39 chars
146+ assert .False (t , isCommitSHA ("5dd95b4efd7e9b668c361bbddb8d7f1e56c32ac" )) // 39 chars
147147 assert .False (t , isCommitSHA ("5dd95b4efd7e9b668c361bbddb8d7f1e56c32ac12" )) // 41 chars
148148}
149149
@@ -216,3 +216,31 @@ func TestIsGitHostedURL(t *testing.T) {
216216 assert .False (t , isGitHostedURL ("s3://my-bucket/charts" ))
217217 assert .False (t , isGitHostedURL ("" ))
218218}
219+
220+ // ── isRedundantOperationState ─────────────────────────────────────────────────
221+
222+ func TestIsRedundantOperationState_SucceededIsSkipped (t * testing.T ) {
223+ assert .True (t , isRedundantOperationState ("Succeeded" ),
224+ "Succeeded operationState always duplicates the latest history entry" )
225+ }
226+
227+ func TestIsRedundantOperationState_NonTerminalPhasesAreKept (t * testing.T ) {
228+ for _ , phase := range []string {"Running" , "Terminating" } {
229+ assert .False (t , isRedundantOperationState (phase ),
230+ "in-flight phase %q is not yet in history and must be kept" , phase )
231+ }
232+ }
233+
234+ func TestIsRedundantOperationState_FailurePhasesAreKept (t * testing.T ) {
235+ for _ , phase := range []string {"Failed" , "Error" } {
236+ assert .False (t , isRedundantOperationState (phase ),
237+ "failure phase %q may never reach history and must be kept" , phase )
238+ }
239+ }
240+
241+ func TestIsRedundantOperationState_HistoryEntryHasNoPhase (t * testing.T ) {
242+ // History entries have phase="" — isOperationState is false before this
243+ // function is called, but double-check the function itself is safe with
244+ // an empty string so the guard can never accidentally suppress history rows.
245+ assert .False (t , isRedundantOperationState ("" ))
246+ }
0 commit comments