Open
Conversation
Signed-off-by: Hailun Ding <hailun.ding@ibm.com>
Signed-off-by: Hailun Ding <hailun.ding@ibm.com>
dhl123
marked this pull request as ready for review
August 21, 2026 19:19
Signed-off-by: Hailun Ding <hailun.ding@ibm.com>
Signed-off-by: Hailun Ding <hailun.ding@ibm.com>
dhl123
marked this pull request as draft
September 2, 2026 20:01
5 tasks
Signed-off-by: Hailun Ding <hailun.ding@ibm.com>
Signed-off-by: Hailun Ding <hailun.ding@ibm.com>
Signed-off-by: Hailun Ding <hailun.ding@ibm.com>
Signed-off-by: Hailun Ding <hailun.ding@ibm.com>
Signed-off-by: Hailun Ding <hailun.ding@ibm.com>
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
A cleanup and bug-fix pass over the test-generation pipeline, and test scripts creation, plus the unit and integration test suites.
Closes
#12 #46 #49
Changes
1. args-migration.
argumentsindocs/policy_creation.md,docs/test_generation.md,policy_cross_validation.md,README.md, and the two docs guides toargsfor cpex compatibility. (problems left in last PR)2. agent's default value changes in promptfoo config.
3. made adjusts to cpex hr-agent example
4. delete usage of top-k
5. null values handling in
convert_test_case.py._convert_varinsrc/smith/test_generation/convert_test_case.pycalledint(None) / float(None)when a generated case supplied null for a numeric system variable, raisingTypeError. Most often triggered by adversarial Promptfoo cases that omit an integer field (e.g. queries_this_session). Now returnsNone, leaving the field absent so OPA treats it as unset.**6. remove any previously-appended tool-parameter block in promptfoo config generation (problems left in last PR)
generate_promptfoo_config.pyre-appended the tool-parameter block on every run, so the prompt grew each update. Added a sentinel marker and a strip step so the block is replaced instead of duplicated.Problem identified when writing unit and integration tests.
7. Missing env setup values
.env_templateomitted. Added variables:TEST_OUTPUT_DIR,TEST_PATH,MCP_URL,TOP_P,MAX_LLM_CALLS.8. Two modules read the environment themselves —
attack.pyandattack_promptfoo.pycalledload_dotenv()/os.getenvinside the function the CLIinvokes. Both now take the value as a parameter, resolved in
cli.pywith every otherpath. Three functions gained required parameters;
cli.pyis their only caller.9. AST graph indices inherited across calls — node ids came from the size of two
module-level dicts that were never reset, so the same policy parsed twice produced
different graphs.
init_graphnow clears them first.10.
convert_test_coverage.pyran its whole pipeline at import — and crashedwithout configuration, which broke the
policy_testingunit lane. Environmentresolution and I/O moved into
main(); the transformation logic extracted intoimportable functions. Output byte-identical, so the frozen coverage numbers still hold.
11.
apply_cross_validatecrashed when the destination didn't exist —shutil.movedoesn't create directories, so promoting a case into an absent
allow/raisedFileNotFoundErrormid-loop, leaving the tree partially applied. Addedos.makedirs(..., exist_ok=True)before each move.12. Whitespace-only lines now dropped in
decompose.py—remove_empty_linetestedlen(strr) != 0, so a line of spaces survived and became a rule, spending an LLM callto produce a meaningless record. Now judged with
.strip(); line content untouched.13. Discarded exit code hid Regal failures —
subprocess.runran withoutcheck=Trueand its result was thrown away, and the shell pipeline reportedsed'sstatus anyway. So a missing
regalbinary produced an empty report and a successfulflag: the same answer as a clean policy. Regal is now invoked directly and its exit
code classified (
0clean,3violations, anything else a failure).check=Truewould have been wrong — it raises on
3, the normal result. Output byte-identicalwherever Regal actually runs.
Tests
make unitmake integration