From 59769653839ded2b9924a1eb3c3b468d81c1f875 Mon Sep 17 00:00:00 2001 From: Mohammad Durrani Date: Sat, 7 Feb 2026 16:30:04 -0500 Subject: [PATCH 01/34] Add power operation support --- src/calculator.py | 4 ++++ tests/test_calculator.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/calculator.py b/src/calculator.py index e828684..e94d423 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -17,3 +17,7 @@ def divide(a, b): if b == 0: raise ValueError("Cannot divide by zero") return a / b + +def power(a, b): + """Raise a to the power of b.""" + return a ** b diff --git a/tests/test_calculator.py b/tests/test_calculator.py index ffc0154..0e5160d 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -21,3 +21,8 @@ def test_divide(): def test_divide_by_zero(): with pytest.raises(ValueError): divide(5, 0) + +def test_power(): + assert power(2, 3) == 8 + assert power(5, 2) == 25 + assert power(10, 0) == 0 From 2be29f473fb847d671da011919636d2980c961d6 Mon Sep 17 00:00:00 2001 From: Mohammad Durrani Date: Sat, 7 Feb 2026 16:31:10 -0500 Subject: [PATCH 02/34] Add square root operation support --- .claude/agents/instruction-tester.md | 90 ++++++++++++++++++++++++++++ src/calculator.py | 9 ++- src/validator.py | 2 - tests/test_calculator.py | 11 +++- 4 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 .claude/agents/instruction-tester.md diff --git a/.claude/agents/instruction-tester.md b/.claude/agents/instruction-tester.md new file mode 100644 index 0000000..310bec7 --- /dev/null +++ b/.claude/agents/instruction-tester.md @@ -0,0 +1,90 @@ +--- +name: instruction-tester +description: "Use this agent when you need to validate project instructions, tutorials, or learning materials by simulating a student following them step-by-step. Examples:\\n\\n\\nContext: User has just finished writing a setup guide for their project.\\nuser: \"I've just updated the README with installation instructions. Can you check if they work?\"\\nassistant: \"I'll use the Task tool to launch the instruction-tester agent to follow your installation instructions as a student would and identify any issues or unclear steps.\"\\n\\n\\n\\nContext: User is creating a tutorial for a new feature.\\nuser: \"Here's my tutorial for the authentication flow. I want to make sure it's clear.\"\\nassistant: \"Let me use the instruction-tester agent to work through your authentication tutorial step-by-step and report on clarity, completeness, and any bugs.\"\\n\\n\\n\\nContext: User has made changes to onboarding documentation.\\nuser: \"I've revised the getting started guide. Please verify it.\"\\nassistant: \"I'm launching the instruction-tester agent to test your getting started guide by following it as a new user would, checking for gaps or errors.\"\\n" +model: sonnet +--- + +You are an Instruction Testing Agent - a diligent student persona designed to rigorously validate project instructions, tutorials, and learning materials by following them exactly as written. + +**Your Core Responsibilities:** + +1. **Execute Instructions Literally**: Follow the provided instructions step-by-step exactly as they are written. Do not fill in gaps with assumptions or prior knowledge. If an instruction is unclear or missing, note it as a bug rather than working around it. + +2. **Adopt Beginner Mindset**: Approach each instruction set as if you are encountering the concepts for the first time. Question terminology that isn't explained, flag missing context, and identify steps that assume prerequisite knowledge not mentioned in the instructions. + +3. **Document Your Journey**: As you work through instructions, track: + - Steps that worked as expected + - Steps that failed or produced unexpected results + - Steps that were unclear or ambiguous + - Missing steps or information gaps + - Points where you got stuck or confused + +4. **Assess Learning Outcomes**: After completing (or attempting to complete) the instructions, evaluate: + - Whether you could achieve the stated goal + - How well you understand the concepts after following the instructions + - What knowledge gaps remain + - Whether the difficulty level matches the intended audience + +5. **Report Findings Systematically**: Structure your report with: + - **Summary**: Overall assessment of instruction quality and completeness + - **Bugs Found**: Critical errors that prevent successful completion (numbered list) + - **Unclear Sections**: Ambiguous or confusing instructions that need clarification (numbered list) + - **Learning Assessment**: Your confidence level (0-10) in having mastered the material and specific gaps + - **Minimal Improvements**: ONLY 2-3 highest-impact suggestions for enhancement (be selective) + +**Operational Guidelines:** + +- **Be Thorough but Efficient**: Test every step, but don't overthink. If something doesn't work after a reasonable attempt following the instructions, document it and move on. + +- **Distinguish Error Types**: + - **Bugs**: Instructions that are factually wrong or lead to errors + - **Clarity Issues**: Instructions that are confusing but technically correct + - **Gaps**: Missing steps or information needed for success + +- **Maintain Focus**: Your primary job is finding bugs and assessing learnability, not redesigning the instructions. Improvements should be minimal and high-value only. + +- **Be Specific**: When reporting issues, cite exact instruction text, step numbers, or section headers. Provide concrete examples of what went wrong. + +- **Simulate Real Conditions**: Consider the environment a typical student would have. Don't assume access to tools, knowledge, or resources not mentioned in the instructions. + +- **Self-Verify**: Before reporting a bug, double-check that you followed the instructions correctly. If you're uncertain, note it as "possible bug (needs verification)". + +**Output Format:** + +Your reports should follow this structure: + +``` +## Instruction Test Report + +### Summary +[2-3 sentences on overall quality and whether instructions achieve their goal] + +### Bugs Found +1. [Specific bug with location reference] +2. [Specific bug with location reference] +... + +### Unclear Sections +1. [Ambiguous instruction with location reference] +2. [Confusing step with location reference] +... + +### Learning Assessment +Confidence Level: [0-10]/10 +Gaps: [Specific topics or skills not adequately covered] +Difficulty Match: [Whether difficulty aligns with target audience] + +### Minimal Improvements (Top 2-3 Only) +1. [Highest-impact improvement] +2. [Second highest-impact improvement] +3. [Third highest-impact improvement if warranted] +``` + +**Quality Standards:** +- Never invent solutions to broken instructions - report them +- Be honest about confusion - it indicates instruction problems +- Prioritize findability of issues over comprehensive rewrites +- Keep improvement suggestions actionable and specific +- If instructions work perfectly, say so clearly + +You are a quality assurance mechanism for educational content. Your student perspective is invaluable for identifying assumptions and gaps that experts might miss. diff --git a/src/calculator.py b/src/calculator.py index e828684..9559318 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -1,4 +1,5 @@ """Basic calculator operations.""" +import math def add(a, b): """Add two numbers.""" @@ -14,6 +15,10 @@ def multiply(a, b): def divide(a, b): """Divide a by b.""" - if b == 0: - raise ValueError("Cannot divide by zero") return a / b + +def square_root(a): + """Calculate square root of a.""" + if a < 0: + raise ValueError("Cannot calculate square root of negative number") + return math.sqrt(a) diff --git a/src/validator.py b/src/validator.py index 7a70d84..8f14ae6 100644 --- a/src/validator.py +++ b/src/validator.py @@ -1,5 +1,3 @@ -"""Input validation for calculator.""" - def validate_number(value): """Validate that value can be converted to a number.""" try: diff --git a/tests/test_calculator.py b/tests/test_calculator.py index ffc0154..d8d3b90 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -1,6 +1,6 @@ """Tests for calculator operations.""" import pytest -from src.calculator import add, subtract, multiply, divide +from src.calculator import add, subtract, multiply, divide, square_root def test_add(): assert add(2, 3) == 5 @@ -21,3 +21,12 @@ def test_divide(): def test_divide_by_zero(): with pytest.raises(ValueError): divide(5, 0) + +def test_square_root(): + assert square_root(9) == 3 + assert square_root(16) == 4 + assert square_root(2) == pytest.approx(1.414, rel=0.01) + +def test_square_root_negative(): + with pytest.raises(ValueError): + square_root(-1) From b19f2334eadf9de509392fba04e125416fe5d53e Mon Sep 17 00:00:00 2001 From: Mohammad Durrani Date: Sat, 7 Feb 2026 16:30:13 -0500 Subject: [PATCH 03/34] BAD: Add excessive debug logging to calculator module --- src/calculator.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/calculator.py b/src/calculator.py index e94d423..1ffb5ec 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -2,22 +2,38 @@ def add(a, b): """Add two numbers.""" - return a + b + print(f"[DEBUG] Adding {a} + {b}") + result = a + b + print(f"[DEBUG] Result: {result}") + return result def subtract(a, b): """Subtract b from a.""" - return a - b + print(f"[DEBUG] Subtracting {a} - {b}") + result = a - b + print(f"[DEBUG] Result: {result}") + return result def multiply(a, b): """Multiply two numbers.""" - return a * b + print(f"[DEBUG] Multiplying {a} * {b}") + result = a * b + print(f"[DEBUG] Result: {result}") + return result def divide(a, b): """Divide a by b.""" + print(f"[DEBUG] Dividing {a} / {b}") if b == 0: + print(f"[DEBUG] Error: Division by zero!") raise ValueError("Cannot divide by zero") - return a / b + result = a / b + print(f"[DEBUG] Result: {result}") + return result def power(a, b): """Raise a to the power of b.""" - return a ** b + print(f"[DEBUG] Power {a} ** {b}") + result = a ** b + print(f"[DEBUG] Result: {result}") + return result From 4dc20fbf70b41e2631e978b2a466b4eb8abeb7f8 Mon Sep 17 00:00:00 2001 From: Mohammad Durrani Date: Sat, 7 Feb 2026 16:31:20 -0500 Subject: [PATCH 04/34] BAD: Add excessive debug logging to calculator module --- src/calculator.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/calculator.py b/src/calculator.py index 9559318..cf72ae0 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -3,22 +3,38 @@ def add(a, b): """Add two numbers.""" - return a + b + print(f"[DEBUG] Adding {a} + {b}") + result = a + b + print(f"[DEBUG] Result: {result}") + return result def subtract(a, b): """Subtract b from a.""" - return a - b + print(f"[DEBUG] Subtracting {a} - {b}") + result = a - b + print(f"[DEBUG] Result: {result}") + return result def multiply(a, b): """Multiply two numbers.""" - return a * b + print(f"[DEBUG] Multiplying {a} * {b}") + result = a * b + print(f"[DEBUG] Result: {result}") + return result def divide(a, b): """Divide a by b.""" - return a / b + print(f"[DEBUG] Dividing {a} / {b}") + result = a / b + print(f"[DEBUG] Result: {result}") + return result def square_root(a): """Calculate square root of a.""" + print(f"[DEBUG] Square root of {a}") if a < 0: + print(f"[DEBUG] Error: Negative number!") raise ValueError("Cannot calculate square root of negative number") - return math.sqrt(a) + result = math.sqrt(a) + print(f"[DEBUG] Result: {result}") + return result From d4a52e208e319fdfc6a674bc28caea2e73e1de6a Mon Sep 17 00:00:00 2001 From: Mohammad Durrani Date: Sat, 7 Feb 2026 16:30:21 -0500 Subject: [PATCH 05/34] FEATURE: Add positive number validation --- src/validator.py | 8 ++++++++ tests/test_calculator.py | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/src/validator.py b/src/validator.py index 7a70d84..c3091e4 100644 --- a/src/validator.py +++ b/src/validator.py @@ -12,3 +12,11 @@ def validate_operation(op): """Validate that operation is supported.""" valid_ops = ['+', '-', '*', '/'] return op in valid_ops + +def validate_positive(n): + """Validate that a number is positive.""" + try: + num = float(n) + return num > 0 + except (ValueError, TypeError): + return False diff --git a/tests/test_calculator.py b/tests/test_calculator.py index 0e5160d..681e101 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -1,6 +1,7 @@ """Tests for calculator operations.""" import pytest from src.calculator import add, subtract, multiply, divide +from src.validator import validate_positive def test_add(): assert add(2, 3) == 5 @@ -26,3 +27,8 @@ def test_power(): assert power(2, 3) == 8 assert power(5, 2) == 25 assert power(10, 0) == 0 + +def test_validate_positive(): + assert validate_positive(5) == True + assert validate_positive(-5) == False + assert validate_positive(0) == False From 8133195704b745c6089b916e42b522a9487aecd7 Mon Sep 17 00:00:00 2001 From: Mohammad Durrani Date: Sat, 7 Feb 2026 16:31:30 -0500 Subject: [PATCH 06/34] FEATURE: Add non-negative number validation --- src/validator.py | 8 ++++++++ tests/test_calculator.py | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/src/validator.py b/src/validator.py index 8f14ae6..ac14b5f 100644 --- a/src/validator.py +++ b/src/validator.py @@ -10,3 +10,11 @@ def validate_operation(op): """Validate that operation is supported.""" valid_ops = ['+', '-', '*', '/'] return op in valid_ops + +def validate_non_negative(n): + """Validate that a number is non-negative.""" + try: + num = float(n) + return num >= 0 + except (ValueError, TypeError): + return False diff --git a/tests/test_calculator.py b/tests/test_calculator.py index d8d3b90..59f7d3d 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -1,6 +1,7 @@ """Tests for calculator operations.""" import pytest from src.calculator import add, subtract, multiply, divide, square_root +from src.validator import validate_non_negative def test_add(): assert add(2, 3) == 5 @@ -30,3 +31,8 @@ def test_square_root(): def test_square_root_negative(): with pytest.raises(ValueError): square_root(-1) + +def test_validate_non_negative(): + assert validate_non_negative(5) == True + assert validate_non_negative(0) == True + assert validate_non_negative(-5) == False From ea8f2db9fd628cc1469353503566e7bcb0327167 Mon Sep 17 00:00:00 2001 From: Fernando Terrones Date: Fri, 27 Mar 2026 18:09:40 -0400 Subject: [PATCH 07/34] Fix the failing power test --- tests/test_calculator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_calculator.py b/tests/test_calculator.py index 681e101..343d107 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -1,6 +1,6 @@ """Tests for calculator operations.""" import pytest -from src.calculator import add, subtract, multiply, divide +from src.calculator import add, subtract, multiply, divide, power from src.validator import validate_positive def test_add(): @@ -26,7 +26,7 @@ def test_divide_by_zero(): def test_power(): assert power(2, 3) == 8 assert power(5, 2) == 25 - assert power(10, 0) == 0 + assert power(10, 0) == 1 def test_validate_positive(): assert validate_positive(5) == True From 88d9fef7a76345c828204437c3275cc91bcb6631 Mon Sep 17 00:00:00 2001 From: Fernando Terrones Date: Fri, 27 Mar 2026 18:11:01 -0400 Subject: [PATCH 08/34] Updates module docstring in validator --- src/validator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validator.py b/src/validator.py index c3091e4..7bcae85 100644 --- a/src/validator.py +++ b/src/validator.py @@ -1,4 +1,4 @@ -"""Input validation for calculator.""" +"""Module provides functions to check if input is valid""" def validate_number(value): """Validate that value can be converted to a number.""" From cf600d0094ef3a6c63f8ea13251e72bf5c801e36 Mon Sep 17 00:00:00 2001 From: Fernando Terrones Date: Fri, 27 Mar 2026 18:18:25 -0400 Subject: [PATCH 09/34] Add is_positive helper function and add some useless comments. --- src/validator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/validator.py b/src/validator.py index 7bcae85..5934542 100644 --- a/src/validator.py +++ b/src/validator.py @@ -1,5 +1,5 @@ """Module provides functions to check if input is valid""" - +##Hello def validate_number(value): """Validate that value can be converted to a number.""" try: @@ -20,3 +20,6 @@ def validate_positive(n): return num > 0 except (ValueError, TypeError): return False +def is_positive(n): + """Check if a number is positive.""" + return n > 0 From c914eb7b894ac484456c7729356fa1b65e5b6c55 Mon Sep 17 00:00:00 2001 From: Fernando Terrones Date: Fri, 27 Mar 2026 18:15:01 -0400 Subject: [PATCH 10/34] Undos excessive debug logging This reverts commit b19f2334eadf9de509392fba04e125416fe5d53e. --- src/calculator.py | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/src/calculator.py b/src/calculator.py index 1ffb5ec..e94d423 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -2,38 +2,22 @@ def add(a, b): """Add two numbers.""" - print(f"[DEBUG] Adding {a} + {b}") - result = a + b - print(f"[DEBUG] Result: {result}") - return result + return a + b def subtract(a, b): """Subtract b from a.""" - print(f"[DEBUG] Subtracting {a} - {b}") - result = a - b - print(f"[DEBUG] Result: {result}") - return result + return a - b def multiply(a, b): """Multiply two numbers.""" - print(f"[DEBUG] Multiplying {a} * {b}") - result = a * b - print(f"[DEBUG] Result: {result}") - return result + return a * b def divide(a, b): """Divide a by b.""" - print(f"[DEBUG] Dividing {a} / {b}") if b == 0: - print(f"[DEBUG] Error: Division by zero!") raise ValueError("Cannot divide by zero") - result = a / b - print(f"[DEBUG] Result: {result}") - return result + return a / b def power(a, b): """Raise a to the power of b.""" - print(f"[DEBUG] Power {a} ** {b}") - result = a ** b - print(f"[DEBUG] Result: {result}") - return result + return a ** b From 4af47465f6a30597d26f483cc4f384f489f1a7d7 Mon Sep 17 00:00:00 2001 From: Fernando Terrones Date: Fri, 27 Mar 2026 19:46:16 -0400 Subject: [PATCH 11/34] added learnings files --- LEARNINGS-fterrone.md | 9 +++++++++ reflog_fterrone.md | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 LEARNINGS-fterrone.md create mode 100644 reflog_fterrone.md diff --git a/LEARNINGS-fterrone.md b/LEARNINGS-fterrone.md new file mode 100644 index 0000000..185ba3c --- /dev/null +++ b/LEARNINGS-fterrone.md @@ -0,0 +1,9 @@ +Checkpoint 1 +git switch -c feature/fterrone +git add . +git commit -m "fix" +git add . +git commit -m "update" +git push origin feature/fterrone +During this checkpoint I learned how to add files to the stageing area commiting them and pushing them. + diff --git a/reflog_fterrone.md b/reflog_fterrone.md new file mode 100644 index 0000000..5bbdad1 --- /dev/null +++ b/reflog_fterrone.md @@ -0,0 +1,41 @@ +cf600d0 HEAD@{0}: rebase (finish): returning to refs/heads/feature/fterrone +cf600d0 HEAD@{1}: rebase (squash): Add is_positive helper function and add some useless comments. +de3e5ab HEAD@{2}: rebase (pick): Add is_positive helper function +c914eb7 HEAD@{3}: rebase (pick): Undos excessive debug logging +88d9fef HEAD@{4}: rebase (reword): Updates module docstring in validator +26b2784 HEAD@{5}: rebase (reword): update +ea8f2db HEAD@{6}: rebase (reword): Fix the failing power test +9d5fcf0 HEAD@{7}: rebase: fast-forward +d4a52e2 HEAD@{8}: rebase (start): checkout main +5b412db HEAD@{9}: checkout: moving from feature/fterrone to feature/fterrone +5b412db HEAD@{10}: checkout: moving from main to feature/fterrone +f1deb16 HEAD@{11}: checkout: moving from feature/fterrone to main +5b412db HEAD@{12}: rebase (finish): returning to refs/heads/feature/fterrone +5b412db HEAD@{13}: rebase (start): checkout main +5b412db HEAD@{14}: rebase (finish): returning to refs/heads/feature/fterrone +5b412db HEAD@{15}: rebase (pick): add a comment +4179f84 HEAD@{16}: rebase (pick): Add is_positive helper function +54eb0a6 HEAD@{17}: rebase (pick): Undos excessive debug logging +f05a66e HEAD@{18}: rebase (pick): update +9d5fcf0 HEAD@{19}: rebase (reword): fix +76598d1 HEAD@{20}: rebase: fast-forward +d4a52e2 HEAD@{21}: rebase (start): checkout main +2be781c HEAD@{22}: merge recovered/fterrone: Fast-forward +5b1cd67 HEAD@{23}: checkout: moving from recovered/fterrone to feature/fterrone +2be781c HEAD@{24}: checkout: moving from feature/fterrone to recovered/fterrone +5b1cd67 HEAD@{25}: checkout: moving from experiment/fterrone to feature/fterrone +2be781c HEAD@{26}: commit: add a comment +5b1cd67 HEAD@{27}: checkout: moving from feature/fterrone to experiment/fterrone +5b1cd67 HEAD@{28}: checkout: moving from main to feature/fterrone +f1deb16 HEAD@{29}: checkout: moving from feature/fterrone to main +5b1cd67 HEAD@{30}: commit (cherry-pick): Add is_positive helper function +e4ded56 HEAD@{31}: checkout: moving from main to feature/fterrone +f1deb16 HEAD@{32}: reset: moving to HEAD~1 +ed58ac4 HEAD@{33}: commit: Add is_positive helper function +f1deb16 HEAD@{34}: checkout: moving from feature/fterrone to main +e4ded56 HEAD@{35}: revert: Undos excessive debug logging +dd97500 HEAD@{36}: commit: update +76598d1 HEAD@{37}: commit: fix +d4a52e2 HEAD@{38}: checkout: moving from starter/role-B to feature/fterrone +d4a52e2 HEAD@{39}: checkout: moving from main to starter/role-B +f1deb16 HEAD@{40}: clone: from github.com:Abdulrahman-Albeladi/git_project_1.git From 30ef0e05fffc174e204d6df342a3fbbcf1e111f2 Mon Sep 17 00:00:00 2001 From: Fernando Terrones Date: Fri, 27 Mar 2026 21:38:52 -0400 Subject: [PATCH 12/34] Learning Files --- LEARNINGS-fterrone.md | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/LEARNINGS-fterrone.md b/LEARNINGS-fterrone.md index 185ba3c..3399642 100644 --- a/LEARNINGS-fterrone.md +++ b/LEARNINGS-fterrone.md @@ -5,5 +5,43 @@ git commit -m "fix" git add . git commit -m "update" git push origin feature/fterrone -During this checkpoint I learned how to add files to the stageing area commiting them and pushing them. +During this checkpoint, I learned how to add files to the staging area, commit them, and push them. +Checkpoint 2 +git log --oneline +git revert b19f233 + +This checkpoint taught me how to undo commits without deleting them from the history using revert. + +Checkpoint 3 +Git switch main +git add . +git commit -m "Add is_positive helper function" +git log --oneline +git reset --hard HEAD~1 +git switch feature/fterrone +git cherry-pick ed58ac4 +git add . +git cherry-pick --continue +git push origin feature/fterrone + +This checkpoint taught me how to delete a branch and recover the comment. It also taught me how to use cherry-pick and fix merge conflicts. + +Checkpoint 4 +git switch -c experiment/fterrone +git add. +git commit -m "add a comment" +git branch -D experiment/fterrone +git reflog +git switch -c recovered/fterrone 2be781c +git switch feature/fterrone +git merge recovered/fterrone +git_project_1 % git log + +Checkpoint 4 taught me how to recover a deleted branch by using reflog. It also taught me how to merge two branches. + +Checkpoint 6 + +git rebase -i main +git push --force-with-lease +This checkpoint taught me how to use the rebase-interactive editor to clean up and improve the commit history. \ No newline at end of file From 6efccaa48458fb22f84526d75bfd54726940e04d Mon Sep 17 00:00:00 2001 From: Fterrone Date: Fri, 27 Mar 2026 21:49:48 -0400 Subject: [PATCH 13/34] Revert "Feature/fterrone" --- LEARNINGS-fterrone.md | 47 ---------------------------------------- reflog_fterrone.md | 41 ----------------------------------- src/calculator.py | 4 ---- src/validator.py | 15 ++----------- tests/test_calculator.py | 13 +---------- 5 files changed, 3 insertions(+), 117 deletions(-) delete mode 100644 LEARNINGS-fterrone.md delete mode 100644 reflog_fterrone.md diff --git a/LEARNINGS-fterrone.md b/LEARNINGS-fterrone.md deleted file mode 100644 index 3399642..0000000 --- a/LEARNINGS-fterrone.md +++ /dev/null @@ -1,47 +0,0 @@ -Checkpoint 1 -git switch -c feature/fterrone -git add . -git commit -m "fix" -git add . -git commit -m "update" -git push origin feature/fterrone -During this checkpoint, I learned how to add files to the staging area, commit them, and push them. - -Checkpoint 2 -git log --oneline -git revert b19f233 - -This checkpoint taught me how to undo commits without deleting them from the history using revert. - -Checkpoint 3 -Git switch main -git add . -git commit -m "Add is_positive helper function" -git log --oneline -git reset --hard HEAD~1 -git switch feature/fterrone -git cherry-pick ed58ac4 -git add . -git cherry-pick --continue -git push origin feature/fterrone - -This checkpoint taught me how to delete a branch and recover the comment. It also taught me how to use cherry-pick and fix merge conflicts. - -Checkpoint 4 -git switch -c experiment/fterrone -git add. -git commit -m "add a comment" -git branch -D experiment/fterrone -git reflog -git switch -c recovered/fterrone 2be781c -git switch feature/fterrone -git merge recovered/fterrone -git_project_1 % git log - -Checkpoint 4 taught me how to recover a deleted branch by using reflog. It also taught me how to merge two branches. - -Checkpoint 6 - -git rebase -i main -git push --force-with-lease -This checkpoint taught me how to use the rebase-interactive editor to clean up and improve the commit history. \ No newline at end of file diff --git a/reflog_fterrone.md b/reflog_fterrone.md deleted file mode 100644 index 5bbdad1..0000000 --- a/reflog_fterrone.md +++ /dev/null @@ -1,41 +0,0 @@ -cf600d0 HEAD@{0}: rebase (finish): returning to refs/heads/feature/fterrone -cf600d0 HEAD@{1}: rebase (squash): Add is_positive helper function and add some useless comments. -de3e5ab HEAD@{2}: rebase (pick): Add is_positive helper function -c914eb7 HEAD@{3}: rebase (pick): Undos excessive debug logging -88d9fef HEAD@{4}: rebase (reword): Updates module docstring in validator -26b2784 HEAD@{5}: rebase (reword): update -ea8f2db HEAD@{6}: rebase (reword): Fix the failing power test -9d5fcf0 HEAD@{7}: rebase: fast-forward -d4a52e2 HEAD@{8}: rebase (start): checkout main -5b412db HEAD@{9}: checkout: moving from feature/fterrone to feature/fterrone -5b412db HEAD@{10}: checkout: moving from main to feature/fterrone -f1deb16 HEAD@{11}: checkout: moving from feature/fterrone to main -5b412db HEAD@{12}: rebase (finish): returning to refs/heads/feature/fterrone -5b412db HEAD@{13}: rebase (start): checkout main -5b412db HEAD@{14}: rebase (finish): returning to refs/heads/feature/fterrone -5b412db HEAD@{15}: rebase (pick): add a comment -4179f84 HEAD@{16}: rebase (pick): Add is_positive helper function -54eb0a6 HEAD@{17}: rebase (pick): Undos excessive debug logging -f05a66e HEAD@{18}: rebase (pick): update -9d5fcf0 HEAD@{19}: rebase (reword): fix -76598d1 HEAD@{20}: rebase: fast-forward -d4a52e2 HEAD@{21}: rebase (start): checkout main -2be781c HEAD@{22}: merge recovered/fterrone: Fast-forward -5b1cd67 HEAD@{23}: checkout: moving from recovered/fterrone to feature/fterrone -2be781c HEAD@{24}: checkout: moving from feature/fterrone to recovered/fterrone -5b1cd67 HEAD@{25}: checkout: moving from experiment/fterrone to feature/fterrone -2be781c HEAD@{26}: commit: add a comment -5b1cd67 HEAD@{27}: checkout: moving from feature/fterrone to experiment/fterrone -5b1cd67 HEAD@{28}: checkout: moving from main to feature/fterrone -f1deb16 HEAD@{29}: checkout: moving from feature/fterrone to main -5b1cd67 HEAD@{30}: commit (cherry-pick): Add is_positive helper function -e4ded56 HEAD@{31}: checkout: moving from main to feature/fterrone -f1deb16 HEAD@{32}: reset: moving to HEAD~1 -ed58ac4 HEAD@{33}: commit: Add is_positive helper function -f1deb16 HEAD@{34}: checkout: moving from feature/fterrone to main -e4ded56 HEAD@{35}: revert: Undos excessive debug logging -dd97500 HEAD@{36}: commit: update -76598d1 HEAD@{37}: commit: fix -d4a52e2 HEAD@{38}: checkout: moving from starter/role-B to feature/fterrone -d4a52e2 HEAD@{39}: checkout: moving from main to starter/role-B -f1deb16 HEAD@{40}: clone: from github.com:Abdulrahman-Albeladi/git_project_1.git diff --git a/src/calculator.py b/src/calculator.py index e94d423..e828684 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -17,7 +17,3 @@ def divide(a, b): if b == 0: raise ValueError("Cannot divide by zero") return a / b - -def power(a, b): - """Raise a to the power of b.""" - return a ** b diff --git a/src/validator.py b/src/validator.py index 5934542..7a70d84 100644 --- a/src/validator.py +++ b/src/validator.py @@ -1,5 +1,5 @@ -"""Module provides functions to check if input is valid""" -##Hello +"""Input validation for calculator.""" + def validate_number(value): """Validate that value can be converted to a number.""" try: @@ -12,14 +12,3 @@ def validate_operation(op): """Validate that operation is supported.""" valid_ops = ['+', '-', '*', '/'] return op in valid_ops - -def validate_positive(n): - """Validate that a number is positive.""" - try: - num = float(n) - return num > 0 - except (ValueError, TypeError): - return False -def is_positive(n): - """Check if a number is positive.""" - return n > 0 diff --git a/tests/test_calculator.py b/tests/test_calculator.py index 343d107..ffc0154 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -1,7 +1,6 @@ """Tests for calculator operations.""" import pytest -from src.calculator import add, subtract, multiply, divide, power -from src.validator import validate_positive +from src.calculator import add, subtract, multiply, divide def test_add(): assert add(2, 3) == 5 @@ -22,13 +21,3 @@ def test_divide(): def test_divide_by_zero(): with pytest.raises(ValueError): divide(5, 0) - -def test_power(): - assert power(2, 3) == 8 - assert power(5, 2) == 25 - assert power(10, 0) == 1 - -def test_validate_positive(): - assert validate_positive(5) == True - assert validate_positive(-5) == False - assert validate_positive(0) == False From cce0362c163c0bd9b92c1b473bbdc076cf90669a Mon Sep 17 00:00:00 2001 From: Mohammad Durrani Date: Sat, 7 Feb 2026 16:25:22 -0500 Subject: [PATCH 14/34] Add modulo operation support --- src/calculator.py | 6 ++++++ tests/test_calculator.py | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/src/calculator.py b/src/calculator.py index e828684..513b08f 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -17,3 +17,9 @@ def divide(a, b): if b == 0: raise ValueError("Cannot divide by zero") return a / b + +def modulo(a, b): + """Return remainder of a divided by b.""" + if b == 0: + raise ValueError("Cannot modulo by zero") + return a % b diff --git a/tests/test_calculator.py b/tests/test_calculator.py index ffc0154..9382de3 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -21,3 +21,11 @@ def test_divide(): def test_divide_by_zero(): with pytest.raises(ValueError): divide(5, 0) + +def test_modulo(): + assert modulo(10, 3) == 1 + assert modulo(7, 2) == 1 + +def test_modulo_by_zero(): + with pytest.raises(ValueError): + modulo(5, 0) From 182eef1245f743ad4ff63d300b0865d93733313c Mon Sep 17 00:00:00 2001 From: Mohammad Durrani Date: Sat, 7 Feb 2026 16:25:34 -0500 Subject: [PATCH 15/34] BAD: Add excessive debug logging to calculator module --- src/calculator.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/calculator.py b/src/calculator.py index 513b08f..74d0d44 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -2,24 +2,41 @@ def add(a, b): """Add two numbers.""" - return a + b + print(f"[DEBUG] Adding {a} + {b}") + result = a + b + print(f"[DEBUG] Result: {result}") + return result def subtract(a, b): """Subtract b from a.""" - return a - b + print(f"[DEBUG] Subtracting {a} - {b}") + result = a - b + print(f"[DEBUG] Result: {result}") + return result def multiply(a, b): """Multiply two numbers.""" - return a * b + print(f"[DEBUG] Multiplying {a} * {b}") + result = a * b + print(f"[DEBUG] Result: {result}") + return result def divide(a, b): """Divide a by b.""" + print(f"[DEBUG] Dividing {a} / {b}") if b == 0: + print(f"[DEBUG] Error: Division by zero!") raise ValueError("Cannot divide by zero") - return a / b + result = a / b + print(f"[DEBUG] Result: {result}") + return result def modulo(a, b): """Return remainder of a divided by b.""" + print(f"[DEBUG] Modulo {a} % {b}") if b == 0: + print(f"[DEBUG] Error: Modulo by zero!") raise ValueError("Cannot modulo by zero") - return a % b + result = a % b + print(f"[DEBUG] Result: {result}") + return result From 6d3eccafad6b2f30778f7fab4bf64d31585542a1 Mon Sep 17 00:00:00 2001 From: Mohammad Durrani Date: Sat, 7 Feb 2026 16:25:58 -0500 Subject: [PATCH 16/34] FEATURE: Add range validation for inputs --- src/validator.py | 8 ++++++++ tests/test_calculator.py | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/src/validator.py b/src/validator.py index 7a70d84..330ed75 100644 --- a/src/validator.py +++ b/src/validator.py @@ -12,3 +12,11 @@ def validate_operation(op): """Validate that operation is supported.""" valid_ops = ['+', '-', '*', '/'] return op in valid_ops + +def validate_range(value, min_val=-1000, max_val=1000): + """Validate that number is within acceptable range.""" + try: + num = float(value) + return min_val <= num <= max_val + except (ValueError, TypeError): + return False diff --git a/tests/test_calculator.py b/tests/test_calculator.py index 9382de3..6c9342e 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -1,6 +1,7 @@ """Tests for calculator operations.""" import pytest from src.calculator import add, subtract, multiply, divide +from src.validator import validate_range def test_add(): assert add(2, 3) == 5 @@ -29,3 +30,8 @@ def test_modulo(): def test_modulo_by_zero(): with pytest.raises(ValueError): modulo(5, 0) + +def test_range_validation(): + assert validate_range(100) == True + assert validate_range(2000) == False + assert validate_range(-2000) == False From 3f1de831d9fb017185e50dd2caceb357e31248d0 Mon Sep 17 00:00:00 2001 From: Abdulrahman-Albeladi Date: Fri, 27 Mar 2026 00:34:12 -0400 Subject: [PATCH 17/34] Fix calculator tests and enable modulo validation --- src/validator.py | 4 ++-- tests/test_calculator.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/validator.py b/src/validator.py index 330ed75..d2c5925 100644 --- a/src/validator.py +++ b/src/validator.py @@ -10,7 +10,7 @@ def validate_number(value): def validate_operation(op): """Validate that operation is supported.""" - valid_ops = ['+', '-', '*', '/'] + valid_ops = ['+', '-', '*', '/', '%'] return op in valid_ops def validate_range(value, min_val=-1000, max_val=1000): @@ -19,4 +19,4 @@ def validate_range(value, min_val=-1000, max_val=1000): num = float(value) return min_val <= num <= max_val except (ValueError, TypeError): - return False + return False \ No newline at end of file diff --git a/tests/test_calculator.py b/tests/test_calculator.py index 6c9342e..8b0cf3a 100644 --- a/tests/test_calculator.py +++ b/tests/test_calculator.py @@ -1,6 +1,6 @@ """Tests for calculator operations.""" import pytest -from src.calculator import add, subtract, multiply, divide +from src.calculator import add, subtract, multiply, divide, modulo from src.validator import validate_range def test_add(): @@ -34,4 +34,4 @@ def test_modulo_by_zero(): def test_range_validation(): assert validate_range(100) == True assert validate_range(2000) == False - assert validate_range(-2000) == False + assert validate_range(-2000) == False \ No newline at end of file From 74d6eea99cca8c27fc1cb0f049e645dfdfb245b0 Mon Sep 17 00:00:00 2001 From: Abdulrahman-Albeladi Date: Fri, 27 Mar 2026 00:35:03 -0400 Subject: [PATCH 18/34] Improve calculator module docstring --- src/calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calculator.py b/src/calculator.py index 74d0d44..a20ccf6 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -1,4 +1,4 @@ -"""Basic calculator operations.""" +"""Basic calculator operations with support for arithmetic and modulo.""" def add(a, b): """Add two numbers.""" From c375e257a85ab22761fd3e8fc82aeaa37e65fd07 Mon Sep 17 00:00:00 2001 From: Abdulrahman-Albeladi Date: Fri, 27 Mar 2026 00:38:55 -0400 Subject: [PATCH 19/34] Revert "BAD: Add excessive debug logging to calculator module" This reverts commit 66f67168cde1931062e8593843137dd14562b44c. --- src/calculator.py | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/src/calculator.py b/src/calculator.py index a20ccf6..2e3e04c 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -2,41 +2,24 @@ def add(a, b): """Add two numbers.""" - print(f"[DEBUG] Adding {a} + {b}") - result = a + b - print(f"[DEBUG] Result: {result}") - return result + return a + b def subtract(a, b): """Subtract b from a.""" - print(f"[DEBUG] Subtracting {a} - {b}") - result = a - b - print(f"[DEBUG] Result: {result}") - return result + return a - b def multiply(a, b): """Multiply two numbers.""" - print(f"[DEBUG] Multiplying {a} * {b}") - result = a * b - print(f"[DEBUG] Result: {result}") - return result + return a * b def divide(a, b): """Divide a by b.""" - print(f"[DEBUG] Dividing {a} / {b}") if b == 0: - print(f"[DEBUG] Error: Division by zero!") raise ValueError("Cannot divide by zero") - result = a / b - print(f"[DEBUG] Result: {result}") - return result + return a / b def modulo(a, b): """Return remainder of a divided by b.""" - print(f"[DEBUG] Modulo {a} % {b}") if b == 0: - print(f"[DEBUG] Error: Modulo by zero!") raise ValueError("Cannot modulo by zero") - result = a % b - print(f"[DEBUG] Result: {result}") - return result + return a % b From 4148281f5e4e820486a26b59d086566d70c9fd39 Mon Sep 17 00:00:00 2001 From: Abdulrahman-Albeladi Date: Fri, 27 Mar 2026 00:49:52 -0400 Subject: [PATCH 20/34] Add is_positive helper function --- src/validator.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/validator.py b/src/validator.py index d2c5925..7e71649 100644 --- a/src/validator.py +++ b/src/validator.py @@ -19,4 +19,8 @@ def validate_range(value, min_val=-1000, max_val=1000): num = float(value) return min_val <= num <= max_val except (ValueError, TypeError): - return False \ No newline at end of file + return False + +def is_positive(n): + """Check if a number is positive.""" + return n > 0 \ No newline at end of file From 7a5d85f55705d1aec4bd5aaa5e7faaddc7516793 Mon Sep 17 00:00:00 2001 From: Abdulrahman-Albeladi Date: Fri, 27 Mar 2026 00:58:56 -0400 Subject: [PATCH 21/34] Recover experimental change using reflog --- src/calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calculator.py b/src/calculator.py index 2e3e04c..71ab105 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -1,5 +1,5 @@ """Basic calculator operations with support for arithmetic and modulo.""" - +# Temporary experiment change def add(a, b): """Add two numbers.""" return a + b From b257167fdf1917636016427043d876b1bdb3968f Mon Sep 17 00:00:00 2001 From: Abdulrahman-Albeladi Date: Fri, 27 Mar 2026 22:28:00 -0400 Subject: [PATCH 22/34] Add learnings file --- LEARNINGS-aalbelad.md | 81 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 LEARNINGS-aalbelad.md diff --git a/LEARNINGS-aalbelad.md b/LEARNINGS-aalbelad.md new file mode 100644 index 0000000..6c7a3f4 --- /dev/null +++ b/LEARNINGS-aalbelad.md @@ -0,0 +1,81 @@ +# LEARNINGS-aalbelad.md + +## CP1 – Staging vs Committing +Commands: +- git checkout -b feature/aalbelad starter/role-A +- pytest tests/ +- git add src/validator.py tests/test_calculator.py +- git commit -m "fix" +- git add src/calculator.py +- git commit -m "update" + +Reflection: +I learned how staging allows me to control exactly what goes into each commit. Separating the fix and update commits helped me understand how to create clear, meaningful commit history. + +## CP2 – Reverting a Bad Commit +Commands: +- git log --oneline +- git revert + +Reflection: +I learned that git revert safely undoes a commit by creating a new commit instead of deleting history. This is important for collaboration because it keeps a full and transparent record of changes. + +## CP3 – Moving a Commit with Cherry-Pick +Commands: +- git checkout main +- git add src/validator.py +- git commit -m "Add is_positive helper function" +- git log --oneline -1 +- git reset --hard HEAD~1 +- git checkout feature/aalbelad +- git cherry-pick + +Reflection: +I learned how to recover from committing on the wrong branch by using cherry-pick. This allows moving a specific change without rewriting the code manually. + +## CP4 – Recovering Lost Work with Reflog +Commands: +- git checkout -b experiment/aalbelad +- git add src/calculator.py +- git commit -m "Experiment change" +- git checkout feature/aalbelad +- git branch -D experiment/aalbelad +- git reflog +- git checkout -b recovered/aalbelad +- git checkout feature/aalbelad +- git merge recovered/aalbelad + +Reflection: +I learned that even after deleting a branch, Git can recover lost commits using reflog. This shows that most mistakes in Git are reversible if you know the right tools. + +## CP5 – Syncing with Upstream and Rebasing +Commands: +- git remote set-url upstream https://github.com/mdurrani808/git_project_1.git +- git fetch upstream +- git checkout main +- git reset --hard upstream/main +- git checkout feature/aalbelad +- git rebase main +- git push --force-with-lease origin feature/aalbelad + +Reflection: +I learned how to synchronize my work with the latest changes from the original repository using rebase. This keeps the commit history clean and avoids unnecessary merge commits. + +## CP6 – Cleaning Commit History +Commands: +- git log main..HEAD --oneline +- git rebase -i main +- git push --force-with-lease origin feature/aalbelad + +Reflection: +I learned how to clean up commit history by rewriting commit messages using interactive rebase. This makes the project easier to review and improves code readability. + +## CP7 – Pull Requests and Code Review +Commands: +- git push origin feature/aalbelad +- Open pull request (feature/aalbelad → main) +- Review teammate PR and request changes +- Respond to comments on my PR + +Reflection: +I learned how to collaborate using pull requests by reviewing teammate code, requesting changes, and responding to feedback. This helped me understand how real-world team workflows operate in GitHub. \ No newline at end of file From 36f9841a4ee7196747c3cdd2746c52c5cdefddd0 Mon Sep 17 00:00:00 2001 From: Fernando Terrones Date: Fri, 27 Mar 2026 18:18:25 -0400 Subject: [PATCH 23/34] Add is_positive helper function. --- src/validator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/validator.py b/src/validator.py index 7bcae85..5934542 100644 --- a/src/validator.py +++ b/src/validator.py @@ -1,5 +1,5 @@ """Module provides functions to check if input is valid""" - +##Hello def validate_number(value): """Validate that value can be converted to a number.""" try: @@ -20,3 +20,6 @@ def validate_positive(n): return num > 0 except (ValueError, TypeError): return False +def is_positive(n): + """Check if a number is positive.""" + return n > 0 From 2f36d7140f69278f48eacd87ebdc878c62d7af91 Mon Sep 17 00:00:00 2001 From: Fernando Terrones Date: Fri, 27 Mar 2026 19:46:16 -0400 Subject: [PATCH 24/34] add comments to validate_operation and added Learning files --- LEARNINGS-fterrone.md | 56 +++++++++++++++++++++++++++++++++++++++++++ reflog_fterrone.md | 41 +++++++++++++++++++++++++++++++ src/validator.py | 2 +- 3 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 LEARNINGS-fterrone.md create mode 100644 reflog_fterrone.md diff --git a/LEARNINGS-fterrone.md b/LEARNINGS-fterrone.md new file mode 100644 index 0000000..17b4930 --- /dev/null +++ b/LEARNINGS-fterrone.md @@ -0,0 +1,56 @@ +Checkpoint 1 +- git switch -c feature/fterrone +- git add . +- git commit -m "fix" +- git add . +- git commit -m "update" +- git push origin feature/fterrone + +During this checkpoint, I learned how to add files to the staging area, commit them, and push them. + +Checkpoint 2 +- git log --oneline +- git revert b19f233 + +This checkpoint taught me how to undo commits without deleting them from the history using revert. + +Checkpoint 3 +- Git switch main +- git add . +- git commit -m "Add is_positive helper function" +- git log --oneline +- git reset --hard HEAD~1 +- git switch feature/fterrone +- git cherry-pick ed58ac4 +- git add . +- git cherry-pick --continue +- git push origin feature/fterrone + +This checkpoint taught me how to delete a branch and recover the comment. It also taught me how to use cherry-pick and fix merge conflicts. + +Checkpoint 4 +- git switch -c experiment/fterrone +- git add. +- git commit -m "add a comment" +- git branch -D experiment/fterrone +- git reflog +- git switch -c recovered/fterrone 2be781c +- git switch feature/fterrone +- git merge recovered/fterrone +- git_project_1 % git log + +Checkpoint 4 taught me how to recover a deleted branch by using reflog. It also taught me how to merge two branches. + +Checkpoint 6 + +- git rebase -i main +- git push --force-with-lease + +This checkpoint taught me how to use the rebase-interactive editor to clean up and improve the commit history. + +checkpoint 7 +- git add . +- git commit -m "add comments to validate_operation and added Learning files" +- git rebase -i main +- git push --force-with-lease +This check point helped me learn to give feed back on poll request. it also allowed me to apllay how to handel feed back. diff --git a/reflog_fterrone.md b/reflog_fterrone.md new file mode 100644 index 0000000..5bbdad1 --- /dev/null +++ b/reflog_fterrone.md @@ -0,0 +1,41 @@ +cf600d0 HEAD@{0}: rebase (finish): returning to refs/heads/feature/fterrone +cf600d0 HEAD@{1}: rebase (squash): Add is_positive helper function and add some useless comments. +de3e5ab HEAD@{2}: rebase (pick): Add is_positive helper function +c914eb7 HEAD@{3}: rebase (pick): Undos excessive debug logging +88d9fef HEAD@{4}: rebase (reword): Updates module docstring in validator +26b2784 HEAD@{5}: rebase (reword): update +ea8f2db HEAD@{6}: rebase (reword): Fix the failing power test +9d5fcf0 HEAD@{7}: rebase: fast-forward +d4a52e2 HEAD@{8}: rebase (start): checkout main +5b412db HEAD@{9}: checkout: moving from feature/fterrone to feature/fterrone +5b412db HEAD@{10}: checkout: moving from main to feature/fterrone +f1deb16 HEAD@{11}: checkout: moving from feature/fterrone to main +5b412db HEAD@{12}: rebase (finish): returning to refs/heads/feature/fterrone +5b412db HEAD@{13}: rebase (start): checkout main +5b412db HEAD@{14}: rebase (finish): returning to refs/heads/feature/fterrone +5b412db HEAD@{15}: rebase (pick): add a comment +4179f84 HEAD@{16}: rebase (pick): Add is_positive helper function +54eb0a6 HEAD@{17}: rebase (pick): Undos excessive debug logging +f05a66e HEAD@{18}: rebase (pick): update +9d5fcf0 HEAD@{19}: rebase (reword): fix +76598d1 HEAD@{20}: rebase: fast-forward +d4a52e2 HEAD@{21}: rebase (start): checkout main +2be781c HEAD@{22}: merge recovered/fterrone: Fast-forward +5b1cd67 HEAD@{23}: checkout: moving from recovered/fterrone to feature/fterrone +2be781c HEAD@{24}: checkout: moving from feature/fterrone to recovered/fterrone +5b1cd67 HEAD@{25}: checkout: moving from experiment/fterrone to feature/fterrone +2be781c HEAD@{26}: commit: add a comment +5b1cd67 HEAD@{27}: checkout: moving from feature/fterrone to experiment/fterrone +5b1cd67 HEAD@{28}: checkout: moving from main to feature/fterrone +f1deb16 HEAD@{29}: checkout: moving from feature/fterrone to main +5b1cd67 HEAD@{30}: commit (cherry-pick): Add is_positive helper function +e4ded56 HEAD@{31}: checkout: moving from main to feature/fterrone +f1deb16 HEAD@{32}: reset: moving to HEAD~1 +ed58ac4 HEAD@{33}: commit: Add is_positive helper function +f1deb16 HEAD@{34}: checkout: moving from feature/fterrone to main +e4ded56 HEAD@{35}: revert: Undos excessive debug logging +dd97500 HEAD@{36}: commit: update +76598d1 HEAD@{37}: commit: fix +d4a52e2 HEAD@{38}: checkout: moving from starter/role-B to feature/fterrone +d4a52e2 HEAD@{39}: checkout: moving from main to starter/role-B +f1deb16 HEAD@{40}: clone: from github.com:Abdulrahman-Albeladi/git_project_1.git diff --git a/src/validator.py b/src/validator.py index 5934542..71c387a 100644 --- a/src/validator.py +++ b/src/validator.py @@ -1,5 +1,4 @@ """Module provides functions to check if input is valid""" -##Hello def validate_number(value): """Validate that value can be converted to a number.""" try: @@ -10,6 +9,7 @@ def validate_number(value): def validate_operation(op): """Validate that operation is supported.""" + # an list of valid operation valid_ops = ['+', '-', '*', '/'] return op in valid_ops From 4d8fef28d3c7f4b362f659cfcdf6e9189a0da3cc Mon Sep 17 00:00:00 2001 From: Fernando Terrones Date: Fri, 27 Mar 2026 23:21:30 -0400 Subject: [PATCH 25/34] Updated reflog --- reflog_fterrone.md | 120 +++++++++++++++++++++++++++++---------------- 1 file changed, 79 insertions(+), 41 deletions(-) diff --git a/reflog_fterrone.md b/reflog_fterrone.md index 5bbdad1..edc0f35 100644 --- a/reflog_fterrone.md +++ b/reflog_fterrone.md @@ -1,41 +1,79 @@ -cf600d0 HEAD@{0}: rebase (finish): returning to refs/heads/feature/fterrone -cf600d0 HEAD@{1}: rebase (squash): Add is_positive helper function and add some useless comments. -de3e5ab HEAD@{2}: rebase (pick): Add is_positive helper function -c914eb7 HEAD@{3}: rebase (pick): Undos excessive debug logging -88d9fef HEAD@{4}: rebase (reword): Updates module docstring in validator -26b2784 HEAD@{5}: rebase (reword): update -ea8f2db HEAD@{6}: rebase (reword): Fix the failing power test -9d5fcf0 HEAD@{7}: rebase: fast-forward -d4a52e2 HEAD@{8}: rebase (start): checkout main -5b412db HEAD@{9}: checkout: moving from feature/fterrone to feature/fterrone -5b412db HEAD@{10}: checkout: moving from main to feature/fterrone -f1deb16 HEAD@{11}: checkout: moving from feature/fterrone to main -5b412db HEAD@{12}: rebase (finish): returning to refs/heads/feature/fterrone -5b412db HEAD@{13}: rebase (start): checkout main -5b412db HEAD@{14}: rebase (finish): returning to refs/heads/feature/fterrone -5b412db HEAD@{15}: rebase (pick): add a comment -4179f84 HEAD@{16}: rebase (pick): Add is_positive helper function -54eb0a6 HEAD@{17}: rebase (pick): Undos excessive debug logging -f05a66e HEAD@{18}: rebase (pick): update -9d5fcf0 HEAD@{19}: rebase (reword): fix -76598d1 HEAD@{20}: rebase: fast-forward -d4a52e2 HEAD@{21}: rebase (start): checkout main -2be781c HEAD@{22}: merge recovered/fterrone: Fast-forward -5b1cd67 HEAD@{23}: checkout: moving from recovered/fterrone to feature/fterrone -2be781c HEAD@{24}: checkout: moving from feature/fterrone to recovered/fterrone -5b1cd67 HEAD@{25}: checkout: moving from experiment/fterrone to feature/fterrone -2be781c HEAD@{26}: commit: add a comment -5b1cd67 HEAD@{27}: checkout: moving from feature/fterrone to experiment/fterrone -5b1cd67 HEAD@{28}: checkout: moving from main to feature/fterrone -f1deb16 HEAD@{29}: checkout: moving from feature/fterrone to main -5b1cd67 HEAD@{30}: commit (cherry-pick): Add is_positive helper function -e4ded56 HEAD@{31}: checkout: moving from main to feature/fterrone -f1deb16 HEAD@{32}: reset: moving to HEAD~1 -ed58ac4 HEAD@{33}: commit: Add is_positive helper function -f1deb16 HEAD@{34}: checkout: moving from feature/fterrone to main -e4ded56 HEAD@{35}: revert: Undos excessive debug logging -dd97500 HEAD@{36}: commit: update -76598d1 HEAD@{37}: commit: fix -d4a52e2 HEAD@{38}: checkout: moving from starter/role-B to feature/fterrone -d4a52e2 HEAD@{39}: checkout: moving from main to starter/role-B -f1deb16 HEAD@{40}: clone: from github.com:Abdulrahman-Albeladi/git_project_1.git +2f36d71 (HEAD -> feature/fterrone, origin/feature/fterrone) HEAD@{0}: rebase (finish): returning to refs/heads/feature/fterrone +2f36d71 (HEAD -> feature/fterrone, origin/feature/fterrone) HEAD@{1}: rebase (reword): add comments to validate_operation and added Learning files +96da473 HEAD@{2}: rebase (reword): added learnings files +36f9841 HEAD@{3}: rebase (reword): Add is_positive helper function. +cf600d0 HEAD@{4}: rebase: fast-forward +c914eb7 HEAD@{5}: rebase (start): checkout main +57577d4 HEAD@{6}: rebase (finish): returning to refs/heads/feature/fterrone +57577d4 HEAD@{7}: rebase (squash): added learnings files +65b8cd0 HEAD@{8}: rebase (squash): # This is a combination of 2 commits. +f44fdd2 HEAD@{9}: rebase (start): checkout main +ab05f8e HEAD@{10}: checkout: moving from main to feature/fterrone +f1deb16 (upstream/main, upstream/HEAD, origin/main, origin/feature/tngwafor, origin/HEAD, main) HEAD@{11}: checkout: moving from feature/fterrone to main +ab05f8e HEAD@{12}: rebase (abort): returning to refs/heads/feature/fterrone +44188cc HEAD@{13}: rebase (squash): # This is a combination of 2 commits. +f44fdd2 HEAD@{14}: rebase (start): checkout main +ab05f8e HEAD@{15}: commit: add comments to validate_operation and added Learning files +6cf44f6 HEAD@{16}: rebase (finish): returning to refs/heads/feature/fterrone +6cf44f6 HEAD@{17}: commit: add comments to validate_operation and added Learning files +f44fdd2 HEAD@{18}: rebase (start): checkout main +8d1bc67 HEAD@{19}: commit: add comments to validate_operation and added Learning files +f44fdd2 HEAD@{20}: rebase (finish): returning to refs/heads/feature/fterrone +f44fdd2 HEAD@{21}: rebase (reword): added learnings files +4942e2e HEAD@{22}: rebase: fast-forward +cf600d0 HEAD@{23}: rebase (start): checkout main +4942e2e HEAD@{24}: rebase (finish): returning to refs/heads/feature/fterrone +4942e2e HEAD@{25}: rebase (continue): added learnings files +dfe2634 HEAD@{26}: rebase (squash): # This is a combination of 2 commits. +4af4746 HEAD@{27}: rebase (start): checkout main +13f63d5 HEAD@{28}: checkout: moving from recovered/fterrone to feature/fterrone +2be781c (recovered/fterrone) HEAD@{29}: checkout: moving from main to recovered/fterrone +f1deb16 (upstream/main, upstream/HEAD, origin/main, origin/feature/tngwafor, origin/HEAD, main) HEAD@{30}: reset: moving to f1deb16 +f1deb16 (upstream/main, upstream/HEAD, origin/main, origin/feature/tngwafor, origin/HEAD, main) HEAD@{31}: reset: moving to f1deb16 +f1deb16 (upstream/main, upstream/HEAD, origin/main, origin/feature/tngwafor, origin/HEAD, main) HEAD@{32}: reset: moving to f1deb16 +5ce58d5 HEAD@{33}: revert: Revert "Initial commit: Calculator project structure" +f1deb16 (upstream/main, upstream/HEAD, origin/main, origin/feature/tngwafor, origin/HEAD, main) HEAD@{34}: checkout: moving from feature/fterrone to main +13f63d5 HEAD@{35}: commit: Updated learning files +30ef0e0 HEAD@{36}: commit: Learning Files +4af4746 HEAD@{37}: commit: added learnings files +cf600d0 HEAD@{38}: rebase (finish): returning to refs/heads/feature/fterrone +cf600d0 HEAD@{39}: rebase (squash): Add is_positive helper function and add some useless comments. +de3e5ab HEAD@{40}: rebase (pick): Add is_positive helper function +c914eb7 HEAD@{41}: rebase (pick): Undos excessive debug logging +88d9fef HEAD@{42}: rebase (reword): Updates module docstring in validator +26b2784 HEAD@{43}: rebase (reword): update +ea8f2db HEAD@{44}: rebase (reword): Fix the failing power test +9d5fcf0 HEAD@{45}: rebase: fast-forward +d4a52e2 (upstream/starter/role-B, starter/role-B) HEAD@{46}: rebase (start): checkout main +5b412db HEAD@{47}: checkout: moving from feature/fterrone to feature/fterrone +5b412db HEAD@{48}: checkout: moving from main to feature/fterrone +f1deb16 (upstream/main, upstream/HEAD, origin/main, origin/feature/tngwafor, origin/HEAD, main) HEAD@{49}: checkout: moving from feature/fterrone to main +5b412db HEAD@{50}: rebase (finish): returning to refs/heads/feature/fterrone +5b412db HEAD@{51}: rebase (start): checkout main +5b412db HEAD@{52}: rebase (finish): returning to refs/heads/feature/fterrone +5b412db HEAD@{53}: rebase (pick): add a comment +4179f84 HEAD@{54}: rebase (pick): Add is_positive helper function +54eb0a6 HEAD@{55}: rebase (pick): Undos excessive debug logging +f05a66e HEAD@{56}: rebase (pick): update +9d5fcf0 HEAD@{57}: rebase (reword): fix +76598d1 HEAD@{58}: rebase: fast-forward +d4a52e2 (upstream/starter/role-B, starter/role-B) HEAD@{59}: rebase (start): checkout main +2be781c (recovered/fterrone) HEAD@{60}: merge recovered/fterrone: Fast-forward +5b1cd67 HEAD@{61}: checkout: moving from recovered/fterrone to feature/fterrone +2be781c (recovered/fterrone) HEAD@{62}: checkout: moving from feature/fterrone to recovered/fterrone +5b1cd67 HEAD@{63}: checkout: moving from experiment/fterrone to feature/fterrone +2be781c (recovered/fterrone) HEAD@{64}: commit: add a comment +5b1cd67 HEAD@{65}: checkout: moving from feature/fterrone to experiment/fterrone +5b1cd67 HEAD@{66}: checkout: moving from main to feature/fterrone +f1deb16 (upstream/main, upstream/HEAD, origin/main, origin/feature/tngwafor, origin/HEAD, main) HEAD@{67}: checkout: moving from feature/fterrone to main +5b1cd67 HEAD@{68}: commit (cherry-pick): Add is_positive helper function +e4ded56 HEAD@{69}: checkout: moving from main to feature/fterrone +f1deb16 (upstream/main, upstream/HEAD, origin/main, origin/feature/tngwafor, origin/HEAD, main) HEAD@{70}: reset: moving to HEAD~1 +ed58ac4 HEAD@{71}: commit: Add is_positive helper function +f1deb16 (upstream/main, upstream/HEAD, origin/main, origin/feature/tngwafor, origin/HEAD, main) HEAD@{72}: checkout: moving from feature/fterrone to main +e4ded56 HEAD@{73}: revert: Undos excessive debug logging +dd97500 HEAD@{74}: commit: update +76598d1 HEAD@{75}: commit: fix +d4a52e2 (upstream/starter/role-B, starter/role-B) HEAD@{76}: checkout: moving from starter/role-B to feature/fterrone +d4a52e2 (upstream/starter/role-B, starter/role-B) HEAD@{77}: checkout: moving from main to starter/role-B +f1deb16 (upstream/main, upstream/HEAD, origin/main, origin/feature/tngwafor, origin/HEAD, main) HEAD@{78}: clone: from github.com:Abdulrahman-Albeladi/git_project_1.git \ No newline at end of file From 7be7f2b52c11c82ebbbbd39ab2fb1601494a54b6 Mon Sep 17 00:00:00 2001 From: rahulnair307 Date: Fri, 27 Mar 2026 22:08:34 -0400 Subject: [PATCH 26/34] Fix divide to raise ValueError on division by zero --- src/calculator.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calculator.py b/src/calculator.py index cf72ae0..bdbb398 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -25,6 +25,9 @@ def multiply(a, b): def divide(a, b): """Divide a by b.""" print(f"[DEBUG] Dividing {a} / {b}") + if b == 0: + print(f"[DEBUG] Error: Division by zero!") + raise ValueError("Cannot divide by zero") result = a / b print(f"[DEBUG] Result: {result}") return result From 26afb068440922646ff986794e6a3adcfe5dca40 Mon Sep 17 00:00:00 2001 From: rahulnair307 Date: Fri, 27 Mar 2026 22:11:27 -0400 Subject: [PATCH 27/34] Add module docstring to validator --- src/validator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/validator.py b/src/validator.py index ac14b5f..f46e870 100644 --- a/src/validator.py +++ b/src/validator.py @@ -1,3 +1,4 @@ +"""These are the validation functions for the calculator inputs and are used in the main calculator logic before the operations are performed.""" def validate_number(value): """Validate that value can be converted to a number.""" try: From 9003af4e0ff3445c30ce934346701f5303f305a4 Mon Sep 17 00:00:00 2001 From: rahulnair307 Date: Fri, 27 Mar 2026 22:25:19 -0400 Subject: [PATCH 28/34] Revert "BAD: Add excessive debug logging to calculator module" This reverts commit 4dc20fbf70b41e2631e978b2a466b4eb8abeb7f8. --- src/calculator.py | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/calculator.py b/src/calculator.py index bdbb398..80b212e 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -3,30 +3,19 @@ def add(a, b): """Add two numbers.""" - print(f"[DEBUG] Adding {a} + {b}") - result = a + b - print(f"[DEBUG] Result: {result}") - return result + return a + b def subtract(a, b): """Subtract b from a.""" - print(f"[DEBUG] Subtracting {a} - {b}") - result = a - b - print(f"[DEBUG] Result: {result}") - return result + return a - b def multiply(a, b): """Multiply two numbers.""" - print(f"[DEBUG] Multiplying {a} * {b}") - result = a * b - print(f"[DEBUG] Result: {result}") - return result + return a * b def divide(a, b): """Divide a by b.""" - print(f"[DEBUG] Dividing {a} / {b}") if b == 0: - print(f"[DEBUG] Error: Division by zero!") raise ValueError("Cannot divide by zero") result = a / b print(f"[DEBUG] Result: {result}") @@ -34,10 +23,6 @@ def divide(a, b): def square_root(a): """Calculate square root of a.""" - print(f"[DEBUG] Square root of {a}") if a < 0: - print(f"[DEBUG] Error: Negative number!") raise ValueError("Cannot calculate square root of negative number") - result = math.sqrt(a) - print(f"[DEBUG] Result: {result}") - return result + return math.sqrt(a) From 6a618254fb416120c725371ac39a557e05f3f392 Mon Sep 17 00:00:00 2001 From: rahulnair307 Date: Fri, 27 Mar 2026 22:30:25 -0400 Subject: [PATCH 29/34] CheckPoint 2 DONE --- src/calculator.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/calculator.py b/src/calculator.py index 80b212e..7ea8da2 100644 --- a/src/calculator.py +++ b/src/calculator.py @@ -18,7 +18,6 @@ def divide(a, b): if b == 0: raise ValueError("Cannot divide by zero") result = a / b - print(f"[DEBUG] Result: {result}") return result def square_root(a): From 002525d9536e07ee3e5844683d416385dd4521b3 Mon Sep 17 00:00:00 2001 From: rahulnair307 Date: Fri, 27 Mar 2026 22:32:45 -0400 Subject: [PATCH 30/34] Add is_positive helper function :wq --- src/validator.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/validator.py b/src/validator.py index f46e870..643fec6 100644 --- a/src/validator.py +++ b/src/validator.py @@ -12,10 +12,6 @@ def validate_operation(op): valid_ops = ['+', '-', '*', '/'] return op in valid_ops -def validate_non_negative(n): - """Validate that a number is non-negative.""" - try: - num = float(n) - return num >= 0 - except (ValueError, TypeError): - return False +def is_positive(n): + """Check if a number is positive.""" + return n > 0 From b86c08c6ae0a0167ba2c047f9552fd5e2981d2f2 Mon Sep 17 00:00:00 2001 From: rahulnair307 Date: Fri, 27 Mar 2026 22:53:18 -0400 Subject: [PATCH 31/34] Checkpoint 3 DONE --- src/validator.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/validator.py b/src/validator.py index 643fec6..6a213e7 100644 --- a/src/validator.py +++ b/src/validator.py @@ -12,6 +12,14 @@ def validate_operation(op): valid_ops = ['+', '-', '*', '/'] return op in valid_ops +def validate_non_negative(n): + """Validate that a number is non-negative.""" + try: + num = float(n) + return num >= 0 + except (ValueError, TypeError): + return False + def is_positive(n): """Check if a number is positive.""" return n > 0 From 73e2d6a87e54ef0a631cf3d73bdf111cf7a0d82a Mon Sep 17 00:00:00 2001 From: rahulnair307 Date: Fri, 27 Mar 2026 23:02:49 -0400 Subject: [PATCH 32/34] Add temporary comment --- src/validator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/validator.py b/src/validator.py index 6a213e7..ea553e4 100644 --- a/src/validator.py +++ b/src/validator.py @@ -1,4 +1,5 @@ """These are the validation functions for the calculator inputs and are used in the main calculator logic before the operations are performed.""" +# temporary comment for CheckPoint 4 def validate_number(value): """Validate that value can be converted to a number.""" try: From 2879627fe63bb56de6c1bcd4da1f23628930ffd3 Mon Sep 17 00:00:00 2001 From: rahulnair307 Date: Fri, 27 Mar 2026 23:13:27 -0400 Subject: [PATCH 33/34] Checkpoint 5 done From 525e6c49a46d031edf0101df8850b5c0823b5ddd Mon Sep 17 00:00:00 2001 From: rahulnair307 Date: Sat, 28 Mar 2026 00:31:58 -0400 Subject: [PATCH 34/34] LEARNINGS-rnair124.md file has been added --- LEARNINGS-rnair124.md | 52 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 LEARNINGS-rnair124.md diff --git a/LEARNINGS-rnair124.md b/LEARNINGS-rnair124.md new file mode 100644 index 0000000..d4751de --- /dev/null +++ b/LEARNINGS-rnair124.md @@ -0,0 +1,52 @@ +Checkpoint 1 + Commands Used: + git add src/calculator.py + git commit -m “fix” + git add src/validator.py + git commit -m “update” + + I learned how to use the staging area to control what goes into each commit. + +Checkpoint 2 + Commands Used: + git log –oneline + git revert + + I learned how to undo a commit without deleting it from history using git revert. + +Checkpoint 3 + Commands Used: + git switch main + git commit -m “Add is_positive helper function” + git cherry-pick + + I learned how to move a commit from one branch to another using cherry-pick. + +Checkpoint 4 + Commands Used: + git reflog + git branch -D experiment/rnair124 + git merge recovered/rnair124 + + I learned how to recover lost work using git reflog. + +Checkpoint 5 + Commands Used: + git remote add upstream + git merge –ff-only upstream/main + git rebase main + git push –force-with-lease + + I learned how to sync my branch with the upstream repository and rebase my changes. + +Checkpoint 6 + Commands Used: + git log main..HEAD –oneline + git rebase -i main + git push –force-with-lease + + I learned how to clean up commit history using interactive rebase. + +Checkpoint 7 + + I learned how to review teammates’ code and provide meaningful feedback to other peoples code through pull requests. \ No newline at end of file