diff options
| author | Ben Sima <ben@bensima.com> | 2025-12-23 07:48:32 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-12-23 07:48:32 -0500 |
| commit | 644781efd6ed705eeb6f1048ed9b07769aa85d63 (patch) | |
| tree | 41c039c533f5c919fba20feeecd76a5a310419f2 /Omni | |
| parent | 79f2a8bfbf0d8b7e96374b91b991db7df59e5088 (diff) | |
Omni/Ci: improve error message extraction in git notes
- Add extractErrorMessage function to filter meaningful errors
- Extract only lines containing fail/error keywords
- Filter out progress output and warnings
- Limit to first 5 error lines for concise reporting
- Fixes issue with unhelpful progress output in CI notes
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'Omni')
| -rwxr-xr-x | Omni/Ci.hs | 31 |
1 files changed, 29 insertions, 2 deletions
@@ -134,7 +134,7 @@ move args = do (exitCodeLint, _, lintStderr) <- Process.readProcessWithExitCode runlint [] "" pure <| case exitCodeLint of Exit.ExitSuccess -> ("good", "") - _ -> ("fail", Text.pack lintStderr) + _ -> ("fail", extractErrorMessage (Text.pack lintStderr)) -- 6. Run Tests -- if bild "${BILD_ARGS:-""}" --test "${CODEROOT:?}"/**/* @@ -149,7 +149,7 @@ move args = do (exitCodeTest, _, testStderr) <- Process.readProcessWithExitCode "bild" ("--test" : allFiles) "" pure <| case exitCodeTest of Exit.ExitSuccess -> ("good", "") - _ -> ("fail", Text.pack testStderr) + _ -> ("fail", extractErrorMessage (Text.pack testStderr)) -- 7. Create Note let noteMsg = case (fst lintResult, fst testResult) of @@ -203,3 +203,30 @@ getCoderoot = do case mEnvRoot of Just envRoot -> pure envRoot Nothing -> panic "CODEROOT not set" -- Simplified for now + +-- | Extract meaningful error messages from tool output, filtering out progress/status lines +extractErrorMessage :: Text -> Text +extractErrorMessage output = + let errorLines = + Text.lines output + |> filter isErrorLine + |> take 5 -- Limit to first 5 error lines + cleaned = + if null errorLines + then ["Unknown error (no error lines found)"] + else errorLines + in Text.unlines cleaned + where + isErrorLine line = + let stripped = Text.strip line + in not (Text.null stripped) + && ( "fail:" + `Text.isInfixOf` stripped + || "error:" + `Text.isInfixOf` stripped + || "Error:" + `Text.isInfixOf` stripped + || "ERROR:" + `Text.isInfixOf` stripped + ) + && not ("warning:" `Text.isInfixOf` stripped) -- Exclude warnings |
