Last updated: October 4, 2026

Bahasa Indonesia | English

Learning objectives

After completing this codelab, students will be able to:

Preparation

1. Branching model

One branch, one purpose:

BranchRoleRule
mainAlways releasable, protectedNo direct commits; release only
developWeekly feature integrationDefault target of all pull requests
feature/*Daily single-feature workShort-lived (< 3 days), branched from develop
fix/*Quick fixes + testsInclude reproduction steps in the issue
main      -> always releasable, protected
develop   -> weekly feature integration
feature/* -> daily work, short-lived
fix/*     -> quick fixes + tests

2. Quality commits

One commit = one logical change that can be reviewed and reverted:

good: feat(notes): validate empty title + test
good: fix(auth): refresh token before one retry
bad: fix bug / update / final fix for real

Use the type(scope): short description format with types feat, fix, refactor, test, docs, chore.

3. Anatomy of a pull request

Small PRs get reviewed fast; huge PRs scare reviewers. A review-ready PR must have:

4. Issue tracking

Every PR starts from a clear issue and closes it automatically:

issue #42 -> branch fix/42-login-crash
  -> small commits -> PR "Closes #42"
  -> review -> merge -> issue closed

1. Audit your history

Run inside your Week 5–7 project repository:

git log --oneline -15
git branch -a
git status

Flag problems: direct commits to main, fix bug/update messages, branches older than 1 week, or untracked files that should be committed or ignored.

2. Create a proper working branch

git checkout develop
git pull origin develop
git checkout -b feat/notes-validation
# make one small change ...
git add -p
git commit -m "feat(notes): validate empty title + test"
git push -u origin feat/notes-validation

Use git add -p so each commit holds exactly one logical change, not every touched file.

3. Rewrite one bad commit (simulation)

Create a before/after table in docs/review-checklist.md: rewrite 3 of your old commit messages into the conventional format with reasons. Example: fix bug → fix(notes): prevent saving empty titles + test (clear what, where, and the proof).

1. Open a small PR

From the feat/notes-validation branch, open a PR to develop with this template:

Title: feat(notes): validate empty title + test
Problem: users can save notes without a title.
Solution: validation in the use case + error in UI.
Test steps: 1) add an empty note -> error shows.
  2) flutter test test/validate_note_test.dart
Closes #12

2. Fifteen-minute peer review

Swap PRs with another pair. Each reviewer must produce at least:

3. Good comments

Use the observation → impact → concrete proposal pattern:

Weak: "this code is bad, fix it"
Good: "This build function is 60 lines with 3 jobs.
  Suggestion: extract validation to core/validate.dart.
  Reason: unit-testable without widgets."

Be tough on code and kind to humans. Every comment must be actionable without follow-up questions.

4. Follow up and merge

Authors fix the findings, request re-review, then merge — squash when the intermediate commits are messy. Make sure the issue auto-closes and the branch is deleted after merging so the branch list stays short.

1. Clean up with machines

Run these three commands in your project; all must be green before requesting review:

flutter analyze
dart format --set-exit-if-changed .
flutter test

Reading the output: unused_import → remove dead imports; prefer_const → use const for cheaper rebuilds; must_be_immutable → widgets must stay immutable. Fix errors first, then warnings, then info.

2. Reject dirty PRs automatically (CI)

Create a minimal .github/workflows/ci.yml so machines reject dirty PRs before humans read them:

name: ci
on: [pull_request]
jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: subosito/flutter-action@v2
      - run: flutter analyze
      - run: flutter test

3. Assess mid-semester readiness

Fill in docs/review-checklist.md: proven feature-first structure (the three Week 7 sterility greps), clean analyze, green tests, small PRs + clear commits, a complete README + screenshots + run guide, and every review comment addressed. What counts is not feature quantity but a foundation trusted for part two.

The AI role in this codelab

AI may be a fast, thorough first reviewer, but you decide. A wrong AI review (flagging a non-existent bug, proposing an architecture-violating pattern) is more dangerous than no review.

AI Prompt Challenge

Ask an AI coding assistant to review your PR with this prompt:

Review this Flutter PR as a senior Flutter dev.
Context: feature-first Clean Architecture
(presentation -> domain <- data),
Riverpod, GoRouter, SQLite + Dio.
Focus: correctness, architecture, tests. Ignore style.
Give the top 5 findings + severity (blocker/suggestion)
+ rationale + proposed code fix.

AI Verification Checklist

Before applying any AI suggestion, verify and record it in docs/ai-review-vs-decision.md:

Refactoring Challenge

  1. Apply every request changes comment from your peer reviewer, then request re-review until approve. Never merge a PR with pending requested changes.
  2. Move every repeated style finding into automation: tidy up with dart format and make CI reject dirty PRs.
  3. Split one oversized PR (> 300 lines) into 2–3 small sequential PRs, each reviewable in < 15 minutes.

Testing: an unrun review is invalid

Every behavior-changing PR must include test evidence:

flutter analyze
flutter test
# + 5-minute manual test per feature + screenshots

Common errors and fixes

SymptomCommon causeFix
An 800-line PR never gets reviewedMany features merged into one PRSplit per feature; one PR < 300 lines
Repeated merge conflictsLong-lived branches, rare syncsRebase/pull develop daily; branches < 3 days
Reviews only debate spacingNo formatter/CIRequire dart format + analyze CI
Approved but bugs slip throughReview without pulling + testingReviewers must check out, run, and test manually
AI advice breaks architectureAI accepted raw without verificationReject with reason + grep/test evidence

Self-verification checklist

Mini project / Industry Challenge

Continue your portfolio repository (extend the Week 5–7 project, not a new project) and prove collaboration discipline:

  1. Create at least 1 issue + 1 small PR merged through peer review (feature/* → develop).
  2. Include the complete PR template: problem, solution, test steps, and screenshots.
  3. Green-machine evidence: flutter analyze + flutter test results in the README.
  4. Document the AI prompt, the proposal-vs-final-decision table, and the rejection/acceptance evidence in docs/.
  5. Push to the portfolio folder 08-week-8-mid-project-review/ with docs/, README.md, and screenshots/. The README explains the mid-semester status, the issue/PR map, main features, tech stack, how to run, and the result achieved.

Reflection

Supporting references