Skip to content

Test: Guard Fill invocation contract in main orchestration#227

Open
Aryama-srivastav wants to merge 1 commit intofireform-core:mainfrom
Aryama-srivastav:#226
Open

Test: Guard Fill invocation contract in main orchestration#227
Aryama-srivastav wants to merge 1 commit intofireform-core:mainfrom
Aryama-srivastav:#226

Conversation

@Aryama-srivastav
Copy link

@Aryama-srivastav Aryama-srivastav commented Mar 12, 2026

Summary

Adds a regression test to prevent reintroducing the Fill invocation mismatch in the PDF fill orchestration flow. Fix #226

This issue can cause runtime failure if src/main.py calls:
Fill(user_input=user_input).fill_form(...)

What Changed

  • Added src/test/test_main_invocation.py
  • Asserts src/main.py contains Fill.fill_form(
  • Asserts broken pattern Fill(user_input=user_input).fill_form( is not present

Why

The constructor/signature mismatch is a high-impact reliability risk that can crash the main report generation path with TypeError.
Even though the current code is already correct, this test ensures the bug does not regress in future edits.

Validation

  • Ran:
    -m pytest test_main_invocation.py -q

  • Result:
    1 passed

Scope

Test-only change
No runtime behavior changes

Copilot AI review requested due to automatic review settings March 12, 2026 12:54
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a regression test to prevent reintroducing a Fill constructor vs fill_form invocation mismatch in the PDF fill orchestration (by statically checking src/main.py’s call pattern).

Changes:

  • Added a new pytest test that reads src/main.py and asserts it uses Fill.fill_form(...).
  • Added a negative assertion to prevent the known-bad pattern Fill(user_input=user_input).fill_form(...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +6 to +10
main_path = Path(__file__).resolve().parents[1] / "main.py"
content = main_path.read_text(encoding="utf-8")

assert "Fill.fill_form(" in content
assert "Fill(user_input=user_input).fill_form(" not in content
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is brittle because it relies on raw substring matches in main.py. It can produce false positives (e.g., Fill.fill_form( appears in a comment/string) and false negatives (valid calls formatted as Fill.fill_form ( with whitespace/newlines). Consider parsing main.py with ast and asserting there is a Call to attribute Fill.fill_form, and that there is no Call where Fill(...) is invoked and then .fill_form is called.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

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.

Runtime TypeError in PDF fill orchestration (Fill call/signature mismatch)

2 participants