Skip to content

fix(airt): never overwrite hand-patched workflow files on regen (ENG-6813)#56

Merged
rdheekonda merged 1 commit into
mainfrom
fix/eng-6813-workflow-overwrite
Jun 16, 2026
Merged

fix(airt): never overwrite hand-patched workflow files on regen (ENG-6813)#56
rdheekonda merged 1 commit into
mainfrom
fix/eng-6813-workflow-overwrite

Conversation

@rdheekonda

Copy link
Copy Markdown
Contributor

Fixes ENG-6813.

Summary

Workflow generation wrote each script to WORKFLOWS_DIR/<filename> with an unconditional filepath.write_text(script), clobbering any existing file at that path — including one a user had hand-patched after generation. Timestamped filenames (%Y%m%d_%H%M%S) only reduced collisions implicitly; a same-second regen (or any explicit/non-timestamped name) still silently overwrote prior work.

Fix

Add _unique_workflow_path(filename): if the target already exists, save as a new versioned file (name_v2.py, name_v3.py, …) and return the actual filename so callers (summary + execute_workflow next-step hint) report the real file. Existing files are never touched.

Applied at all five generate_* save sites (single, category sweep, agentic, image, tabular). Also removed a duplicate METADATA_FILE assignment.

Bumps capability 1.4.01.4.1.

Tests

TestUniqueWorkflowPath (3 cases):

  • no collision → original name
  • collision → saves _v2, leaves the hand-patched original byte-for-byte intact
  • repeated collisions → increments to first free _vN

Test plan

  • python -m pytest tests/test_attack_runner.py — 103 passed (incl. 3 new)
  • python -c "import ast; ast.parse(...)" — generated module compiles

…6813)

Workflow generation wrote scripts to WORKFLOWS_DIR/<filename> unconditionally,
clobbering any existing file at that path — including ones a user had
hand-patched after generation. Timestamped names only reduced collisions
implicitly (same-second regen still collides).

Add _unique_workflow_path(): if the target exists, save as a new versioned
file (name_v2.py, name_v3.py, ...) and return the actual name so callers
report it. Applied at all five generate_* save sites. Also drops a
duplicate METADATA_FILE assignment.

Bump capability 1.4.0 -> 1.4.1.

Validation: python -m pytest tests/test_attack_runner.py (103 passed,
incl. 3 new TestUniqueWorkflowPath cases).
@rdheekonda rdheekonda merged commit c4696df into main Jun 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant