Repository navigation
test: unit tests for inspect_results and archive_studies - #58
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Co-Authored-By: Daniella Grimberg <daniella@cognition.ai>
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: Daniella Grimberg <daniella@cognition.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds hermetic unit tests for result loading, aggregation and reporting in
agentlab.analyze.inspect_resultsandagentlab.analyze.archive_studies. Test-only: two new files, nosrc/changes.tests/analyze/test_inspect_results_unit.py: 92 tests (85 pass + 7 strict xfail)tests/analyze/test_archive_studies.py: 13 tests (12 pass + 1 strict xfail)Fixtures are built two ways. Some are hand-made DataFrames that follow the
load_result_dfcolumn conventions. Others are synthetic experiment dirs intmp_path: a pickledExpArgswith a test-localFakeAgentArgs, plussummary_info.json,experiment.logandstep_*.pkl.gzfiles. Staleness is controlled withos.utime. An autouse fixture swapsloop.EXP_RESULT_CACHEfor an empty dict so no state leaks between tests. Stats tests assert exact values (for example the binary std err (\sqrt{p(1-p)/n}) and theddof=1sample std err). The__main__block ofarchive_studiesruns throughrunpywithexp_utils.RESULTS_DIRmonkeypatched totmp_path.Coverage (target modules, measured with these files only)
agentlab.analyze.inspect_resultsagentlab.analyze.archive_studiesUncovered lines that remain:
inspect_results650-660, 672-693, 711-718, 721, 735-736, 745: code after the undefinedERR_CLASS_MAPlookup. It can't run until the bug below is fixed.archive_studies118-122: the move-to-archive branch. The script hardcodesarchive_dir = None, so this branch is dead.Source bugs found (tests marked
xfail(strict=True))map_err_keydrops the last character when the message has no=== logs ===marker, becausefind()returns -1 and the slice becomeserr_msg[:-1]. Example:"Some error"comes back as"Some erro".categorize_errorrefers toERR_CLASS_MAP,is_critical_server_errorandis_minor_server_error, which are never defined or imported. Any row with an error raisesNameError, and so doerror_report_detailed,print_errors_chronologicallyandreport_different_errors.report_different_errorsasserts that.sum()returns a DataFrame, but.sum()always returns a Series, so it raisesAssertionErroreven when there are no errors (there is already a# TODO: fix this bugcomment).archive_studies.search_for_reasons_to_archiveraisesZeroDivisionErroron an empty summary (n_total == 0) when it should flag the study with "Empty summary DataFrame" / "No tasks".get_study_summarynotices a stale summary and rebuilds it, butget_exp_resulthands back cachedExpResultobjects with the oldsummary_info. The rebuilt summary and the CSV written to disk therefore keep the old rewards. Found by Devin Review.Also observed, not marked as a bug:
set_index_from_variablesaddsenv.task_nameto the index twice ifindex_white_listmatchesenv.*.Run
Devin-Org: engineering
Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/f3bd4e2463ad4873993623c7bd85b3ae
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/f3bd4e2463ad4873993623c7bd85b3ae?variant=devin
Requested by: @danigrim
Devin Review