test(airt): guard generated workflows against dead Assessment methods (ENG-6777)#59
Merged
Merged
Conversation
… (ENG-6777) ENG-6777 reported that generated workflows called Assessment methods that no longer exist (record_attack, analyze, push_analytics, generate_report, push_report), crashing the TUI's primary path with AttributeError. The current generator already uses the assessment.run(study) API and is correct; these tests lock that in so the regression can't return. - test_runner_source_has_no_dead_methods: no generator template (any mode) references the five removed methods. - test_single_attack_calls_exist_on_assessment: every assessment.<m>() in a generated script is a real attribute on the installed SDK Assessment class (also catches SDK-side renames/removals). Validation: python -m pytest tests/test_attack_runner.py::TestGeneratedWorkflowAssessmentMethods (2 passed).
86e72a8 to
a58ad65
Compare
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.
Addresses ENG-6777.
Status: already fixed — this PR adds a regression guard
ENG-6777 reported that the TUI agent's
generate_attacktool produced workflows callingAssessmentmethods that no longer exist (record_attack,analyze,push_analytics,generate_report,push_report), crashing the fresh-install happy path withAttributeError.Verified the current capability (1.4.0) no longer has this bug:
Assessmentexposes onlyregister/trace/run/done/complete/fail.attack_runner.pyhas zero references to the five methods (git log -S record_attackshows they never appear in tracked history — the rewrite to theassessment.run(study)API predates it).tapworkflow: it callsregister/trace/run/failonly and executed to completion.Since the code is already correct, this PR adds tests so the regression cannot silently return.
Tests
test_runner_source_has_no_dead_methods— no generator template (any of the 5 modes) references the removed methods.test_single_attack_calls_exist_on_assessment— extracts everyassessment.<m>()call from a generated script and asserts each is a real attribute on the installed SDKAssessmentclass. This also catches the inverse: an SDK rename/removal of a method the template still uses.Uses
generate_only: Trueso generation runs without executing attacks (fast, offline).Test plan
python -m pytest tests/test_attack_runner.py::TestGeneratedWorkflowAssessmentMethods— 2 passedregister/trace/run/failand that all 5 dead methods reporthasattr=FalseNo capability version bump — test-only, no behavioral change.