Lab 8.2 — Implement the Fix, Write the Test, Format the Patch
Lab type: Fix-It (real JIRA)
Estimated time: 2–6 hours
Step 1 — Implement the Minimum Fix
Rules:
- Change only what is necessary to fix the bug
- Do not reformat surrounding code
- Do not add unrelated improvements
- Do not add comments unless they explain the fix
- If the fix requires changes in multiple files, make all changes in one commit
Step 2 — Write the Test
Every Tez patch must include a test that:
- Fails on the original code (without the fix)
- Passes on the patched code
The test must be in the same test class as existing tests for the modified class.
Test quality checklist:
- Test name clearly describes what it is testing
-
@Test(timeout = 5000)annotation (prevents hung tests from blocking CI) -
No
Thread.sleep()(useDrainDispatcher.await()orCountDownLatchinstead) - Assertion messages explain what was expected vs. what was found
- No hardcoded absolute paths or ports
Step 3 — Run the Full Test Module
cd ~/tez-src
mvn test -pl tez-dag -q 2>&1 | tail -10
All tests must pass.
Step 4 — Run Checkstyle
mvn checkstyle:check -pl tez-dag -q 2>&1 | grep -E "ERROR|violation" | head -20
Zero violations required.
Step 5 — Format the Patch
cd ~/tez-src
git diff HEAD > /tmp/TEZ-NNNN.001.patch
Verify:
# No trailing whitespace
grep -nP "\\s+$" /tmp/TEZ-NNNN.001.patch
# Patch applies cleanly
git apply --check /tmp/TEZ-NNNN.001.patch
Step 6 — Upload to JIRA
- Open your JIRA issue
- Click "Attach File" and upload
/tmp/TEZ-NNNN.001.patch - Set the "Patch Available" flag (the checkbox in the issue screen, NOT the workflow button)
- Update the description or add a comment:
Attaching patch TEZ-NNNN.001.patch
Changes:
- [ClassName.java]: [one-line description of the fix]
- [TestClassName.java]: [one-line description of the new test]
The test fails on unpatched code and passes with the fix applied.
After You Submit
You will typically receive review feedback within a few days to a few weeks. Common feedback categories:
| Feedback | Meaning | Your response |
|---|---|---|
| "Can you add a test?" | Test is missing | Add test, re-upload |
| "This is too broad" | Change is larger than needed | Narrow scope, re-upload |
| "Style nit: …" | Checkstyle or code style | Fix, re-upload |
| "+1" | Committer approves | Wait for commit, or ask "Is this ready to commit?" |
| "-1" | Hard block | Address all -1 comments before re-uploading |