Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 8, 2025

Problem

Some autotest interstitial jobs were failing when using conf_filters with min_dist constraints that filter out all generated defects. The issue occurred because:

  1. When all interstitial defects are filtered out by distance constraints, the element.out file is never created
  2. Later processing stages (especially post_process) expect this file to exist and fail when it's missing
  3. This causes dpgen autotest make to crash with errors like attempting to read from a non-existent file

Root Cause

The element.out file was only created when defects were actually written to it during the generation loop. If conf_filters removed all defects, the file was never opened/created, leaving subsequent processing steps unable to find the expected file.

Solution

This PR implements a minimal fix with two key changes:

1. Always Create element.out

# Always create element.out file, even if it will be empty
with open(insert_element_task, "w") as f:
    pass

The file is now created immediately after cleanup, ensuring it exists even when no defects pass the filters.

2. Robust post_process Handling

Enhanced the post_process method to gracefully handle:

  • Empty task lists
  • Missing element.out files
  • Mismatched number of element entries vs tasks
  • Empty element lines

Testing

Added comprehensive test cases:

  • test_make_confs_filtered_out: Reproduces the original bug scenario with high min_dist filtering
  • test_make_confs_partial_filtering: Tests robust handling of mismatched element/task counts
  • Verified existing functionality remains intact with all original tests passing

Verification

✅ Unit tests pass (5/5 interstitial tests)
✅ CLI commands work with problematic configurations
✅ Normal workflow remains functional
✅ Integration tests confirm fix works end-to-end
✅ Other autotest functionality unaffected

The fix is surgical and minimal - only 3 lines added to ensure file creation, plus robust error handling in post_process. This resolves the issue while maintaining full backward compatibility.

Fixes #500.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] [BUG] Some of autotest initersitial jobs fail to create element.out fix: ensure element.out is always created in interstitial autotest Sep 8, 2025
@Copilot Copilot AI requested a review from njzjz September 8, 2025 06:02
Copilot finished work on behalf of njzjz September 8, 2025 06:02
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.

[BUG] Some of autotest initersitial jobs fail to create element.out
2 participants