INFRASTRUCTURE LEARNINGINFRASTRUCTURE LEARNING
インフラ大全インフラ大全IT INFRASTRUCTURE / LEARNING
Infrastructure learning guide
Find a lesson or lab/

Esc to close · Search terms stay on your device

LEARNING日本語

GITHUB · FOUNDATIONS

GitHub pull request basics: review a SQL diff, checks and merge

A pull request (PR) proposes integrating changes into another branch. Follow a small SQL edit that excludes a previously selected report. Read its effect, then distinguish human review, automated checks and merging—all within this lesson.

What you will learn

Explain the effect on three stipulated rows and identify which change was reviewed, tested and integrated.

Prerequisite

A commit records history; a branch names a position in it. SQL expresses a data query. The WHERE and AND conditions used here are explained below.

Start by reading what changed

Imagine PR #42 in the fictional repository demo-acme/report-infra, proposing feature/jp-report-filter into main. Base is the destination; head is the proposed branch. No GitHub account or PR is created.

A diff for sql/monthly_report.sql: − removes a line; + adds one
 SELECT report_id, report_month
 FROM reports
-WHERE approval = 'approved';
+WHERE approval = 'approved'
+  AND region = 'JP';

SELECT names output columns, FROM names the table, and WHERE filters rows. Previously a row needed approval = approved; it now also needs region = JP. AND requires both predicates. This changes a read query, not the stored rows.

Trace the effect on three rows

What changes when JP is required as well as approved?
ReportapprovalregionBeforeAfter
R-AapprovedJPIncludedIncluded
R-BapprovedUSIncludedExcluded
R-CpendingJPExcludedExcluded

R-B is newly excluded. R-A satisfies both predicates; R-C was never approved. The expected sets are {R-A, R-B} before and {R-A} after. All rows are stipulated to have report_month = 2026-09, but the SQL has no month filter. It also has no ORDER BY, so output order is unspecified.

A useful review question is: “Will excluding R-B break a consumer that needs US reports?” A small diff can have a large effect. Real data would also require checking NULL handling, string comparison, month scope and downstream consumers. First explain the effect on these three rows.

Separate human review from automated checks

Where to look in a pull request
ViewQuestion to answer
Files changedWhich lines changed, and how?
ConversationWhat purpose, questions and decisions were recorded?
CommitsWhich revisions form the proposal?
ChecksWhich validations were reported, and for which revision?

A review can Comment, Approve or Request changes. These are human decisions, separate from an automated check. A syntax check cannot establish agreement to exclude US rows. Checks may also come from integrations other than Actions.

Required approvals, checks and bypasses depend on repository rules, permissions and plan. An approval alone does not necessarily allow merging. When more changes arrive, review the current diff and whether the earlier approval still applies; automatic dismissal of stale approval is configurable.

Track which revision was tested

From proposal to integration: review and checks are separate
B → H
Compare the original and proposed change

B is the common ancestor; H is the proposed head. Here main is also B.

REVIEW / H
Review purpose and impact

A person evaluates the diff and whether excluding R-B is intended.

CHECK / T
Check the proposed integration

T labels a synthetic test-merge revision, distinct from head H.

MERGE / M
Integrate after checking requirements

Recheck the current diff, reviews and checks; label the result M.

AFTER MERGE
Verify artifact, delivery and behavior

Build from M, then verify the destination and application behavior separately.

Arrows indicate stages to consider, not successful executions. B, H, T and M are teaching labels, not actual commit hashes.

A GitHub PR normally shows changes from the merge base—the common ancestor—to the proposed head. B is fixed as that ancestor here. The current base-branch tip need not equal the comparison base. If main advances, check what was compared and tested.

For an open, mergeable PR, a pull_request workflow using the default ref tests a generated merge revision, labelled T here. Distinguish GITHUB_SHA from github.event.pull_request.head.sha. A different checkout target or event can test something else.

Updating the proposal or main can change the test target. Evidence about T cannot simply be relabelled as evidence about a future integration M or a deployed artifact.

What remains after merging?

  1. Identify integrated revision M; merge commits, squash and rebase produce history differently.
  2. Build an artifact from M and record its input. report-sql-bundle@M is a fictional name here.
  3. Verify that the intended artifact reached staging; integration into main alone does not deploy it.
  4. Read from the destination and verify expected behavior. Transfer success alone does not establish business correctness.

Check your reading of the change

Choose an option to see the result and explanation.

Which row is excluded after adding region = JP to the approved filter?
Read the answer and reason

Answer: R-B: approved / US. · R-B qualified before, but fails the new region predicate.

More changes are pushed after H was approved. What should you check next?
Read the answer and reason

Answer: The current diff, approval validity and the latest tested revision. · An earlier judgment may not cover the new changes; automatic dismissal depends on configuration.

How do test-merge T and proposed head H relate in this example?
Read the answer and reason

Answer: They are distinct; also verify the revision actually checked out. · Distinguish the default merge ref of an open mergeable PR from head.sha.

What does a passing check alone leave unverified?
Read the answer and reason

Answer: That the integrated artifact was delivered and behaves as users expect. · Build, delivery and behavior require evidence from their respective stages.

Check, then explain in your own words

  1. Explain which row the added AND predicate excludes.
  2. Write one requirement question a reviewer should ask.
  3. Distinguish proposed H, tested T and integrated M.
Check your understanding: “Approved and checks passed—users have the change now.” Is that established?

No. Integration, build, delivery and user-visible behavior need separate checks.

A review decision and a check of a specific revision do not establish completion of later stages.

Sources and conditions checked

Primary references are collected here with their scope, conditions and corresponding sections. Independent expert review and live-environment validation have not been performed.