Skip to content

fix: reject recursive gateway network authority - #27

Merged
seonghobae merged 45 commits into
test/pg-erd-post-commit-reset-v1from
fix/network-authority-self-loop-v1
Sep 16, 2026
Merged

seonghobae merged 45 commits into
test/pg-erd-post-commit-reset-v1from
fix/network-authority-self-loop-v1

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Bounded authority

This PR owns gateway Admin Config / Runtime Isolation invariants for upstream TCP network authority only. It does not add product authentication/business routing, service discovery, Keyverse identity, Wardnet/EgressWeave verdicts, certificate authority, retry/failover policy, or consumer source mutation. Repository-wide TRACEABILITY and docs/product-technical-gap-baseline.md remain dedicated #61 authority.

Parent succession

Canonical parent #25 exact 1a369e144ce8021595cebe388ab042e369875229 reached terminal-success CI/Supply and was normally merged as e8d86b9c90bded49d48ee5e03535a45c5dab5837. Ordinary two-parent adoption 6268351e7fd79a5fb0cf19000b18798bc7aa9af9 made current #25 an ancestor; 50bf0e124d188d6f4286f0947659f3f567191d16 restored current-parent TEST_STRATEGY truth while preserving the bounded child delta. No force-push or destructive rebase is used.

RED → causal repairs

  • Direct unspecified authority: RED 49d2a252ea6d040ed163c90147263cbd3503209b → repair 584e6b898e5c796b076b46bfc6331f4a1b2c205a.
  • IPv4-mapped unspecified authority: RED 804170e9be22a9d8da47842e272ae9e37d101656 → canonicalization repair 8a6b8da2a90b9ab3310fbc99d1d4e47d9ac496fe.
  • RFC 9293 TCP remote authority: RED 176b1d9f1fae963b6b2cff9bc96314d62e715a14 → repair 5a0f1eccad2bf85923f5b82d6c09358def1866f9; exact-error fixture 5d6b79028cd5dee173216fd6bbd83d526b0dde70.
  • Docs-to-code repair 00046c7bc4c48d737a2ef9c243315f55268475b3 limits same-port admission language to concrete non-aliased unicast authorities.
  • Hosted formatter RED on 00046c7...: CI 35031683741 had successful oci-runtime/load-contract and successful Supply Chain but failed Rust 1.98 formatting. Current exact 84a4df0bb162673f602dac95e9ded7eaa0e23582 preserves the benign intervening fixture formatting and applies the exact hosted multiline layout for the long UnspecifiedUpstreamAddress error attribute. No validation semantics, error text, policy, or fixture values changed.

Primary references remain RFC 4291, RFC 9293 §3.9.1.1 MUST-46, RFC 919, and stable Rust canonicalization/broadcast/multicast predicates.

Current exact evidence

Current exact is 84a4df0bb162673f602dac95e9ded7eaa0e23582; configured base remains 1a369e144ce8021595cebe388ab042e369875229. Effective paths remain TEST_STRATEGY.md, src/edge_contract.rs, src/migration_admin.rs, tests/network_authority_self_loop_contract.rs, and tests/upstream_unicast_authority_contract.rs.

CI 35047995796 is terminal SUCCESS at this exact. test passed checkout identity, Rust 1.98 formatting, all-target compile/test, strict Clippy, warning-denied rustdoc, pinned coverage tooling, owned-production coverage enforcement and dependency-lock verification; load-contract passed generic and routed pg-erd traffic/latency evidence; oci-runtime passed dual-profile non-root/read-only runtime checks. Supply Chain 35047995901 is terminal SUCCESS and passed dependency audit, candidate image builds, SPDX SBOM generation, image scans, exact-source evidence binding and artifact upload.

All review threads are resolved. Independent CodeRabbit current-head review reports Merge Risk Minimal and no actionable findings. Owner reviews remain COMMENT-only; there is no independent APPROVED review in the current review inventory. No self-approval or governance bypass is authorized, so normal integration waits only for then-live required governance rather than for additional source or execution repair.

Child succession

Direct child #107 remains Draft at 4bbd8a91dbd94a7d8e71106f81756f1a03b07c4f because its merge-base is historical 00046c7... and it is ahead 11 / behind 2 relative to this exact. After #27 normally integrates, #107 must adopt the current parent by ordinary/non-force reconciliation, preserve only its four SNI HostName authority paths, and reacquire exact execution/review/governance. Historical #107 runs do not transfer.

No protected merge, immutable release, parity, shadow/canary, cutover, rollback, or legacy-removal credit is claimed.

@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: fa3efe02-db88-4aa9-a2a9-5a3fae6c2571

📥 Commits

Reviewing files that changed from the base of the PR and between c2dfbbc and 84a4df0.

📒 Files selected for processing (1)
  • src/edge_contract.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/edge_contract.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

게이트웨이 소유 트래픽 및 메트릭 리스너와 업스트림 transport authority의 중복 검증을 추가합니다. canonical 업스트림 주소의 비특정 및 비유니캐스트 주소도 거부합니다. generic 및 pg-erd 구성과 실행 경로를 테스트합니다.

Changes

게이트웨이 권한 분리

Layer / File(s) Summary
권한 충돌 및 주소 검증 계약
src/edge_contract.rs
리스너 충돌, 메트릭 리스너 충돌, 비특정 주소, 비유니캐스트 주소 오류 variant를 추가했습니다. canonical 주소와 기존 authority 중복 모델을 사용해 주소 충돌 및 별칭을 검증합니다.
마이그레이션 transport 검증 연동
src/migration_admin.rs
업스트림별 transport 검증에서 트래픽 리스너와 메트릭 리스너의 authority 중복 검사를 호출합니다. 오류는 UpstreamConfiguration 경로로 전파됩니다.
구성 및 실행 경로 계약 테스트
tests/network_authority_self_loop_contract.rs, tests/upstream_unicast_authority_contract.rs, TEST_STRATEGY.md
generic 및 pg-erd 구성에서 정확한 주소, wildcard, dual-stack, IPv4-mapped 별칭, 비특정 주소, 브로드캐스트 및 멀티캐스트 주소의 처리 결과를 검증합니다. 동일 포트의 다른 구체적 유니캐스트 주소는 허용되는지 확인합니다. build_proxy 재검증과 바이너리 시작 전 실패도 검증합니다.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant ConfigSource
  participant GatewayConfig
  participant MigrationAdmin
  participant GatewayBinary

  ConfigSource->>GatewayConfig: 구성 로드 및 validate
  GatewayConfig->>GatewayConfig: 업스트림 authority 및 canonical 주소 검사
  GatewayConfig-->>ConfigSource: 충돌 또는 주소 오류 반환
  ConfigSource->>MigrationAdmin: pg-erd 업스트림 검증
  MigrationAdmin->>MigrationAdmin: listener 및 metrics_listener와 비교
  MigrationAdmin-->>GatewayBinary: 검증 결과 전파
  GatewayBinary-->>ConfigSource: 오류 발생 시 리스너 활성화 전 종료
Loading

Merge Risk: ⚪ Minimal · up to 84a4d

The configured upstream validation rejects the intended recursive and non-unicast authorities through both configuration types. No concrete merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 4 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 게이트웨이의 재귀적 네트워크 권한을 거부하는 주요 변경 사항을 명확하고 간결하게 설명합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/network-authority-self-loop-v1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor Author

Successor carryover check — exact head e8e5aea0218dc6caf74fa0b5d7335552530c21d8

Current branch is now ordinary ahead 16 / behind 0 from parent #25@f1f84c6130356134755a5eb48409bf9a485395c8, and the shared validate_upstream_authority_separation plus PgErdMigrationConfig call site have been re-applied. This is useful forward progress.

하지만 current compare에는 src/edge_contract.rs, src/migration_admin.rs 두 production 파일만 있고, 본문이 보존 대상으로 명시한 generic/pg-erd collision RED, IPv4 wildcard, IPv6 dual-stack ambiguity, distinct-concrete same-port acceptance 및 두 composition-root startup regression은 없습니다. Production-only 재적용은 verified complete successor carryover가 아닙니다.

Draft를 유지하고 historical valid tests를 current API에 맞게 복원한 뒤 exact-head CI/Supply Chain을 결속해야 합니다. 현재 CI 34229160314는 pending, Supply Chain 34229160403은 in progress입니다. 이전 head의 cancelled runs나 historical GREEN은 이전하지 않습니다.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Current exact-range owner technical sweep on final #25 f1f84c6130356134755a5eb48409bf9a485395c8 → 4fd3d1a63e72260519ee415e968db383a4e16415 finds no remaining actionable source/documentation defect in the four effective paths. The child reuses the existing socket-authority overlap model, preserves pg-erd fixed upstream-name/error precedence, keeps distinct concrete same-port authorities admitted, revalidates direct-Serde construction at build_proxy(), and exercises compiled fail-closed startup for both composition roots. The current fixture also quotes every interpolated socket authority, so the IPv6 dual-stack case reaches SocketAddr validation rather than failing in YAML parsing. Hosted CI/Supply Chain are still in progress; this COMMENT is technical evidence only, not self-approval or independent APPROVED governance.

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Current-exact owner technical sweep (COMMENT only; not self-approval or organization-governance credit): RFC 9293 §3.9.1.1 MUST-46 requires TCP active OPEN to reject an invalid remote IP address, explicitly including broadcast or multicast destinations. Predecessor 8a6b8da... rejected zero-port, unspecified and recursive listener aliases but still admitted IPv4 multicast, IPv4 limited broadcast, IPv6 multicast, and IPv4-mapped multicast/broadcast authorities. Test-first 176b1d9... adds generic and pg-erd runtime RED cases for those five forms. Minimal production repair 5a0f1ec... reuses the existing canonical IP value and rejects only IPv4 broadcast/multicast plus IPv6 multicast via NonUnicastUpstreamAddress; loopback/private/link-local/documentation and other concrete unicast addresses remain unaffected. Exact 5d6b790... pins that specific error reason in both config roots. Fresh base compare is 1a369e... -> 5d6b790..., ahead 42 / behind 0, five effective paths. Hosted exact-head formatting/compile/test/coverage/load/OCI/Supply evidence and independent governance remain required.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review current exact 5d6b79028cd5dee173216fd6bbd83d526b0dde70 against configured base 1a369e144ce8021595cebe388ab042e369875229, with particular attention to RFC 9293 MUST-46 non-unicast TCP destination validation, IPv4-mapped canonicalization, and whether the new five-path effective range preserves existing listener-authority semantics. Treat earlier-head findings and workflow receipts as predecessor evidence only.

@seonghobae
seonghobae marked this pull request as ready for review September 15, 2026 22:26
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/pingora-gateway"
base="1a369e144ce8021595cebe388ab042e369875229"
head="5d6b79028cd5dee173216fd6bbd83d526b0dde70"
predecessor="8a6b8da2a90b9ab3310fbc99d1d4e47d9ac496fe"

echo '== Live pull request metadata =='
gh pr view 27 --repo "$repo" \
  --json number,state,isDraft,headRefName,headRefOid,baseRefName,baseRefOid,mergeable,reviewDecision,statusCheckRollup

echo '== Exact ancestry =='
printf 'merge-base='
git merge-base "$base" "$head"
git merge-base --is-ancestor "$base" "$head"
echo "base_is_ancestor=$?"
printf 'ahead='
git rev-list --count "$base..$head"
printf 'behind='
git rev-list --count "$head..$base"
git merge-base --is-ancestor "$predecessor" "$head"
echo "predecessor_is_ancestor=$?"

echo '== Effective changed paths and whitespace =='
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
git diff --check "$base" "$head" --

echo '== Follow-up commits and paths =='
git log --format='%H %s' --reverse "${predecessor}..${head}"
git diff --name-status "$predecessor" "$head"
git diff --unified=24 "$predecessor" "$head" -- \
  TEST_STRATEGY.md \
  src/edge_contract.rs \
  src/migration_admin.rs \
  tests/network_authority_self_loop_contract.rs

echo '== Validation source maps =='
ast-grep outline src/edge_contract.rs --items all --type function,enum,impl --match 'GatewayConfig|GatewayConfigError|UpstreamConfig|validate_upstream_authority_separation|socket_authorities_overlap'
ast-grep outline src/migration_admin.rs --items all --type function,impl --match 'PgErdMigrationConfig|validate_transport_authority|build_proxy'
ast-grep outline tests/network_authority_self_loop_contract.rs --items all --type function

echo '== Destination and listener-authority validation contexts =='
rg -n -C 28 --type rust '\b(to_canonical|is_unspecified|is_multicast|is_broadcast|UnspecifiedUpstreamAddress|NonUnicast|validate_upstream_authority_separation|socket_authorities_overlap)\b' \
  src/edge_contract.rs src/migration_admin.rs

echo '== Contract test cases =='
rg -n -C 20 --type rust '(0\.0\.0\.0|\[::\]|::ffff|multicast|broadcast|Unicast|Unspecified|NonUnicast)' \
  tests/network_authority_self_loop_contract.rs

echo '== Exact five-path diff =='
git diff --unified=16 "$base" "$head" -- \
  TEST_STRATEGY.md \
  src/edge_contract.rs \
  src/migration_admin.rs \
  tests/network_authority_self_loop_contract.rs

echo '== Exact-head workflow state =='
gh pr checks 27 --repo "$repo" || true
echo '== Review receipts =='
gh pr view 27 --repo "$repo" --json reviews \
  --jq '.reviews[] | {author: .author.login, state: .state, commit: .commit.oid, submittedAt: .submittedAt}' || true

Length of output: 13007


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/pingora-gateway"
base="1a369e144ce8021595cebe388ab042e369875229"
head="5d6b79028cd5dee173216fd6bbd83d526b0dde70"

echo '== edge_contract imports and validation contexts =='
sed -n '1,145p' src/edge_contract.rs
rg -n -C 26 --type rust '\b(socket_authorities_overlap|validate_upstream_authority_separation|fn validate\(&self\)|to_canonical|is_unspecified|is_broadcast|is_multicast|NonUnicastUpstreamAddress)\b' src/edge_contract.rs

echo '== pg-erd validation and construction contexts =='
rg -n -C 28 --type rust '\b(validate_transport_authority|build_proxy|self\.validate\(\)|UpstreamConfiguration)\b' src/migration_admin.rs

echo '== all non-unicast contract cases =='
cat -n tests/upstream_unicast_authority_contract.rs
echo '== self-loop contract cases relevant to canonicalization and validation =='
rg -n -C 18 --type rust '(::ffff|0\.0\.0\.0|\[::\]|UnspecifiedUpstreamAddress|NonUnicastUpstreamAddress|build_proxy)' tests/network_authority_self_loop_contract.rs

echo '== all uses of NonUnicastUpstreamAddress =='
rg -n -C 6 --type rust '\bNonUnicastUpstreamAddress\b' .

echo '== effective documentation diff =='
git diff --unified=24 "$base" "$head" -- TEST_STRATEGY.md

echo '== exact-head checks =='
gh pr checks 27 --repo "$repo" || true
echo '== exact-head reviews =='
gh pr view 27 --repo "$repo" --json reviews \
  --jq '.reviews[] | {author: .author.login, state: .state, commit: .commit.oid, submittedAt: .submittedAt}' || true

Length of output: 66759


🤖 web_search executed:

RFC 9293 section 3.8.1 MUST-46 TCP destination broadcast multicast unicast address requirement

Length of output: 5778


🏁 Script executed:

#!/bin/bash
set -euo pipefail

url="https://www.rfc-editor.org/rfc/rfc9293.txt"
curl --fail --silent --show-error --location "$url" |
  awk '
    /MUST-46/ { start=NR-8; end=NR+12 }
    NR >= start && NR <= end { printf "%d:%s\n", NR, $0 }
  '

Length of output: 3021


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="1a369e144ce8021595cebe388ab042e369875229"
head="5d6b79028cd5dee173216fd6bbd83d526b0dde70"
predecessor="8a6b8da2a90b9ab3310fbc99d1d4e47d9ac496fe"

echo '== Remaining pg-erd authority validation =='
sed -n '180,230p' src/migration_admin.rs

echo '== Focused implementation and regression diffs =='
git diff --unified=30 "$predecessor" "$head" -- \
  src/edge_contract.rs \
  tests/upstream_unicast_authority_contract.rs

echo '== Five-path range details =='
git diff --numstat "$base" "$head"
git diff --check "$base" "$head" --

Length of output: 13574


🏁 Script executed:

#!/bin/bash
set -euo pipefail

curl --fail --silent --show-error --location \
  "https://www.rfc-editor.org/rfc/rfc9293.txt" |
  grep -n -C 10 'MUST-46' |
  head -n 45

Length of output: 3177


@seonghobae I reviewed exact head 5d6b79028cd5dee173216fd6bbd83d526b0dde70 against live base 1a369e144ce8021595cebe388ab042e369875229. I used the existing PR guidance to limit the review to the live base-to-head range.

I found no implementation finding.

The merge base is 1a369e.... The head is 42 commits ahead and 0 commits behind. The effective range has these five paths only:

  • TEST_STRATEGY.md
  • src/edge_contract.rs
  • src/migration_admin.rs
  • tests/network_authority_self_loop_contract.rs
  • tests/upstream_unicast_authority_contract.rs

The new validation satisfies the RFC 9293 MUST-46 requirement. RFC 9293 states that a TCP implementation “MUST reject as an error a local OPEN call for an invalid remote IP address (e.g., a broadcast or multicast address).” UpstreamConfig::validate() rejects:

  • IPv4 multicast addresses with Ipv4Addr::is_multicast().
  • The IPv4 limited broadcast address with Ipv4Addr::is_broadcast().
  • IPv6 multicast addresses with Ipv6Addr::is_multicast().

The code calls IpAddr::to_canonical() before these checks. Therefore, IPv4-mapped forms use the matching IPv4 classification. The tests cover mapped IPv4 multicast and mapped limited broadcast, plus native IPv4 multicast, native limited broadcast, and IPv6 multicast.

The existing unspecified-address behavior remains correct. Canonicalization causes [::ffff:0.0.0.0] to classify as unspecified before the new non-unicast check.

The listener-authority behavior remains bounded:

  • GatewayConfig::validate() validates each upstream and then compares it only with listener and metrics_listener.
  • PgErdMigrationConfig::validate_transport_authority() calls both upstream.validate() and validate_upstream_authority_separation(self.listener, self.metrics_listener, upstream).
  • PgErdMigrationConfig::build_proxy() calls self.validate(). Direct deserialization cannot bypass either validation path.
  • The new non-unicast validation does not change socket_authorities_overlap() or add route, discovery, or product-domain authority semantics.

The exact-head CI jobs test, load-contract, and oci-runtime, plus Supply Chain candidate-evidence, are pending. Earlier reviews and workflow results target predecessor commits and do not apply to this head. I did not execute repository code or tests in this inspection environment.


🧠 Learnings used
Learnt from: seonghobae
URL: https://github.com/ContextualWisdomLab/pingora-gateway/pull/27

Timestamp: 2026-09-15T20:24:38.846Z
Learning: For pull request `#27` in `ContextualWisdomLab/pingora-gateway`, review the effective delta against the live configured GitHub PR base SHA. Do not use a historical ancestor as the comparison base when the configured base has advanced.

You are interacting with an AI system.

@seonghobae
seonghobae marked this pull request as draft September 15, 2026 22:31
@seonghobae
seonghobae marked this pull request as ready for review September 15, 2026 22:31
@seonghobae
seonghobae marked this pull request as draft September 15, 2026 22:34

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Current-exact owner technical sweep (COMMENT only; not self-approval or organization-governance credit): 00046c7bc4c48d737a2ef9c243315f55268475b3 is ahead-only one commit from source/test exact 5d6b790... and changes only TEST_STRATEGY.md (+1/-1). The documentation now matches the implemented authority contract: recursive listener aliases remain rejected, tests/upstream_unicast_authority_contract.rs separately pins IPv4 limited broadcast, IPv4/IPv6 multicast, and mapped broadcast/multicast as invalid remote TCP authority after canonicalization, while distinct concrete non-aliased unicast same-port addresses remain admitted. The prior 5d6b790... source/test review remains historical; fresh exact-head hosted CI/Supply and independent current-head review are required.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review current exact 00046c7bc4c48d737a2ef9c243315f55268475b3 against configured base 1a369e144ce8021595cebe388ab042e369875229. The source/test delta through 5d6b790... implements RFC 9293 non-unicast remote-authority rejection; the final 00046c7... commit only makes TEST_STRATEGY.md code-current with that acceptance boundary. Treat prior-head workflow/review receipts as historical.

@seonghobae
seonghobae marked this pull request as ready for review September 15, 2026 22:34
@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/pingora-gateway"
base="1a369e144ce8021595cebe388ab042e369875229"
head="00046c7bc4c48d737a2ef9c243315f55268475b3"
predecessor="5d6b79028cd5dee173216fd6bbd83d526b0dde70"

echo '== Live pull request metadata =='
gh pr view 27 --repo "$repo" \
  --json number,state,isDraft,headRefName,headRefOid,baseRefName,baseRefOid,mergeable,reviewDecision,statusCheckRollup

echo '== Requested commit and ancestry =='
git rev-parse "${head}^{commit}"
printf 'merge-base='
git merge-base "$base" "$head"
git merge-base --is-ancestor "$base" "$head"
echo "base_is_ancestor=$?"
git merge-base --is-ancestor "$predecessor" "$head"
echo "predecessor_is_ancestor=$?"
printf 'ahead='
git rev-list --count "$base..$head"
printf 'behind='
git rev-list --count "$head..$base"

echo '== Effective changed paths and whitespace =='
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
git diff --check "$base" "$head" --

echo '== Final commit identity and changed paths =='
git show --no-ext-diff --format=fuller --name-status "$head"
echo '== Final documentation-only diff =='
git diff --unified=30 "$predecessor" "$head" -- TEST_STRATEGY.md
echo '== Source changes after predecessor =='
git diff --name-status "$predecessor" "$head" -- src tests

echo '== Relevant source outlines =='
ast-grep outline src/edge_contract.rs --items all --type function,enum,impl --match 'GatewayConfig|GatewayConfigError|UpstreamConfig|validate_upstream_authority_separation|socket_authorities_overlap'
ast-grep outline src/migration_admin.rs --items all --type function,impl --match 'PgErdMigrationConfig|validate_transport_authority|build_proxy'
ast-grep outline tests/upstream_unicast_authority_contract.rs --items all --type function
ast-grep outline tests/network_authority_self_loop_contract.rs --items all --type function

echo '== Validation and test contexts =='
rg -n -C 20 --type rust '\b(to_canonical|is_unspecified|is_multicast|is_broadcast|NonUnicastUpstreamAddress|validate_upstream_authority_separation|validate_transport_authority|build_proxy)\b' \
  src/edge_contract.rs src/migration_admin.rs tests/upstream_unicast_authority_contract.rs tests/network_authority_self_loop_contract.rs

echo '== Exact-head workflow state and reviews =='
gh pr checks 27 --repo "$repo" || true
gh pr view 27 --repo "$repo" --json reviews \
  --jq '.reviews[] | {author: .author.login, state: .state, commit: .commit.oid, submittedAt: .submittedAt}' || true

Length of output: 30989


🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/pingora-gateway"
head="00046c7bc4c48d737a2ef9c243315f55268475b3"

echo '== Source and test outlines =='
ast-grep outline src/edge_contract.rs --items all --type function,enum --match 'GatewayConfig|GatewayConfigError|UpstreamConfig|validate_upstream_authority_separation|socket_authorities_overlap'
ast-grep outline src/migration_admin.rs --items all --type function --match 'PgErdMigrationConfig|validate_transport_authority|build_proxy'
ast-grep outline tests/upstream_unicast_authority_contract.rs --items all --type function
ast-grep outline tests/network_authority_self_loop_contract.rs --items all --type function

echo '== Upstream validation implementation =='
rg -n -C 28 --type rust '\b(to_canonical|is_unspecified|is_multicast|is_broadcast|NonUnicastUpstreamAddress|fn validate\(&self\)|validate_upstream_authority_separation|socket_authorities_overlap)\b' src/edge_contract.rs

echo '== Pg-erd validation boundary =='
rg -n -C 28 --type rust '\b(validate_transport_authority|build_proxy|self\.validate\(\)|UpstreamConfiguration)\b' src/migration_admin.rs

echo '== Non-unicast authority contract =='
cat -n tests/upstream_unicast_authority_contract.rs

echo '== Self-loop canonicalization and construction-boundary contract =='
rg -n -C 16 --type rust '(::ffff|0\.0\.0\.0|\[::\]|UnspecifiedUpstreamAddress|build_proxy|startup)' \
  tests/network_authority_self_loop_contract.rs

echo '== Exact-head workflow state =='
gh pr checks 27 --repo "$repo" || true
echo '== Exact-head review receipts =='
gh pr view 27 --repo "$repo" --json reviews \
  --jq '.reviews[] | {author: .author.login, state: .state, commit: .commit.oid, submittedAt: .submittedAt}' || true

echo '== Checkout identity =='
git rev-parse HEAD
git merge-base --is-ancestor "$head" HEAD
echo "requested_head_is_ancestor_of_checkout=$?"

Length of output: 38876


@seonghobae I reviewed exact head 00046c7bc4c48d737a2ef9c243315f55268475b3 against configured base 1a369e144ce8021595cebe388ab042e369875229.

I used the existing PR guidance to review the live configured base-to-head range.

The merge base is 1a369e.... The head is 43 commits ahead and 0 commits behind.

The effective range contains five paths:

  • TEST_STRATEGY.md
  • src/edge_contract.rs
  • src/migration_admin.rs
  • tests/network_authority_self_loop_contract.rs
  • tests/upstream_unicast_authority_contract.rs

I found no implementation or documentation finding.

Commit 00046c7... changes only TEST_STRATEGY.md. The updated text matches the code and contract tests:

  • UpstreamConfig::validate() first applies IpAddr::to_canonical().
  • It rejects canonical unspecified addresses.
  • It rejects IPv4 limited broadcast and IPv4 multicast.
  • It rejects IPv6 multicast.
  • Canonicalization applies the IPv4 rules to IPv4-mapped IPv6 forms.
  • tests/upstream_unicast_authority_contract.rs covers native IPv4 multicast, native limited broadcast, IPv6 multicast, and the mapped IPv4 multicast and broadcast forms.
  • Both GatewayConfig::from_yaml() and PgErdMigrationConfig::from_yaml() return the expected non-unicast validation error.

The listener-authority invariant remains separate and bounded to the traffic listener and metrics_listener. The documentation preserves this separation. It also correctly states that distinct concrete, non-aliased unicast addresses on the same port remain valid.

The exact-head CI jobs test, load-contract, and oci-runtime are pending. Supply Chain candidate-evidence is pending. Earlier workflow and review receipts are historical and do not apply to this head.

I did not execute repository code or tests in this inspection environment.


🧠 Learnings used
Learnt from: seonghobae
URL: https://github.com/ContextualWisdomLab/pingora-gateway/pull/27

Timestamp: 2026-09-15T20:24:38.846Z
Learning: For pull request `#27` in `ContextualWisdomLab/pingora-gateway`, review the effective delta against the live configured GitHub PR base SHA. Do not use a historical ancestor as the comparison base when the configured base has advanced.
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae
seonghobae marked this pull request as draft September 16, 2026 02:20
@seonghobae
seonghobae marked this pull request as ready for review September 16, 2026 02:20

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hosted CI 35031683741 exposed a source-local formatter RED on exact 00046c7bc4c48d737a2ef9c243315f55268475b3: test failed at cargo fmt --all -- --check while oci-runtime, load-contract, and Supply Chain were successful. The lane was returned to Draft before source movement. Exact c2dfbbc9e7af5026f3c194bf63a7153f758a9a48 applies only rustfmt's multiline trailing-comma layout in tests/upstream_unicast_authority_contract.rs; no policy, assertion, fixture data, or production behavior changes. Current head must obtain fresh execution and independent review before merge.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review current exact c2dfbbc9e7af5026f3c194bf63a7153f758a9a48 against configured base 1a369e144ce8021595cebe388ab042e369875229. The only delta from predecessor exact 00046c7bc4c48d737a2ef9c243315f55268475b3 is the hosted-rustfmt trailing-comma layout in tests/upstream_unicast_authority_contract.rs; do not transfer predecessor review credit to this head.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/pingora-gateway"
base="1a369e144ce8021595cebe388ab042e369875229"
head="c2dfbbc9e7af5026f3c194bf63a7153f758a9a48"
predecessor="00046c7bc4c48d737a2ef9c243315f55268475b3"

echo '== Live PR metadata =='
gh pr view 27 --repo "$repo" \
  --json number,state,isDraft,headRefName,headRefOid,baseRefName,baseRefOid,mergeable,reviewDecision,statusCheckRollup

echo '== Exact ancestry =='
printf 'merge-base='
git merge-base "$base" "$head"
git merge-base --is-ancestor "$base" "$head"; echo "base_is_ancestor=$?"
git merge-base --is-ancestor "$predecessor" "$head"; echo "predecessor_is_ancestor=$?"
printf 'ahead='; git rev-list --count "$base..$head"
printf 'behind='; git rev-list --count "$head..$base"

echo '== Effective base-to-head paths =='
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
echo '== Whitespace check =='
git diff --check "$base" "$head" --

echo '== Predecessor-to-head change =='
git show --no-ext-diff --format=fuller --name-status "$head"
git diff --check "$predecessor" "$head" --
git diff --unified=24 "$predecessor" "$head" -- tests/upstream_unicast_authority_contract.rs
echo '== Non-target source/test changes after predecessor =='
git diff --name-status "$predecessor" "$head" -- . ':!tests/upstream_unicast_authority_contract.rs'

echo '== Test and validation outlines =='
ast-grep outline tests/upstream_unicast_authority_contract.rs --items all --type function
ast-grep outline src/edge_contract.rs --items all --type function,enum,impl --match 'GatewayConfig|GatewayConfigError|UpstreamConfig|validate_upstream_authority_separation'
ast-grep outline src/migration_admin.rs --items all --type function,impl --match 'PgErdMigrationConfig|validate_transport_authority|build_proxy'

echo '== Relevant validation and regression-test contexts =='
rg -n -C 20 --type rust '\b(to_canonical|is_unspecified|is_multicast|is_broadcast|NonUnicastUpstreamAddress|validate_upstream_authority_separation|validate_transport_authority|build_proxy)\b' \
  src/edge_contract.rs src/migration_admin.rs tests/upstream_unicast_authority_contract.rs

echo '== Exact-head workflows =='
gh pr checks 27 --repo "$repo" || true
echo '== Review receipts =='
gh pr view 27 --repo "$repo" --json reviews \
  --jq '.reviews[] | {author: .author.login, state: .state, commit: .commit.oid, submittedAt: .submittedAt}' || true

Length of output: 8352


🏁 Script executed:

#!/bin/bash
set -uo pipefail

repo="ContextualWisdomLab/pingora-gateway"
head="c2dfbbc9e7af5026f3c194bf63a7153f758a9a48"

echo '== Source outlines =='
ast-grep outline src/edge_contract.rs --items all --match 'GatewayConfig|GatewayConfigError|UpstreamConfig|validate_upstream_authority_separation|socket_authorities_overlap' || true
ast-grep outline src/migration_admin.rs --items all --match 'PgErdMigrationConfig|validate_transport_authority|build_proxy' || true
ast-grep outline tests/upstream_unicast_authority_contract.rs --items all || true

echo '== Upstream destination validation =='
rg -n -C 26 --type rust '\b(to_canonical|is_unspecified|is_multicast|is_broadcast|NonUnicastUpstreamAddress|validate_upstream_authority_separation|socket_authorities_overlap)\b' src/edge_contract.rs || true

echo '== PgErd validation boundary =='
rg -n -C 24 --type rust '\b(validate_transport_authority|build_proxy|self\.validate\(\)|UpstreamConfiguration)\b' src/migration_admin.rs || true

echo '== Non-unicast regression test =='
cat -n tests/upstream_unicast_authority_contract.rs

echo '== Current exact-head workflow state =='
gh pr checks 27 --repo "$repo" || true
echo '== Current review receipts =='
gh pr view 27 --repo "$repo" --json reviews \
  --jq '.reviews[] | {author: .author.login, state: .state, commit: .commit.oid, submittedAt: .submittedAt}' || true

echo '== Checkout relation =='
git rev-parse HEAD
git merge-base --is-ancestor "$head" HEAD; echo "requested_head_is_ancestor_of_checkout=$?"

Length of output: 26784


@seonghobae I reviewed exact head c2dfbbc9e7af5026f3c194bf63a7153f758a9a48 against configured base 1a369e144ce8021595cebe388ab042e369875229.

I used the existing PR guidance to review the live configured base-to-head range.

The merge base is 1a369e.... The head is 44 commits ahead and 0 commits behind.

The effective range changes these five paths:

  • TEST_STRATEGY.md
  • src/edge_contract.rs
  • src/migration_admin.rs
  • tests/network_authority_self_loop_contract.rs
  • tests/upstream_unicast_authority_contract.rs

I found no implementation or test finding.

The delta from 00046c7... to c2dfbbc... changes only tests/upstream_unicast_authority_contract.rs. It adds the rustfmt-required trailing comma after GatewayConfigError::NonUnicastUpstreamAddress. It does not change test inputs, expected errors, control flow, or production code. git diff --check reports no whitespace errors.

The effective range retains the validation behavior:

  • UpstreamConfig::validate() canonicalizes IPv4-mapped addresses.
  • The validation rejects unspecified addresses before non-unicast checks.
  • The validation rejects IPv4 limited broadcast, IPv4 multicast, and IPv6 multicast destinations.
  • PgErdMigrationConfig::validate_transport_authority() invokes upstream.validate().
  • PgErdMigrationConfig::build_proxy() invokes self.validate().

The exact-head CI jobs test, load-contract, and oci-runtime are pending. The Supply Chain candidate-evidence job is pending. Earlier workflow and review results are predecessor evidence only.

CodeRabbit reports that reviews are disabled for this base branch. No CodeRabbit review receipt exists for this exact head.


🧠 Learnings used
Learnt from: seonghobae
URL: https://github.com/ContextualWisdomLab/pingora-gateway/pull/27

Timestamp: 2026-09-15T20:24:38.846Z
Learning: For pull request `#27` in `ContextualWisdomLab/pingora-gateway`, review the effective delta against the live configured GitHub PR base SHA. Do not use a historical ancestor as the comparison base when the configured base has advanced.
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae
seonghobae marked this pull request as draft September 16, 2026 02:24

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hosted log RCA corrected on current head. CI 35031683741 for predecessor 00046c7bc4c48d737a2ef9c243315f55268475b3 failed cargo fmt --all -- --check specifically on src/edge_contract.rs: Rust 1.98 requires the long UnspecifiedUpstreamAddress #[error(...)] attribute to use multiline formatting. The intervening c2dfbbc9e7af5026f3c194bf63a7153f758a9a48 trailing-comma-only test formatting change was benign but did not address the hosted finding. Current exact 84a4df0bb162673f602dac95e9ded7eaa0e23582 adopts that intervening delta and applies the exact runner-prescribed source formatting. No production semantics, error text, policy, or fixture values change. Fresh exact execution and independent review are still required.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review current exact 84a4df0bb162673f602dac95e9ded7eaa0e23582 against configured base 1a369e144ce8021595cebe388ab042e369875229. Hosted CI RCA shows the actual predecessor formatter finding was the long UnspecifiedUpstreamAddress #[error(...)] attribute in src/edge_contract.rs; current exact applies that exact Rust 1.98 layout while preserving the benign intervening test-only comma formatting. Do not transfer predecessor review credit.

@seonghobae
seonghobae marked this pull request as ready for review September 16, 2026 02:26
@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

repo="ContextualWisdomLab/pingora-gateway"
base="1a369e144ce8021595cebe388ab042e369875229"
head="84a4df0bb162673f602dac95e9ded7eaa0e23582"
predecessor="c2dfbbc9e7af5026f3c194bf63a7153f758a9a48"

echo '== Live pull request metadata =='
gh pr view 27 --repo "$repo" \
  --json number,state,isDraft,headRefName,headRefOid,baseRefName,baseRefOid,mergeable,reviewDecision,statusCheckRollup

echo '== Exact ancestry =='
git rev-parse "${head}^{commit}"
printf 'merge-base='; git merge-base "$base" "$head"
git merge-base --is-ancestor "$base" "$head"; echo "base_is_ancestor=$?"
git merge-base --is-ancestor "$predecessor" "$head"; echo "predecessor_is_ancestor=$?"
printf 'ahead='; git rev-list --count "$base..$head"
printf 'behind='; git rev-list --count "$head..$base"

echo '== Effective base-to-head paths and whitespace =='
git diff --name-status "$base" "$head"
git diff --stat "$base" "$head"
git diff --check "$base" "$head" --

echo '== Exact final commit =='
git show --no-ext-diff --format=fuller --name-status "$head"
echo '== Predecessor-to-head diff =='
git diff --check "$predecessor" "$head" --
git diff --unified=30 "$predecessor" "$head" -- \
  src/edge_contract.rs \
  tests/upstream_unicast_authority_contract.rs
echo '== Other paths after predecessor =='
git diff --name-status "$predecessor" "$head" -- . \
  ':!src/edge_contract.rs' \
  ':!tests/upstream_unicast_authority_contract.rs'

echo '== Relevant source maps =='
ast-grep outline src/edge_contract.rs --items all --type enum,function,impl --match 'GatewayConfigError|UpstreamConfig|validate_upstream_authority_separation|socket_authorities_overlap'
ast-grep outline tests/upstream_unicast_authority_contract.rs --items all --type function

echo '== Error attribute and destination validation contexts =='
rg -n -C 24 --type rust '\b(UnspecifiedUpstreamAddress|NonUnicastUpstreamAddress|to_canonical|is_unspecified|is_broadcast|is_multicast)\b' src/edge_contract.rs
echo '== Non-unicast regression test =='
cat -n tests/upstream_unicast_authority_contract.rs

echo '== Exact-head workflows =='
gh pr checks 27 --repo "$repo" || true
echo '== Review receipts =='
gh pr view 27 --repo "$repo" --json reviews \
  --jq '.reviews[] | {author: .author.login, state: .state, commit: .commit.oid, submittedAt: .submittedAt}' || true

echo '== Checkout relation =='
git rev-parse HEAD
git merge-base --is-ancestor "$head" HEAD; echo "requested_head_is_ancestor_of_checkout=$?"

Length of output: 9486


🏁 Script executed:

#!/bin/bash
set -u

repo="ContextualWisdomLab/pingora-gateway"
head="84a4df0bb162673f602dac95e9ded7eaa0e23582"

echo '== Source outlines =='
ast-grep outline src/edge_contract.rs --items all --match 'GatewayConfigError|UpstreamConfig|validate_upstream_authority_separation|socket_authorities_overlap' || true
ast-grep outline src/migration_admin.rs --items all --match 'PgErdMigrationConfig|validate_transport_authority|build_proxy' || true
ast-grep outline tests/upstream_unicast_authority_contract.rs --items all || true

echo '== Upstream destination validation =='
rg -n -C 26 --type rust '\b(UnspecifiedUpstreamAddress|NonUnicastUpstreamAddress|to_canonical|is_unspecified|is_broadcast|is_multicast|validate_upstream_authority_separation|socket_authorities_overlap)\b' src/edge_contract.rs || true

echo '== PgErd validation boundary =='
rg -n -C 24 --type rust '\b(validate_transport_authority|build_proxy|self\.validate\(\)|UpstreamConfiguration)\b' src/migration_admin.rs || true

echo '== Non-unicast contract test =='
cat -n tests/upstream_unicast_authority_contract.rs || true

echo '== Exact head status checks =='
gh pr checks 27 --repo "$repo" || true
echo '== Review receipts =='
gh pr view 27 --repo "$repo" --json reviews \
  --jq '.reviews[] | {author: .author.login, state: .state, commit: .commit.oid, submittedAt: .submittedAt}' || true

echo '== Checkout relation =='
git rev-parse HEAD || true
git merge-base --is-ancestor "$head" HEAD
echo "requested_head_is_ancestor_of_checkout=$?"

Length of output: 26908


@seonghobae I reviewed exact head 84a4df0bb162673f602dac95e9ded7eaa0e23582 against configured base 1a369e144ce8021595cebe388ab042e369875229.

I used the existing PR guidance to scope the review to the live configured base-to-head range.

The merge base is 1a369e.... The head is 45 commits ahead and 0 commits behind.

The effective range changes these five paths:

  • TEST_STRATEGY.md
  • src/edge_contract.rs
  • src/migration_admin.rs
  • tests/network_authority_self_loop_contract.rs
  • tests/upstream_unicast_authority_contract.rs

I found no implementation or test finding.

Commit 84a4df0... changes only src/edge_contract.rs. It applies the multiline Rust 1.98 Rustfmt layout to the long GatewayConfigError::UnspecifiedUpstreamAddress #[error(...)] attribute. It does not change the error text, enum variant, validation order, or control flow.

The commit preserves the earlier trailing comma in tests/upstream_unicast_authority_contract.rs. That test-only formatting remains behavior-neutral.

The effective range still has the required behavior:

  • UpstreamConfig::validate() canonicalizes the IP address with to_canonical().
  • It rejects canonical unspecified addresses before the non-unicast check.
  • It rejects IPv4 limited broadcast, IPv4 multicast, and IPv6 multicast destinations.
  • PgErdMigrationConfig::validate_transport_authority() calls upstream.validate().
  • PgErdMigrationConfig::build_proxy() calls self.validate().
  • Gateway-owned authority overlap remains limited to listener and metrics_listener.

The exact-head CI checks test, load-contract, and oci-runtime are pending. The Supply Chain candidate-evidence check is pending. The CodeRabbit check reports that review was skipped as a draft-pull-request check. No CodeRabbit review receipt targets this exact head. Earlier review and workflow results remain predecessor evidence only.

I did not run repository code or tests in this inspection environment.


🧠 Learnings used
Learnt from: seonghobae
URL: https://github.com/ContextualWisdomLab/pingora-gateway/pull/27

Timestamp: 2026-09-15T20:24:38.846Z
Learning: For pull request `#27` in `ContextualWisdomLab/pingora-gateway`, review the effective delta against the live configured GitHub PR base SHA. Do not use a historical ancestor as the comparison base when the configured base has advanced.
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae
seonghobae merged commit 2175507 into test/pg-erd-post-commit-reset-v1 Sep 16, 2026
9 checks passed
seonghobae added a commit that referenced this pull request Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority: high type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant