Skip to content

Commit 6d11164

Browse files
HirotoShioiksaric
authored andcommitted
Run debugger 1.1 (#21)
* Update email content * Update to v1.1 * Adjustments before the run * Fix assignee being unassigned
1 parent 2d6527d commit 6d11164

File tree

6 files changed

+27
-21
lines changed

6 files changed

+27
-21
lines changed

log-classifier.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: log-classifier
2-
version: 1.0.0.0
2+
version: 1.1.0.0
33
synopsis: Log classifier for a Cardano node
44
description: Please see the README
55
homepage: https://github.com/input-output-hk/log-classifier#readme

src/DataSource/Http.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,11 @@ postTicketComment ZendeskResponse{..} = do
155155
let req2 = addJsonBody
156156
(Ticket
157157
(Comment (CommentId 0)
158-
(CommentBody $ "**Log classifier**\n\n" <> zrComment)
158+
(CommentBody zrComment)
159159
[]
160160
zrIsPublic
161161
(cfgAgentId cfg))
162-
Nothing -- If Nothing, assigned_id field will be left untouched
163-
(renderTicketStatus AnalyzedByScriptV1_0:zrTags)
162+
(renderTicketStatus AnalyzedByScriptV1_1:zrTags)
164163
)
165164
req1
166165
void $ liftIO $ apiCall (pure . encodeToLazyText) req2

src/DataSource/Types.hs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,6 @@ newtype CommentOuter = CommentOuter {
251251
data Ticket = Ticket
252252
{ tComment :: !Comment
253253
-- ^ Ticket comment
254-
, tAssignee :: Maybe Integer -- Don't change the assignee
255-
-- ^ Assignee of the ticket
256254
, tTag :: ![Text]
257255
-- ^ Tags attached to ticket
258256
}
@@ -290,6 +288,7 @@ data TicketInfo = TicketInfo
290288
data TicketTag
291289
= AnalyzedByScript -- ^ Ticket has been analyzed
292290
| AnalyzedByScriptV1_0 -- ^ Ticket has been analyzed by the version 1.0
291+
| AnalyzedByScriptV1_1 -- ^ Ticket has been analyzed by the version 1.1
293292
| NoKnownIssue -- ^ Ticket had no known issue
294293
| NoLogAttached -- ^ Log file not attached
295294

@@ -530,10 +529,9 @@ instance ToJSON CommentOuter where
530529
]
531530

532531
instance ToJSON Ticket where
533-
toJSON (Ticket comment assignee tags) =
532+
toJSON (Ticket comment tags) =
534533
object [ "ticket" .= object
535534
[ "comment" .= comment
536-
, "assignee_id" .= assignee
537535
, "tags" .= tags
538536
]
539537
]
@@ -571,5 +569,6 @@ parseComments = withObject "comments" $ \o -> o .: "comments"
571569
renderTicketStatus :: TicketTag -> Text
572570
renderTicketStatus AnalyzedByScript = "analyzed-by-script"
573571
renderTicketStatus AnalyzedByScriptV1_0 = "analyzed-by-script-v1.0"
572+
renderTicketStatus AnalyzedByScriptV1_1 = "analyzed-by-script-v1.1"
574573
renderTicketStatus NoKnownIssue = "no-known-issues"
575574
renderTicketStatus NoLogAttached = "no-log-files"

src/Lib.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ processTicket tId = do
100100
getTicketInfo <- asksZendeskLayer zlGetTicketInfo
101101
printText <- asksIOLayer iolPrintText
102102

103-
printText "Processing a ticket"
103+
printText $ "Processing a ticket: " <> show (getTicketId tId)
104104

105105
mTicketInfo <- getTicketInfo tId
106106
getTicketComments <- asksZendeskLayer zlGetTicketComments
@@ -112,7 +112,7 @@ processTicket tId = do
112112
whenJust zendeskResponse postTicketComment
113113

114114
printText "Process finished, please see the following url"
115-
printText $ "https://iohk.zendesk.com/agent/tickets/" <> show tId
115+
printText $ "https://iohk.zendesk.com/agent/tickets/" <> show (getTicketId tId)
116116

117117
pure zendeskResponse
118118

@@ -308,8 +308,11 @@ filterAnalyzedTickets ticketsInfo =
308308
&& isTicketBlacklisted ticketInfo
309309
&& isTicketInGoguenTestnet ticketInfo
310310

311+
analyzedTags :: [Text]
312+
analyzedTags = map renderTicketStatus [AnalyzedByScriptV1_0, AnalyzedByScriptV1_1]
313+
311314
isTicketAnalyzed :: TicketInfo -> Bool
312-
isTicketAnalyzed TicketInfo{..} = (renderTicketStatus AnalyzedByScriptV1_0) `notElem` (getTicketTags tiTags)
315+
isTicketAnalyzed TicketInfo{..} = all (\analyzedTag -> analyzedTag `notElem` (getTicketTags tiTags)) analyzedTags
313316
-- ^ This is showing that something is wrong...
314317

315318
unsolvedTicketStatus :: [TicketStatus]
@@ -320,7 +323,7 @@ filterAnalyzedTickets ticketsInfo =
320323

321324
-- | If we have a ticket we are having issues with...
322325
isTicketBlacklisted :: TicketInfo -> Bool
323-
isTicketBlacklisted TicketInfo{..} = tiId `notElem` [TicketId 9377,TicketId 10815]
326+
isTicketBlacklisted TicketInfo{..} = tiId `notElem` [TicketId 9377,TicketId 10815, TicketId 15066]
324327

325328
isTicketInGoguenTestnet :: TicketInfo -> Bool
326329
isTicketInGoguenTestnet TicketInfo{..} = "goguen_testnets" `notElem` getTicketTags tiTags

src/LogAnalysis/Classifier.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ prettyHeader =
6868
prettyFooter :: TicketInfo -> Text
6969
prettyFooter ticketInfo =
7070
"\n\n" <>
71-
"Please be patient since we have a large number of such requests to respond to. We will respond as soon as we can, but in the meantime, if you want to check the status of your ticket you can do so here - " <> (showURL $ TicketAgentURL $ tiId ticketInfo) <>
71+
"We will respond as soon as we can, but in the meantime, if you want to check the status of your ticket you can do so here - " <> (showURL $ TicketAgentURL $ tiId ticketInfo) <>
7272
"\n\n" <>
73-
"Please let us know if your issue is resolved. If you are still having trouble please reply back to this email and attach a new log file so that we can work with you to fix your problem." <>
73+
"Please let us know if your issue is resolved." <>
7474
"\n\n" <>
7575
"Thanks, " <>
7676
"\n" <>
@@ -92,7 +92,7 @@ prettyFormatAnalysis as ticketInfo =
9292
prettyFormatNoIssues :: TicketInfo -> Text
9393
prettyFormatNoIssues ticketInfo =
9494
prettyHeader <>
95-
"We have analyzed the log that you submitted and it appears that you do not have an identifiable technical issue. Please be patient while our developers analyze this issue further since we have a large number of such requests to respond to." <>
95+
"We have analyzed the log that you submitted and it appears that you do not have an identifiable technical issue." <>
9696
prettyFooter ticketInfo
9797

9898
prettyFormatLogReadError :: TicketInfo -> Text
@@ -106,7 +106,7 @@ prettyFormatNoLogs =
106106
"Dear user," <> "\n\n" <>
107107
"Thank you for contacting the IOHK Technical Support Desk. We apologize for the delay in responding to you." <> "\n\n" <>
108108
"Most of the tickets we get are related to technical issues. If you have a Technical problem with Daedalus wallet please read on. If your request is NOT related to getting technical support you can IGNORE this email." <> "\n\n" <>
109-
"We have recently (May 29th) had a major update to the Daedalus software. You can see more details here https://daedaluswallet.io/release-notes/. If you are experiencing any technical difficulties please make sure you have upgraded to the latest version before submitting a request for support or submitting new logs (more on logs below)." <> "\n\n" <>
109+
"On May 29th had a major update to the Daedalus software and on June 19 we had another minor update . These updates have resolved a significant number of issues for other customers. You can see more details here https://daedaluswallet.io/release-notes/. If you are experiencing any technical difficulties please make sure you have upgraded to the latest version before submitting a request for support or submitting new logs (more on logs below)." <> "\n\n" <>
110110
"We scan our tickets to check for known issues before responding in person. If you have a technical issue but did not submit a log file we suggest that you reply to this message and attach your log file. Log files are required for helping with the majority of technical issues." <> "\n\n" <>
111111

112112
"Please provide more information so that we can diagnose your issue:" <> "\n\n" <>
@@ -116,7 +116,7 @@ prettyFormatNoLogs =
116116
"3. Describe the issue you are experiencing in detail and attach screenshots if needed. Please tell us what you were doing when the error occurred." <> "\n" <>
117117
"4. When did this issue occur (Date)?" <> "\n" <>
118118
"5. Do you have any ideas how this happened?" <> "\n" <>
119-
"Please compress and attach your pub folder, it contains technical logs. There is NO sensitive data in your logs:" <> "\n\n" <>
119+
"Please compress and attach your pub folder, it contains technical logs. There is NO sensitive data in your pub folder:" <> "\n\n" <>
120120

121121
"Windows" <> "\n\n" <>
122122

test/Spec.hs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Universum
44

55
import Test.Hspec (Spec, describe, hspec, it, pending, shouldBe)
66
import Test.Hspec.QuickCheck (modifyMaxSuccess)
7-
import Test.QuickCheck (Gen, arbitrary, forAll, listOf, listOf1, property, elements)
7+
import Test.QuickCheck (Gen, arbitrary, elements, forAll, listOf, listOf1, property)
88
import Test.QuickCheck.Monadic (assert, monadicIO, pre, run)
99

1010
import DataSource (App, Comment (..), Config (..), IOLayer (..), TicketId (..),
@@ -76,7 +76,7 @@ listAndSortTicketsSpec =
7676
forAll (listOf1 arbitrary) $ \(agents :: [User]) ->
7777

7878
monadicIO $ do
79-
79+
8080
pre $ any (\TicketInfo{..} -> tiStatus /= TicketStatus "solved") listTickets
8181

8282
let stubbedZendeskLayer :: ZendeskLayer App
@@ -275,18 +275,23 @@ filterAnalyzedTicketsSpec =
275275
\(ticketInfos :: [TicketInfo]) ->
276276
length (filterAnalyzedTickets ticketInfos) `shouldBe` 0
277277

278-
it "should filter analyzed tickets" $
278+
it "should filter analyzed tickets v1.0" $
279279
forAll (listOf $ genTicketWithFilteredTags ["analyzed-by-script-v1.0"]) $
280280
\(ticketInfos :: [TicketInfo]) ->
281281
length (filterAnalyzedTickets ticketInfos) `shouldBe` 0
282282

283+
it "should filter analyzed tickets v1.1" $
284+
forAll (listOf $ genTicketWithFilteredTags ["analyzed-by-script-v1.1"]) $
285+
\(ticketInfos :: [TicketInfo]) ->
286+
length (filterAnalyzedTickets ticketInfos) `shouldBe` 0
287+
283288
genTicketWithFilteredTags :: [Text] -> Gen TicketInfo
284289
genTicketWithFilteredTags tagToBeFiltered = TicketInfo
285290
<$> arbitrary
286291
<*> arbitrary
287292
<*> arbitrary
288293
<*> arbitrary
289-
<*> return (TicketTags tagToBeFiltered)
294+
<*> return (TicketTags tagToBeFiltered) -- (hs) Want to create random list
290295
<*> arbitrary
291296

292297
genTicketWithUnsolvedStatus :: Gen TicketInfo

0 commit comments

Comments
 (0)