feat(persistence): enforce migration object naming contracts - #521
seonghobae wants to merge 314 commits into
Conversation
📝 WalkthroughWalkthrough마이그레이션 검증 구현을 카탈로그·어휘 정규화·구조 검증·RLS 검증 모듈로 분리했다. 정방향과 롤백 SQL을 모두 검사하고, 식별자·테이블 계약·RLS 정책·역할 보안 상태를 더 엄격하게 검증하는 테스트를 추가했다. Changes마이그레이션 계약 검증
Priority: ⬇️ Low Estimated code review effort: 5 (Critical) | ~90 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant MigrationCatalog
participant SQLNormalizer
participant ContractValidator
participant RLSValidator
MigrationCatalog->>SQLNormalizer: 정방향·롤백 SQL 전달
SQLNormalizer->>ContractValidator: 정규화된 SQL 전달
ContractValidator->>RLSValidator: RLS 선언과 정책 전달
RLSValidator-->>ContractValidator: RLS 계약 결과
ContractValidator-->>MigrationCatalog: 검증 결과 반환
Merge Risk: 🔵 Low · up to Valid migrations containing dollar signs in unquoted identifiers can be rejected before application. The localized lexer fix should be made before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
Both failures on this head are now addressedThe first verdict on this branch reported three failing checks. Each had a different cause and each is handled.
Reproducing with the pinned nightly that CI uses: Two arms had never been reached, both introduced by this change:
Two fixture lines reach both: a comment containing After the change Local evidence at the new head
|
Re-verified after the restacks, on the current headThis branch has been through several restacks by other sessions since I last ran the Rust gates on it, including a merge of #526's
The 62 in The branch-coverage denominator is worth stating: 3898, against 3884 on plain Nothing needed fixing. Posting the numbers so the verification is on the record at a head that several sessions have touched. |
|
Current-head review found a still-valid naming-contract bypass after the non-force restack onto #538. This PR must remain Draft. Repair acceptance: add a public |
|
A second current-head review finding belongs in the same parser repair rather than a separate workaround. Please treat this and the quoted-identifier omission as one lexical-boundary defect. The RED batch should cover comment/string false positives plus quoted object/column false negatives; the causal fix should scan SQL lexical state once (code vs single-quoted literal vs double-quoted identifier vs line/block comment), preserve declared identifier spelling, and fail closed on malformed quoting/comment state. Do not add more raw substring exceptions. |
|
@coderabbitai review Please review current exact head |
|
@coderabbitai review Current head moved ordinary-forward to |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== HEAD =='
git rev-parse HEAD
git status --short
printf '%s\n' '== migration files =='
fd -t f -e rs . | rg '(^|/)(migration|migration_core|live_repository)\.rs$|migration'
printf '%s\n' '== changed paths from first parent =='
git diff --name-status HEAD^ HEAD
printf '%s\n' '== Rust outlines =='
for f in $(fd -t f -e rs . | rg '(^|/)(migration|migration_core|live_repository)\.rs$'); do
echo "--- $f"
ast-grep outline "$f" --items all --type function,struct,enum,impl 2>/dev/null || true
done
printf '%s\n' '== relevant symbols and tests =='
rg -n -C 5 -P '\b(validate_migration_catalog|normalize|parse_names_after|parse_column_names|leading_identifier|dollar|EmptyMigrationSql|is_word_start)\b' --glob '*.rs'
printf '%s\n' '== facade/core diff =='
git diff --find-renames --find-copies HEAD^ HEAD -- '**/migration.rs' '**/migration_core.rs' '**/*migration*.rs'Length of output: 997
The review is inconclusive. Please retry the review after repository access is available. You are interacting with an AI system. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== checked-out commit =='
git rev-parse HEAD
git status --short
printf '%s\n' '== migration-related Rust files =='
fd -t f -e rs . | rg '(^|/)(migration|migration_core|live_repository)\.rs$'
printf '%s\n' '== current-head changed paths =='
git diff-tree --no-commit-id --name-status -r HEAD
printf '%s\n' '== symbol outlines =='
while IFS= read -r file; do
printf '\n--- %s ---\n' "$file"
ast-grep outline "$file" --items all --type function,struct,enum,impl 2>/dev/null || true
done < <(fd -t f -e rs . | rg '(^|/)(migration|migration_core|live_repository)\.rs$')
printf '%s\n' '== validation, lexical, parser, and test references =='
rg -n -C 4 -P '\b(validate_migration_catalog|normalize_migration|migration_core|parse_names_after|parse_column_names|leading_identifier|dollar|EmptyMigrationSql|SingleWordObjectName|is_word_start)\b' --glob '*.rs' .
printf '%s\n' '== facade/core changes against first parent =='
git diff --find-renames --find-copies HEAD^ HEAD -- '**/migration.rs' '**/migration_core.rs' '**/*migration*.rs'
printf '%s\n' '== complete current migration module sources =='
while IFS= read -r file; do
printf '\n--- %s ---\n' "$file"
cat -n "$file"
done < <(fd -t f -e rs . | rg '(^|/)(migration|migration_core)\.rs$')Length of output: 1378
I could not inspect exact head You are interacting with an AI system. |
|
@coderabbitai review Please review current exact head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== checked-out revision =='
git rev-parse HEAD
git status --short
echo '== relevant Rust files =='
fd -t f -e rs . | rg '(^|/)(migration|migration_core|live_repository)\.rs$'
echo '== paths changed since foundation base =='
git diff --name-status 0a6947b11f2dba9e161f2abe8bdec0f652d4b47a HEAD -- . || true
echo '== migration module outlines =='
while IFS= read -r f; do
echo "--- $f"
ast-grep outline "$f" --items all --type function,struct,enum,impl 2>/dev/null || true
done < <(fd -t f -e rs . | rg '(^|/)(migration|migration_core|live_repository)\.rs$')
echo '== relevant definitions, callers, and tests =='
rg -n -C 5 -P '\b(validate_migration_catalog|normalize_migration_sql|parse_names_after|parse_column_names|leading_identifier|CREATE MATERIALIZED VIEW|CREATE VIEW|dollar|EmptyMigrationSql|SingleWordObjectName|is_word_start)\b' --glob '*.rs' .
echo '== change diff for migration surface =='
git diff --find-renames 0a6947b11f2dba9e161f2abe8bdec0f652d4b47a HEAD -- '**/migration.rs' '**/migration_core.rs' '**/live_repository.rs' '**/*migration*.rs' || trueLength of output: 1194
I could not inspect exact head Please retry the review when repository access is available. You are interacting with an AI system. |
|
@coderabbitai review Please review current exact head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== revision =='
git rev-parse HEAD
git status --short
printf '%s\n' '== relevant Rust files =='
fd -t f -e rs . | rg '(^|/)(migration|migration_core|live_repository)\.rs$'
printf '%s\n' '== delta paths from foundation =='
git diff --name-status 0a6947b11f2dba9e161f2abe8bdec0f652d4b47a HEAD -- .
printf '%s\n' '== outlines =='
while IFS= read -r f; do
printf '\n--- %s ---\n' "$f"
ast-grep outline "$f" --items all --type function,struct,enum,impl 2>/dev/null || true
done < <(fd -t f -e rs . | rg '(^|/)(migration|migration_core|live_repository)\.rs$')
printf '%s\n' '== targeted source references =='
rg -n -C 6 -P '\b(validate_migration_catalog|normalize_migration_sql|migration_core|parse_names_after|parse_column_names|leading_identifier|is_word_start|EmptyMigrationSql|SingleWordObjectName)\b|CREATE (OR REPLACE|MATERIALIZED )?VIEW|dollar' --glob '*.rs' .
printf '%s\n' '== migration delta =='
git diff --find-renames 0a6947b11f2dba9e161f2abe8bdec0f652d4b47a HEAD -- '**/migration.rs' '**/migration_core.rs' '**/live_repository.rs' '**/*migration*.rs'
printf '%s\n' '== requested RED commit =='
git show --format=fuller --find-renames --stat cb856ec570fc9c2a68562b1212fc2c3915ccae32
git show --format= --find-renames cb856ec570fc9c2a68562b1212fc2c3915ccae32 -- '**/migration.rs' '**/migration_core.rs' '**/*migration*.rs'Length of output: 2296 🏁 Script executed: #!/bin/bash
set -euo pipefail
for f in \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
do
printf '\n== outline: %s ==\n' "$f"
ast-grep outline "$f" --items all --type function,struct,enum,impl 2>/dev/null || true
done
printf '%s\n' '== migration facade =='
cat -n crates/persistence_postgres/src/migration.rs
printf '%s\n' '== migration core =='
cat -n crates/persistence_postgres/src/migration_core.rs
printf '%s\n' '== migration validation =='
cat -n crates/persistence_postgres/src/migration_validation.rs
printf '%s\n' '== lexical contract tests =='
cat -n crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== current head diff from foundation for migration surface =='
git diff --find-renames --find-copies 0a6947b11f2dba9e161f2abe8bdec0f652d4b47a HEAD -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== RED cb856ec patch =='
git show --format= --find-renames cb856ec570fc9c2a68562b1212fc2c3915ccae32 -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== callers and exports =='
rg -n -C 4 -P '\bvalidate_migration_catalog\s*\(|\bmod\s+migration(?:_core|_validation)?\b|\bpub\s+use\b.*migration' crates/persistence_postgres --glob '*.rs'Length of output: 188209 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== requested head metadata and parent =='
git show --no-patch --format=fuller HEAD
git rev-parse HEAD^
printf '%s\n' '== causal head patch =='
git diff --find-renames HEAD^ HEAD -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== view declarations in checked-in migrations and tests =='
rg -n -C 3 -i -P '\bCREATE\s+(?:MATERIALIZED\s+|OR\s+REPLACE\s+)?VIEW\b' \
crates/persistence_postgres migrations --glob '*.rs' --glob '*.sql'
printf '%s\n' '== normalization and parser call boundaries =='
rg -n -C 3 -P '\b(canonicalize_structural_keywords|normalize_migration_sql|parse_created_object_names|parse_names_after)\s*\(' \
crates/persistence_postgres/src --glob '*.rs'Length of output: 22953
I found no issue in the requested scope.
The public RED is present. This is a source review only. I do not treat skipped Draft CI or predecessor evidence as promotion evidence. You are interacting with an AI system. |
|
@coderabbitai review Please review current exact head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
expected='2d330a2e69bd87f403e3a5c2ebddc5c2d38df1c3'
printf '%s\n' '== exact head =='
git rev-parse HEAD
git status --short
git merge-base --is-ancestor "$expected" HEAD && echo 'expected head is an ancestor of checkout'
git merge-base --is-ancestor HEAD "$expected" && echo 'checkout is an ancestor of expected head'
printf '%s\n' '== requested commit metadata =='
git show --no-patch --format='%H%n%P%n%s' "$expected"
git show --no-patch --format='%H%n%P%n%s' 5de7ad0974846c42183d22684e79bbf0fdc240ea
git show --no-patch --format='%H%n%P%n%s' e0d3c0def34d264321cb501bc5d2ab39ecffff08
printf '%s\n' '== relevant files =='
fd -t f -e rs . | rg '(^|/)(migration|migration_core|migration_validation|live_repository)\.rs$|migration.*contract.*\.rs$'
printf '%s\n' '== source outlines =='
for f in crates/persistence_postgres/src/migration.rs crates/persistence_postgres/src/migration_core.rs; do
if [ -f "$f" ]; then
echo "--- $f"
ast-grep outline "$f" --items all --type function,struct,enum,impl
fi
done
printf '%s\n' '== qualification and parsing implementation =='
rg -n -C 8 -P '\b(qualified|qualification|INVALID|sentinel|canonicalize_structural_keywords|normalize_migration_sql|parse_names_after|parse_column_names|leading_identifier|validate_migration_catalog)\b' \
crates/persistence_postgres --glob '*.rs'
printf '%s\n' '== tests for qualified and unqualified declarations =='
rg -n -C 6 -i -P '(audit_schema|qualified|unqualified|CREATE\s+(?:OR\s+REPLACE\s+)?(?:FUNCTION|VIEW)|CREATE\s+(?:UNIQUE\s+)?INDEX)' \
crates/persistence_postgres --glob '*.rs'
printf '%s\n' '== requested RED patch =='
git show --format= --find-renames 5de7ad0974846c42183d22684e79bbf0fdc240ea -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/tests \
crates/persistence_postgres/src
printf '%s\n' '== causal repair and current correction patches =='
git show --format= --find-renames e0d3c0def34d264321cb501bc5d2ab39ecffff08 -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/tests \
crates/persistence_postgres/src
git show --format= --find-renames "$expected" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/tests \
crates/persistence_postgres/src
printf '%s\n' '== checked-in migration CREATE declarations =='
rg -n -i -P '\bCREATE\s+(?:OR\s+REPLACE\s+|MATERIALIZED\s+|UNIQUE\s+|UNIQUE\s+INDEX\s+IF\s+NOT\s+EXISTS\s+)?(?:TABLE|INDEX|VIEW|FUNCTION|TRIGGER|TYPE|SEQUENCE|POLICY|CONSTRAINT)\b' \
--glob '*.sql' --glob '*.rs' crates/persistence_postgres migrations 2>/dev/null || trueLength of output: 4237 🏁 Script executed: #!/bin/bash
set -euo pipefail
files=(
crates/persistence_postgres/src/migration.rs
crates/persistence_postgres/src/migration_core.rs
crates/persistence_postgres/src/migration_validation.rs
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
)
printf '%s\n' '== outlines =='
for f in "${files[@]}"; do
if [ -f "$f" ]; then
printf '\n--- %s ---\n' "$f"
ast-grep outline "$f" --items all --type function,struct,enum 2>/dev/null || true
fi
done
printf '%s\n' '== relevant implementation and test blocks =='
rg -n -C 12 -P '\b(validate_migration_catalog|normalize_migration_sql|canonicalize_structural_keywords|parse_names_after|parse_column_names|leading_identifier|is_word_start|QUALIFIED|qualified|sentinel|SingleWordObjectName|EmptyMigrationSql)\b' \
"${files[@]}"
printf '%s\n' '== lexical contract test file =='
if [ -f crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs ]; then
cat -n crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
fi
printf '%s\n' '== exact causal repair patch =='
git show --format= --find-renames e0d3c0def34d264321cb501bc5d2ab39ecffff08 -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== public RED patch =='
git show --format= --find-renames 5de7ad0974846c42183d22684e79bbf0fdc240ea -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== current-head correction patch =='
git show --format= --find-renames 2d330a2e69bd87f403e3a5c2ebddc5c2d38df1c3 -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== all checked-in unqualified CREATE declarations in migration SQL =='
fd -t f -e sql . crates/persistence_postgres 2>/dev/null | while IFS= read -r f; do
rg -n -i -P '\bCREATE\s+(?:OR\s+REPLACE\s+|MATERIALIZED\s+|UNIQUE\s+)?(?:TABLE|INDEX|VIEW|FUNCTION|TRIGGER|TYPE|SEQUENCE|POLICY)\b' "$f" || true
doneLength of output: 123255
I found one remaining qualified-name bypass.
CREATE TABLE IF NOT EXISTS audit_schema.Bad (...);The guard only skips
Add a public The existing tests cover qualified view declarations and the I did not run build or test commands. Draft-skipped CI remains non-evidence. You are interacting with an AI system. |
|
@coderabbitai review Current exact head: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
expected='0cd03111bfef95aadab49b486c84eb11c0a2b8e7'
base='0a6947b11f2dba9e161f2abe8bdec0f652d4b47a'
printf '%s\n' '== exact checkout =='
git rev-parse HEAD
git status --short
git merge-base --is-ancestor "$expected" HEAD && echo 'expected-head-is-ancestor-of-checkout'
git merge-base --is-ancestor HEAD "$expected" && echo 'checkout-is-ancestor-of-expected-head'
git show --no-patch --format='%H%n%P%n%s' "$expected"
printf '%s\n' '== migration-related Rust files =='
fd -t f -e rs . | rg '(^|/)(migration|migration_core|migration_validation|live_repository)\.rs$|migration.*(contract|lexing).*\.rs$'
printf '%s\n' '== compact source outlines =='
while IFS= read -r f; do
printf '\n--- %s ---\n' "$f"
ast-grep outline "$f" --items all --type function,struct,enum,impl 2>/dev/null || true
done < <(fd -t f -e rs . | rg '(^|/)(migration|migration_core|migration_validation|live_repository)\.rs$|migration.*(contract|lexing).*\.rs$')
printf '%s\n' '== targeted implementation, callers, and test context =='
rg -n -C 10 -P '\b(validate_migration_catalog|normalize_migration_sql|canonicalize_structural_keywords|parse_created_object_names|parse_names_after|parse_column_names|leading_identifier|is_word_start|is_multi_word_snake_case|CREATE\s+(ROLE|USER|GROUP)|role|dollar|unterminated|SingleWordObjectName|InvalidMigration)\b' \
crates/persistence_postgres --glob '*.rs'
printf '%s\n' '== checked-in runtime-role declarations =='
rg -n -C 5 -i -P '\bCREATE\s+(ROLE|USER|GROUP)\b|tepp_app_runtime' --glob '*.sql' --glob '*.rs' .
printf '%s\n' '== current delta from foundation on review surface =='
git diff --find-renames --find-copies "$base" "$expected" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/src/live_repository.rs \
crates/persistence_postgres/tests
printf '%s\n' '== role RED/fix history reachable from exact head =='
git log --oneline --ancestry-path "$base..$expected" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests | tail -n 40
printf '%s\n' '== role-related patches in exact range =='
git log --format='%H %s' --ancestry-path "$base..$expected" --all -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests \
| while IFS=' ' read -r sha subject; do
if printf '%s\n' "$subject" | rg -qi 'role|user|group|runtime'; then
printf '\n--- %s %s ---\n' "$sha" "$subject"
git show --format= --find-renames "$sha" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests
fi
doneLength of output: 4236 🏁 Script executed: #!/bin/bash
set -euo pipefail
expected='0cd03111bfef95aadab49b486c84eb11c0a2b8e7'
base='0a6947b11f2dba9e161f2abe8bdec0f652d4b47a'
files='crates/persistence_postgres/src/migration.rs
crates/persistence_postgres/src/migration_core.rs
crates/persistence_postgres/src/migration_validation.rs
crates/persistence_postgres/src/live_repository.rs
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
crates/persistence_postgres/tests/append_only_migration_contract.rs'
printf '%s\n' '== selected source outlines =='
printf '%s\n' "$files" | while IFS= read -r f; do
if [ -f "$f" ]; then
printf '\n--- %s ---\n' "$f"
ast-grep outline "$f" --items all --type function,struct,enum,impl 2>/dev/null || true
fi
done
printf '%s\n' '== complete selected sources =='
printf '%s\n' "$files" | while IFS= read -r f; do
if [ -f "$f" ]; then
printf '\n--- %s ---\n' "$f"
cat -n "$f"
fi
done
printf '%s\n' '== runtime role declarations and migration catalog paths =='
rg -n -C 8 -i -P '\bCREATE\s+(ROLE|USER|GROUP)\b|tepp_app_runtime|migration.*catalog|validate_migration_catalog' \
--glob '*.sql' --glob '*.rs' .
printf '%s\n' '== exact-head patch =='
git diff --find-renames --find-copies "$expected^" "$expected" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/src/live_repository.rs \
crates/persistence_postgres/tests \
crates/persistence_postgres
printf '%s\n' '== current review-surface delta from foundation =='
git diff --stat "$base" "$expected" -- crates/persistence_postgres
git diff --find-renames "$base" "$expected" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/src/live_repository.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs \
crates/persistence_postgres/tests/append_only_migration_contract.rs
printf '%s\n' '== runtime-role and role-alias commits =='
git log --format='%H %s' "$base..$expected" -- crates/persistence_postgres | rg -i 'role|runtime|user|group' || trueLength of output: 104223 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== current facade and role-validation call flow =='
rg -n -C 18 -P '\b(validate_migration_catalog|normalize_migration_sql|declares_created_role|validate_tenant_rls_contract|MissingAppRuntimeRole)\b' \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs
printf '%s\n' '== current lexical and structural functions =='
rg -n -C 14 -P '^fn (lexically_normalize_migration_sql|canonicalize_structural_keywords|scan_single_quoted_literal|scan_quoted_identifier|scan_block_comment|dollar_quote_delimiter|scan_dollar_quoted_body|literal_is_atomic|quoted_identifier_is_structurally_safe)|^pub\(super\) fn (normalize_migration_sql|declares_created_role)' \
crates/persistence_postgres/src/migration_validation.rs
printf '%s\n' '== current public role and lexical tests =='
rg -n -C 12 -P '^fn (created_role_aliases_are_covered_by_the_object_naming_contract|runtime_role_reference_does_not_substitute_for_role_declaration|quoted_created_object_cannot_bypass_the_naming_contract|declaration_shaped_text_inside_sql_trivia_is_not_an_object)|role_declaration_evidence_uses_the_lexical_boundary|role_creation_aliases_share_the_created_object_name_scanner' \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs \
crates/persistence_postgres/src/migration_validation.rs
printf '%s\n' '== current shipped RLS role declaration context =='
fd -t f -e sql . | rg '0002_tenant_row_level_security\.up\.sql$' | while IFS= read -r f; do
echo "--- $f"
rg -n -C 16 -i -P '\bCREATE\s+(ROLE|USER|GROUP)\b|tepp_app_runtime|ROW LEVEL SECURITY|CREATE POLICY' "$f"
done
printf '%s\n' '== exact current-head patch =='
git show --format= --find-renames 0cd03111bfef95aadab49b486c84eb11c0a2b8e7 -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== predecessor runtime-role repair patch =='
git show --format= --find-renames dffe2de9fde3019dd2d6e8e78c4d7f8e42e0be1b -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== runtime-role RED patch =='
git show --format= --find-renames 7f63a667dae1eec4057c5cf6de7eada8cf385526 -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rsLength of output: 125348
I found no issue in the requested scope.
The role-evidence scan uses the lexical-normalization pass before it scans tokens. Therefore, role-shaped text in single-quoted literals, line comments, block comments, and dollar-quoted bodies cannot satisfy the runtime-role requirement. Unterminated lexical regions return The structural normalization maps The new public regression also verifies that a The shipped migration at CREATE ROLE tepp_app_runtime NOINHERIT NOSUPERUSER NOCREATEDB NOCREATEROLE NOBYPASSRLS;This declaration satisfies both the new evidence check and the naming contract. This was a source review. I did not treat Draft lifecycle skips or predecessor checks as promotion evidence. You are interacting with an AI system. |
|
@coderabbitai review Current exact head: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
expected='facb48566c59a88fda8d45b2c22358f48d29f0d5'
base='0a6947b11f2dba9e161f2abe8bdec0f652d4b47a'
files=(
crates/persistence_postgres/src/migration.rs
crates/persistence_postgres/src/migration_core.rs
crates/persistence_postgres/src/migration_validation.rs
crates/persistence_postgres/src/live_repository.rs
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
)
printf '%s\n' '== exact checkout and requested revision =='
git rev-parse HEAD
git status --short
git show --no-patch --format='%H%n%P%n%s' "$expected"
git merge-base --is-ancestor HEAD "$expected" && echo 'checkout-is-ancestor-of-requested'
git merge-base --is-ancestor "$expected" HEAD && echo 'requested-is-ancestor-of-checkout'
printf '%s\n' '== changed migration review surface from foundation =='
git diff --name-status "$base" "$expected" -- crates/persistence_postgres
printf '%s\n' '== selected source outlines =='
for f in "${files[@]}"; do
if [ -f "$f" ]; then
printf '\n--- %s ---\n' "$f"
ast-grep outline "$f" --items all --type function,struct,enum,impl 2>/dev/null || true
fi
done
printf '%s\n' '== role alias, evidence, lexical boundary, and error contexts =='
rg -n -C 15 -P '\b(validate_migration_catalog|normalize_migration_sql|lexically_normalize_migration_sql|declares_created_role|role_alias|CREATE\s+(ROLE|USER|GROUP)|USER\s+MAPPING|MissingAppRuntimeRole|tepp_app_runtime|canonicalize_structural_keywords|parse_names_after|is_multi_word_snake_case)\b' \
"${files[@]}" 2>/dev/null || true
printf '%s\n' '== exact requested-head patch =='
git show --format= --find-renames "$expected" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== role-mapping tests and callers =='
rg -n -C 12 -i -P '(user mapping|CREATE USER|CREATE ROLE|CREATE GROUP|runtime.role|role.declaration|MissingAppRuntimeRole|validate_migration_catalog)' \
crates/persistence_postgres --glob '*.rs'
printf '%s\n' '== checked-in role and SQL/MED declarations =='
rg -n -C 8 -i -P '\bCREATE\s+(ROLE|USER|GROUP)\b|\bCREATE\s+USER\s+MAPPING\b|tepp_app_runtime' \
--glob '*.sql' --glob '*.rs' .
printf '%s\n' '== role-disambiguation causal patch and reachable history =='
git log --format='%H %s' --ancestry-path "$base..$expected" -- crates/persistence_postgres | rg -i 'role|user mapping|mapping|runtime' || true
git show --format= --find-renames "$expected" -- \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rsLength of output: 203284 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== exact revision =='
git rev-parse HEAD
git diff --quiet facb48566c59a88fda8d45b2c22358f48d29f0d5 HEAD || true
printf '%s\n' '== migration facade =='
sed -n '1,80p' crates/persistence_postgres/src/migration.rs
printf '%s\n' '== role evidence and alias recognition =='
sed -n '1,160p' crates/persistence_postgres/src/migration_validation.rs
printf '%s\n' '== lexical scanner termination behavior =='
sed -n '160,360p' crates/persistence_postgres/src/migration_validation.rs
printf '%s\n' '== role evidence unit regressions =='
sed -n '360,430p' crates/persistence_postgres/src/migration_validation.rs
printf '%s\n' '== public lexical contract regressions =='
sed -n '1,190p' crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== all aliases in supported create-name parsing =='
rg -n -C 8 -P '(CREATE TYPE|parse_names_after|parse_created_object_names|CREATE USER MAPPING|is_role_creation_alias)' \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/src/migration_validation.rsLength of output: 42601
I found no issue in the requested scope.
The exclusion applies before either operation:
The regressions verify both properties. This was a source review. I did not run build or test commands. I do not treat Draft lifecycle skips as promotion evidence. You are interacting with an AI system. |
|
@coderabbitai review Please review current exact head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
expected='1fbe7e5324cd43c1f8508400aac22a7c8806368e'
red='cd82ba1afca5ff0cc19195a35328c3f6fe3324d8'
base='0a6947b11f2dba9e161f2abe8bdec0f652d4b47a'
printf '%s\n' '== exact revision =='
git rev-parse HEAD
git show --no-patch --format='%H%n%P%n%s' "$expected"
git merge-base --is-ancestor "$expected" HEAD && echo 'expected-is-ancestor-of-checkout'
git merge-base --is-ancestor HEAD "$expected" && echo 'checkout-is-ancestor-of-expected'
printf '%s\n' '== migration-related Rust files =='
fd -t f -e rs . | rg '(^|/)(migration|migration_core|migration_validation|live_repository)\.rs$|migration.*(contract|lexing).*\.rs$'
printf '%s\n' '== compact outlines =='
while IFS= read -r f; do
printf '\n--- %s ---\n' "$f"
ast-grep outline "$f" --items all --type function,struct,enum,impl 2>/dev/null || true
done < <(fd -t f -e rs . | rg '(^|/)(migration|migration_core|migration_validation|live_repository)\.rs$|migration.*(contract|lexing).*\.rs$')
printf '%s\n' '== final-state implementation and caller context =='
rg -n -C 18 -P '\b(validate_migration_catalog|declares_created_role|MissingAppRuntimeRole|is_role_creation_alias|is_role_drop_alias|DROP\s+(ROLE|USER|GROUP)|USER\s+MAPPING|IF\s+EXISTS|tepp_app_runtime)\b' \
crates/persistence_postgres --glob '*.rs'
printf '%s\n' '== relevant complete source files =='
for f in \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
do
if [ -f "$f" ]; then
printf '\n--- %s ---\n' "$f"
cat -n "$f"
fi
done
printf '%s\n' '== requested RED and causal repair patches =='
git show --format= --find-renames "$red" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/tests
git show --format= --find-renames "$expected" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/tests
printf '%s\n' '== final delta from foundation for review surface =='
git diff --find-renames "$base" "$expected" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/tests
printf '%s\n' '== role statements in SQL corpus =='
rg -n -C 8 -i -P '\b(CREATE|DROP)\s+(ROLE|USER|GROUP)\b|USER\s+MAPPING|tepp_app_runtime' \
--glob '*.sql' --glob '*.rs' .Length of output: 3891 🏁 Script executed: #!/bin/bash
set -euo pipefail
expected='1fbe7e5324cd43c1f8508400aac22a7c8806368e'
red='cd82ba1afca5ff0cc19195a35328c3f6fe3324d8'
printf '%s\n' '== exact revision =='
git rev-parse HEAD
git show --no-patch --format='%H%n%P%n%s' "$expected"
printf '%s\n' '== outlines =='
for f in \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
do
printf '\n--- %s ---\n' "$f"
ast-grep outline "$f" --items all --type function,struct,enum,impl 2>/dev/null || true
done
printf '%s\n' '== facade and final-state implementation =='
sed -n '1,180p' crates/persistence_postgres/src/migration.rs
sed -n '1,460p' crates/persistence_postgres/src/migration_validation.rs
printf '%s\n' '== public contract regressions =='
sed -n '1,360p' crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== direct references with context =='
rg -n -C 12 -P '\b(declares_created_role|is_role_creation_alias|is_role_drop_alias|scan_role|DROP\s+(ROLE|USER|GROUP)|USER\s+MAPPING|IF\s+EXISTS|tepp_app_runtime|MissingAppRuntimeRole)\b' \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== RED patch =='
git show --format= --find-renames "$red" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== causal repair patch =='
git show --format= --find-renames "$expected" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== corpus role statements =='
rg -n -C 5 -i -P '\b(CREATE|DROP)\s+(ROLE|USER|GROUP)\b|\b(CREATE|DROP)\s+USER\s+MAPPING\b|tepp_app_runtime' \
--glob '*.sql' . || trueLength of output: 85289
I found one runtime-role final-state bypass.
CREATE ROLE tepp_app_runtime;DROP ROLE tepp_app_runtime;The token after Add a public Split statement delimiters during lexical normalization or use statement-aware tokenization before ordered role-state tracking. Do not depend on whitespace to separate SQL statements. The same boundary must preserve valid recreation ordering. The current This was a source review only. I did not treat Draft lifecycle results as promotion evidence. You are interacting with an AI system. |
|
@coderabbitai review Please re-review exact head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
expected='f5d3c956d6662bab7e64711d5e509917a73d0f8e'
red='e8cc37de946f6bb1a10fe680c1c37e938ac9b5e6'
printf '%s\n' '== exact revision =='
git rev-parse HEAD
git show --no-patch --format='%H%n%P%n%s' "$expected"
git merge-base --is-ancestor "$expected" HEAD && echo 'expected-is-ancestor-of-checkout'
git merge-base --is-ancestor HEAD "$expected" && echo 'checkout-is-ancestor-of-expected'
printf '%s\n' '== relevant file discovery =='
fd -t f -e rs . | rg '(^|/)(migration|migration_core|migration_validation|live_repository)\.rs$|migration.*(contract|lexing).*\.rs$'
printf '%s\n' '== outlines =='
for f in \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
do
if [ -f "$f" ]; then
printf '\n--- %s ---\n' "$f"
ast-grep outline "$f" --items all --type function,struct,enum,impl 2>/dev/null || true
fi
done
printf '%s\n' '== role lifecycle and lexical implementation =='
rg -n -C 18 -P '\b(validate_migration_catalog|declares_created_role|is_role_creation_alias|is_role_drop_alias|role_identifier|split_whitespace|semicolon|delimiter|DROP\s+(ROLE|USER|GROUP)|USER\s+MAPPING|IF\s+EXISTS|tepp_app_runtime|lexically_normalize_migration_sql|normalize_migration_sql)\b' \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== complete lifecycle implementation region =='
sed -n '1,260p' crates/persistence_postgres/src/migration_validation.rs
sed -n '260,560p' crates/persistence_postgres/src/migration_validation.rs
printf '%s\n' '== public role lifecycle regressions =='
rg -n -C 20 -P 'adjacent|delimiter|DROP\s+(ROLE|USER|GROUP)|recreate|IF EXISTS|USER MAPPING|runtime.role|MissingAppRuntimeRole' \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs \
crates/persistence_postgres/src/migration_validation.rs
printf '%s\n' '== public RED patch =='
git show --format= --find-renames "$red" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== causal repair patch =='
git show --format= --find-renames "$expected" -- \
crates/persistence_postgres/src/migration.rs \
crates/persistence_postgres/src/migration_validation.rs \
crates/persistence_postgres/src/migration_core.rs \
crates/persistence_postgres/tests/migration_identifier_lexing_contract.rs
printf '%s\n' '== checked-in role SQL forms =='
rg -n -C 6 -i -P '\b(CREATE|DROP)\s+(ROLE|USER|GROUP)\b|\b(CREATE|DROP)\s+USER\s+MAPPING\b|tepp_app_runtime' --glob '*.sql' . || trueLength of output: 228832
I found no issue in the requested scope.
CREATE ROLE tepp_app_runtime;DROP ROLE tepp_app_runtime;The lifecycle scan sets the role state at The lexical boundary still masks comments, single-quoted literals, quoted identifiers that contain unsupported characters, and dollar-quoted bodies before delimiter tokenization. A semicolon or comma in those regions cannot create a lifecycle token or a false role drop.
The existing The public RED covers adjacent This was a source review only. I did not run build or test commands. Draft lifecycle results remain non-promotion evidence. You are interacting with an AI system. |
|
@coderabbitai review Please review current exact head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
head='0790db3b27bb1eb12ec4cdaf11a78c66c96c8de6'
red='9b47d91c0e7996fef6973b4b1aaaa9c22b6f7b2b'
prior_repair='6de2b13dcd1432fc3c64eed44890763fcf836f21'
src='crates/persistence_postgres/src/migration_validation.rs'
lex='crates/persistence_postgres/src/migration_validation_impl.rs'
projection='crates/persistence_postgres/src/migration_transaction_projection.rs'
test='crates/persistence_postgres/tests/migration_unicode_set_config_identity_contract.rs'
printf '%s\n' '== exact head and ancestry =='
printf 'checkout='; git rev-parse HEAD
git diff --quiet "$head" HEAD && echo 'checkout-matches-requested-head'
for revision in "$prior_repair" "$red" "$head"; do
git show --no-patch --format='revision=%H%nparents=%P%nsubject=%s' "$revision"
git merge-base --is-ancestor "$revision" "$head" && echo 'is-ancestor=yes' || echo 'is-ancestor=no'
done
git log --oneline "${red}^..${head}"
git diff --check "${head}^" "$head"
printf '%s\n' '== scoped repair diff =='
git diff --name-status "$red" "$head" -- "$src" "$lex" "$projection" "$test"
git diff --unified=100 "$red" "$head" -- "$src" "$lex" "$projection" "$test"
printf '%s\n' '== source maps =='
ast-grep outline "$src" --items all --type function,struct,enum,impl || true
ast-grep outline "$lex" --items all --type function,struct,enum,impl || true
ast-grep outline "$projection" --items all --type function,struct,enum,impl || true
printf '%s\n' '== identity projector, set_config parser, and execution call flow =='
git show "${head}:${src}" > /tmp/migration_validation_587_rereview.rs
git show "${head}:${lex}" > /tmp/migration_validation_impl_587_rereview.rs
rg -n -C 70 -i \
'fn (project_potential_unicode_set_config_identity|unicode_identifier_end|statement_calls_unsafe_set_config|sql_span_names_set_config|committed_replica_trigger_execution_mode|next_sql_token_span)|U&|UESCAPE|INVALID_QUOTED_IDENTIFIER|set_config|pg_catalog|setting_name|new_value|is_local|session_replication_role|project_committed_sql' \
/tmp/migration_validation_587_rereview.rs /tmp/migration_validation_impl_587_rereview.rs
printf '%s\n' '== focused production windows =='
nl -ba /tmp/migration_validation_587_rereview.rs | sed -n '1,340p'
nl -ba /tmp/migration_validation_587_rereview.rs | sed -n '720,830p'
nl -ba /tmp/migration_validation_impl_587_rereview.rs | sed -n '150,390p'
nl -ba /tmp/migration_validation_impl_587_rereview.rs | sed -n '760,880p'
git show "${head}:${projection}" | nl -ba | sed -n '1,230p'
printf '%s\n' '== public scoped contract =='
git show "${head}:${test}" | nl -ba
printf '%s\n' '== relevant controls across exact head =='
git grep -n -C 12 -i -E \
'set_config|pg_catalog|U&|UESCAPE|INVALID_QUOTED_IDENTIFIER|setting_name|new_value|is_local|session_replication_role|replica|origin|local|audit_support|application_name|ROLLBACK|ABORT|comment|literal|dollar' \
"$head" -- "$src" "$lex" "$projection" crates/persistence_postgres/tests/*.rs
printf '%s\n' '== source-only structural checks =='
python3 - <<'PY'
import subprocess
head='0790db3b27bb1eb12ec4cdaf11a78c66c96c8de6'
for path in (
'crates/persistence_postgres/src/migration_validation.rs',
'crates/persistence_postgres/src/migration_validation_impl.rs',
'crates/persistence_postgres/src/migration_transaction_projection.rs',
):
source = subprocess.check_output(['git', 'show', f'{head}:{path}'], text=True)
print(f'{path}: brace_delta={source.count("{") - source.count("}")}')
PYLength of output: 204003 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='0790db3b27bb1eb12ec4cdaf11a78c66c96c8de6'
red='9b47d91c0e7996fef6973b4b1aaaa9c22b6f7b2b'
src='crates/persistence_postgres/src/migration_validation.rs'
lex='crates/persistence_postgres/src/migration_validation_impl.rs'
projection='crates/persistence_postgres/src/migration_transaction_projection.rs'
test='crates/persistence_postgres/tests/migration_unicode_set_config_identity_contract.rs'
echo '== exact change =='
git diff --unified=45 "$red" "$head" -- "$src" "$test"
echo '== production symbols =='
git show "${head}:${src}" > /tmp/mv.rs
for symbol in \
project_potential_unicode_set_config_identity \
unicode_identifier_end \
statement_calls_unsafe_set_config \
sql_span_names_set_config \
committed_replica_trigger_execution_mode \
declares_created_role; do
line=$(rg -n -m1 "^fn ${symbol}\b" /tmp/mv.rs | cut -d: -f1 || true)
printf '\n--- %s (%s) ---\n' "$symbol" "${line:-missing}"
if [ -n "$line" ]; then
start=$((line > 15 ? line - 15 : 1))
end=$((line + 150))
nl -ba /tmp/mv.rs | sed -n "${start},${end}p"
fi
done
echo '== lexical Unicode and literal output rules =='
git show "${head}:${lex}" > /tmp/mvl.rs
rg -n -C 35 'fn (scan_unicode_escaped_identifier|scan_quoted_identifier|literal_is_atomic|normalize_migration_sql)|INVALID_QUOTED_IDENTIFIER|UESCAPE' /tmp/mvl.rs
echo '== transaction projection =='
git show "${head}:${projection}" | nl -ba | sed -n '1,210p'
echo '== complete scoped public contract =='
git show "${head}:${test}" | nl -ba
echo '== exact source occurrences relevant to UESCAPE identity projection =='
rg -n -C 10 'UESCAPE|unicode_identifier_end|project_potential_unicode_set_config_identity|INVALID_QUOTED_IDENTIFIER' /tmp/mv.rs
echo '== diff whitespace =='
git diff --check "${head}^" "$head"Length of output: 76905
The checkout matches the requested head. Public RED I found no source-level bypass or false positive in the requested scope.
For the prior failing form: SELECT U&"set_!0063onfig" UESCAPE '!'(
setting_name => 'session_replication_role',
new_value => 'replica',
is_local => false
);the projector now leaves The same path preserves direct safe values. The The bounded identity rules remain intact:
✏️ Learnings added
🧠 Learnings usedYou are interacting with an AI system. |
|
@coderabbitai review Please review current exact head Please focus on whether normalized+committed SQL can still leave a persistent This remains Draft. Hosted Rust/Live PostgreSQL gates are skipped by lifecycle, so this request is source-review evidence only and must not be treated as GREEN or qualifying approval. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
head='8c2d868031801874a0fb09108417ba7502138e3d'
red1='9fdd078f7459a3d1e468f50846d44c43038f4c6a'
red2='d1088e7ed81595665c296c4151c3800e1d42162c'
repair1='7cf0f42eda53d0bc6452bafc6fc69f4b8afadbfb'
src='crates/persistence_postgres/src/migration_validation.rs'
lex='crates/persistence_postgres/src/migration_validation_impl.rs'
projection='crates/persistence_postgres/src/migration_transaction_projection.rs'
printf '%s\n' '== exact revision and lineage =='
printf 'checkout='; git rev-parse HEAD
git diff --quiet "$head" HEAD && echo 'checkout-matches-requested-head'
for revision in "$red1" "$repair1" "$red2" "$head"; do
git show --no-patch --format='revision=%H%nparents=%P%nsubject=%s' "$revision"
git merge-base --is-ancestor "$revision" "$head" && echo 'is-ancestor=yes' || echo 'is-ancestor=no'
done
git log --oneline "${red1}^..${head}"
git diff --check "${head}^" "$head"
printf '%s\n' '== scoped changes =='
git diff --name-status "${red1}^" "$head" -- crates/persistence_postgres/src crates/persistence_postgres/tests
git diff --unified=85 "${red1}^" "$head" -- "$src" "$lex" "$projection" crates/persistence_postgres/tests
printf '%s\n' '== source maps =='
for file in "$src" "$lex" "$projection"; do
echo "--- $file ---"
ast-grep outline "$file" --items all --type function,struct,enum,impl || true
done
printf '%s\n' '== persistent setting authority and callers =='
git show "${head}:${src}" > /tmp/migration_validation_588.rs
rg -n -C 80 -i \
'fn .*persistent|fn .*default|fn .*alter|session_replication_role|ALTER[[:space:]]+(ROLE|USER|DATABASE|SYSTEM)|USER[[:space:]]+MAPPING|IN[[:space:]]+DATABASE|FROM[[:space:]]+CURRENT|RESET|DEFAULT|origin|local|replica|project_committed_sql|committed_replica_trigger_execution_mode|declares_created_role' \
/tmp/migration_validation_588.rs
printf '%s\n' '== focused production source =='
nl -ba /tmp/migration_validation_588.rs | sed -n '1,950p'
printf '%s\n' '== lexical authority =='
git show "${head}:${lex}" | nl -ba | sed -n '1,430p'
printf '%s\n' '== transaction projection =='
git show "${head}:${projection}" | nl -ba | sed -n '1,270p'
printf '%s\n' '== relevant public contracts =='
git ls-tree -r --name-only "$head" crates/persistence_postgres/tests |
rg -i 'migration.*(persistent|default|alter|session.*replication|runtime.*role|transaction).*\.rs$' |
while IFS= read -r file; do
echo "--- $file ---"
git show "${head}:${file}" | nl -ba
done
printf '%s\n' '== all scoped forms =='
git grep -n -C 15 -i -E \
'ALTER[[:space:]]+(ROLE|USER|DATABASE|SYSTEM)|USER[[:space:]]+MAPPING|IN[[:space:]]+DATABASE|FROM[[:space:]]+CURRENT|session_replication_role|RESET|DEFAULT|origin|local|replica|ROLLBACK|ABORT|BEGIN|COMMIT|comment|literal|dollar' \
"$head" -- "$src" "$lex" "$projection" crates/persistence_postgres/tests/*.rs
printf '%s\n' '== structural source check =='
python3 - <<'PY'
import subprocess
head='8c2d868031801874a0fb09108417ba7502138e3d'
for path in (
'crates/persistence_postgres/src/migration_validation.rs',
'crates/persistence_postgres/src/migration_validation_impl.rs',
'crates/persistence_postgres/src/migration_transaction_projection.rs',
):
source=subprocess.check_output(['git','show',f'{head}:{path}'], text=True)
print(f'{path}: brace_delta={source.count("{") - source.count("}")}')
PYLength of output: 203889 🤖 web_search executed:
Length of output: 14023 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='8c2d868031801874a0fb09108417ba7502138e3d'
src='crates/persistence_postgres/src/migration_validation.rs'
git show "${head}:${src}" > /tmp/mv588.rs
echo '== relevant function locations =='
rg -n '^\s*(pub\(super\)\s+)?fn\s+.*(persistent|default|alter|replica|configuration|setting)|persistent.*replica|ALTER SYSTEM|ALTER DATABASE|ALTER ROLE|ALTER USER|FROM CURRENT|USER MAPPING' /tmp/mv588.rs
echo '== focused persistent-default implementation =='
for name in $(rg -o '^\s*fn\s+[A-Za-z0-9_]+' /tmp/mv588.rs | sed -E 's/.*fn\s+//' | rg -i 'persistent|default|alter|configuration|setting|replica' | sort -u); do
line=$(rg -n -m1 "^\s*fn ${name}\b" /tmp/mv588.rs | cut -d: -f1)
echo "--- $name at $line ---"
nl -ba /tmp/mv588.rs | sed -n "$(( line > 20 ? line - 20 : 1 )),$((line+200))p"
done
echo '== execution-validation call order =='
rg -n -C 25 'project_committed_sql|committed_replica_trigger_execution_mode|persistent.*replica|declares_created_role' /tmp/mv588.rs
echo '== changed tests since alias RED =='
git diff --name-status d1088e7ed81595665c296c4151c3800e1d42162c "$head" -- crates/persistence_postgres/tests crates/persistence_postgres/src/migration_validation.rs
git diff --unified=80 d1088e7ed81595665c296c4151c3800e1d42162c "$head" -- crates/persistence_postgres/tests crates/persistence_postgres/src/migration_validation.rs
echo '== exact `#588` test candidates =='
git ls-tree -r --name-only "$head" crates/persistence_postgres/tests | rg -i '(persistent|default|alter.*(role|user|database|system)|replication.*default).*\.rs$' | while read -r f; do
echo "--- $f ---"
git show "${head}:${f}" | nl -ba
done
echo '== direct context around RESET DEFAULT FROM CURRENT =='
rg -n -C 45 'RESET|DEFAULT|FROM CURRENT|IN DATABASE|USER MAPPING|ALTER SYSTEM|ALTER DATABASE|ALTER USER|ALTER ROLE' /tmp/mv588.rs
git diff --check "${head}^" "$head"Length of output: 112436 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='8c2d868031801874a0fb09108417ba7502138e3d'
src='crates/persistence_postgres/src/migration_validation.rs'
lex='crates/persistence_postgres/src/migration_validation_impl.rs'
git show "${head}:${src}" > /tmp/mv588_edge.rs
git show "${head}:${lex}" > /tmp/mvl588_edge.rs
echo '== quoted-identifier normalization =='
rg -n -C 55 'fn scan_quoted_identifier|fn quoted_identifier|INVALID_QUOTED_IDENTIFIER|quoted.*identity|to_ascii_lowercase|normalize_migration_sql' /tmp/mvl588_edge.rs
echo '== exact persistent parser and preceding token helpers =='
nl -ba /tmp/mv588_edge.rs | sed -n '670,820p'
rg -n -C 25 'fn is_word_start|fn identifier_continues_after|fn next_sql_token_span|fn .*token' /tmp/mv588_edge.rs
echo '== all persistent-default tests and source cases =='
git grep -n -C 10 -i -E \
'ALTER (ROLE|USER|DATABASE|SYSTEM).*(session_replication_role|RESET|DEFAULT|FROM CURRENT)|USER MAPPING' \
"$head" -- crates/persistence_postgres/tests '*.rs'
echo '== exact current commit =='
git show --format=fuller --stat --oneline "$head"
git diff --unified=100 "${head}^" "$head" -- crates/persistence_postgres/src/migration_validation.rs crates/persistence_postgres/tests
echo '== syntax variants represented in parser =='
python3 - <<'PY'
# Static token trace for variant shapes against the inspected parser's tokenization rule.
cases = [
"ALTER ROLE tepp_app_runtime SET session_replication_role = replica",
'ALTER ROLE "tepp_app_runtime" SET session_replication_role = replica',
"ALTER ROLE ALL IN DATABASE tepp_database RESET ALL",
"ALTER USER MAPPING FOR tepp_app_runtime SERVER foreign_server OPTIONS (SET user 'replica')",
"ALTER SYSTEM RESET session_replication_role",
]
for sql in cases:
print(sql)
print(sql.replace('=', ' = ').split())
PY
git diff --check "${head}^" "$head"Length of output: 121092
The checkout matches the requested head. Public RED commits I found no source-level bypass or false positive in the requested scope.
The detector handles these persistent configuration surfaces:
For role-scoped commands, it treats The parser handles The detector accepts only direct ALTER USER tepp_app_runtime SET session_replication_role = origin;
ALTER ROLE ALL IN DATABASE tepp_database SET session_replication_role = local;
ALTER DATABASE tepp_database SET session_replication_role = local;
ALTER SYSTEM SET session_replication_role = origin;It does not classify unrelated role targets or unrelated parameters as protected mutations. The public controls cover
This conservative behavior can reject a migration where the inherited value is known externally to be safe. That is not a scientifically meaningful false positive to repair in this change. The validator cannot prove the final value without a first-class default-state aggregate and explicit scope-precedence modeling. The current fail-closed behavior is correct until that aggregate exists. I applied the existing PR guidance that Draft-skipped Actions are not execution or promotion evidence. This is exact-head source-review evidence only. I did not build, run tests, or execute PostgreSQL. 🧠 Learnings usedYou are interacting with an AI system. |
seonghobae
left a comment
There was a problem hiding this comment.
Exact-head source review for 8c2d868031801874a0fb09108417ba7502138e3d: #588 adds a persistent PostgreSQL execution-context boundary that was absent from #576–#587. PostgreSQL 18 applies ALTER ROLE / ALTER USER and ALTER DATABASE configuration values when fresh sessions start, and ALTER SYSTEM writes cluster defaults to postgresql.auto.conf; session_replication_role=replica suppresses ordinary/default triggers and rules. Public RED 9fdd078f7459a3d1e468f50846d44c43038f4c6a covers role/database/system replica defaults, FROM CURRENT, origin/local, unrelated targets, rollback, and opaque marker text. First repair 7cf0f42... adds a documented fold after the shared lexical + committed-state projection. PostgreSQL 18 documents ALTER USER as an alias for ALTER ROLE with the same {role_specification | ALL} [IN DATABASE ...] SET/RESET grammar; supplemental public RED d1088e7ed81595665c296c4151c3800e1d42162c exposed that omitted sibling, and current repair 8c2d868... folds USER onto the same authority while keeping ALTER USER MAPPING unrelated. Direct origin/local remain ordinary-trigger-safe. No executable migration SQL, workflow, dependency, threshold, coverage denominator, skip/xfail, or gate changed. Known bounded limitation is explicit: RESET/DEFAULT/FROM CURRENT and precedence are conservatively fail-closed until a first-class role/role+database/database/system default-state aggregate can prove final inherited state. This COMMENT is source review only, not approval or hosted GREEN; exact-head Rust Foundation 35349155710 is Draft-skipped.
|
@coderabbitai review Please review exact head Focus on PostgreSQL normalized |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
head='41f9cb437ee5ae114b46e15ab2ed2ff8d957be43'
red1='64735626dd86616020cdb60b90028adbf1d2a70a'
red2='f4e2aabbd844bfd16c3f83a4d18b1253bf60fdc8'
validation='crates/persistence_postgres/src/migration_validation.rs'
lexical='crates/persistence_postgres/src/migration_validation_impl.rs'
projection='crates/persistence_postgres/src/migration_transaction_projection.rs'
printf '%s\n' '== exact revision and RED ancestry =='
printf 'checkout='; git rev-parse HEAD
git diff --quiet "$head" HEAD && echo 'checkout-matches-requested-head'
for revision in "$red1" "$red2" "$head"; do
git show --no-patch --format='revision=%H%nparents=%P%nsubject=%s' "$revision"
git merge-base --is-ancestor "$revision" "$head" && echo 'is-ancestor=yes' || echo 'is-ancestor=no'
done
git log --oneline "${red1}^..${head}"
git diff --check "${head}^" "$head"
printf '%s\n' '== scoped repair changes =='
git diff --name-status "$red1" "$head" -- crates/persistence_postgres/src crates/persistence_postgres/tests
git diff --unified=100 "$red2" "$head" -- "$validation" "$lexical" "$projection" crates/persistence_postgres/tests
printf '%s\n' '== source outlines =='
for file in "$validation" "$lexical" "$projection"; do
printf '\n--- %s ---\n' "$file"
ast-grep outline "$file" --items all --type function,struct,enum,impl || true
done
printf '%s\n' '== persistent-default parser and validation order =='
git show "${head}:${validation}" > /tmp/migration_validation_589.rs
git show "${head}:${lexical}" > /tmp/migration_validation_impl_589.rs
rg -n -C 90 -i \
'fn .*persistent|fn .*unicode|fn .*set.*replica|ALTER[[:space:]]+(ROLE|USER|DATABASE|SYSTEM)|USER[[:space:]]+MAPPING|U&|UESCAPE|INVALID_QUOTED_IDENTIFIER|session_replication_role|RESET|DEFAULT|FROM[[:space:]]+CURRENT|origin|local|project_committed_sql|committed_replica_trigger_execution_mode|declares_created_role' \
/tmp/migration_validation_589.rs /tmp/migration_validation_impl_589.rs
printf '%s\n' '== focused source windows =='
nl -ba /tmp/migration_validation_589.rs | sed -n '1,1000p'
git show "${head}:${projection}" | nl -ba | sed -n '1,300p'
nl -ba /tmp/migration_validation_impl_589.rs | sed -n '1,430p'
printf '%s\n' '== relevant public contracts =='
git ls-tree -r --name-only "$head" crates/persistence_postgres/tests |
rg -i 'migration.*(unicode.*(persistent|default|alter)|persistent.*(unicode|default|alter)|session.*replication|alter.*(role|user|database|system)|transaction).*\.rs$' |
while IFS= read -r file; do
printf '\n--- %s ---\n' "$file"
git show "${head}:${file}" | nl -ba
done
printf '%s\n' '== exact scoped forms in source and tests =='
git grep -n -C 18 -i -E \
'ALTER[[:space:]]+(ROLE|USER|DATABASE|SYSTEM)|USER[[:space:]]+MAPPING|IN[[:space:]]+DATABASE|FROM[[:space:]]+CURRENT|U&|UESCAPE|INVALID_QUOTED_IDENTIFIER|session_replication_role|RESET|DEFAULT|origin|local|ROLLBACK|ABORT|BEGIN|COMMIT|comment|literal|dollar' \
"$head" -- "$validation" "$lexical" "$projection" crates/persistence_postgres/tests/*.rs
printf '%s\n' '== Rust source-level sanity checks =='
python3 - <<'PY'
import subprocess
head='41f9cb437ee5ae114b46e15ab2ed2ff8d957be43'
for path in (
'crates/persistence_postgres/src/migration_validation.rs',
'crates/persistence_postgres/src/migration_validation_impl.rs',
'crates/persistence_postgres/src/migration_transaction_projection.rs',
):
source = subprocess.check_output(['git', 'show', f'{head}:{path}'], text=True)
print(f'{path}: brace_delta={source.count("{") - source.count("}")}')
PYLength of output: 204094 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='41f9cb437ee5ae114b46e15ab2ed2ff8d957be43'
red='f4e2aabbd844bfd16c3f83a4d18b1253bf60fdc8'
src='crates/persistence_postgres/src/migration_validation.rs'
lex='crates/persistence_postgres/src/migration_validation_impl.rs'
projection='crates/persistence_postgres/src/migration_transaction_projection.rs'
test='crates/persistence_postgres/tests/migration_unicode_replication_role_login_default_contract.rs'
git show "${head}:${src}" > /tmp/mv589.rs
git show "${head}:${lex}" > /tmp/mvl589.rs
echo '== exact `#589` diff =='
git diff --unified=80 "$red" "$head" -- "$src" "$test"
echo '== persistent-parser symbols =='
rg -n '^\s*(pub\(super\)\s+)?fn\s+(statement_sets_unsafe_persistent_replication_role_default|.*persistent.*|.*unicode.*identity|unicode_identifier_end|project_potential_unicode.*|committed_replica_trigger_execution_mode|declares_created_role|next_sql_token_span)' /tmp/mv589.rs
echo '== persistent parser source =='
line=$(rg -n -m1 '^\s*fn\s+statement_sets_unsafe_persistent_replication_role_default\b' /tmp/mv589.rs | cut -d: -f1)
nl -ba /tmp/mv589.rs | sed -n "$((line-80)),$((line+360))p"
echo '== relevant Unicode helper source =='
rg -n -C 50 'UESCAPE|INVALID_QUOTED_IDENTIFIER|unicode_identifier_end|project_potential_unicode|fn scan_unicode_escaped_identifier|fn literal_is_atomic' /tmp/mv589.rs /tmp/mvl589.rs
echo '== caller and transaction projection =='
rg -n -C 25 'project_committed_sql|statement_sets_unsafe_persistent_replication_role_default|committed_replica_trigger_execution_mode|declares_created_role' /tmp/mv589.rs
git show "${head}:${projection}" | nl -ba | sed -n '1,230p'
echo '== scoped public contract =='
git show "${head}:${test}" | nl -ba
echo '== source-level type references in changed region =='
git diff --unified=25 "$red" "$head" -- "$src" |
rg -n -C 12 '^[+-].*(Vec|Option|Result|Iterator|split|find|map|matches|return|Some|None|U&|UESCAPE|INVALID)' || true
echo '== whitespace =='
git diff --check "${head}^" "$head"Length of output: 154070
The checkout matches the requested head. Public RED revisions I found one source-level false positive.
This valid statement targets the named role ALTER ROLE U&"current_user"
SET session_replication_role = replica;Before lexical normalization, U&"CURRENT_USER"The shared lexical projection then emits This rejects an unrelated role default. The same false positive applies to: ALTER USER U&"current_role"
SET session_replication_role = replica;
ALTER ROLE U&"session_user"
IN DATABASE tepp_database
RESET session_replication_role;Add public controls for the three lowercase Unicode-escaped named roles. Each should return Limit The scoped repair otherwise has the expected source-level behavior:
I found no Rust compile issue by source inspection. I did not build or run the code. This is source-review evidence only. Draft-skipped Actions are not hosted GREEN or qualifying approval. 🧠 Learnings usedYou are interacting with an AI system. |
|
@coderabbitai review Please re-review exact head Lineage:
Please check: (1) the reported false positive is actually removed; (2) ordinary |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
head='6583ac5963665305ba08ab1ac2c5fd52b6450d22'
red1='64735626dd86616020cdb60b90028adbf1d2a70a'
red2='f4e2aabbd844bfd16c3f83a4d18b1253bf60fdc8'
prior='41f9cb437ee5ae114b46e15ab2ed2ff8d957be43'
red3='5e356d68116dfb18294a487c505227470067ae0d'
src='crates/persistence_postgres/src/migration_validation.rs'
lex='crates/persistence_postgres/src/migration_validation_impl.rs'
projection='crates/persistence_postgres/src/migration_transaction_projection.rs'
printf '%s\n' '== exact revision and lineage =='
printf 'checkout='; git rev-parse HEAD
git diff --quiet "$head" HEAD && echo 'checkout-matches-requested-head'
for revision in "$red1" "$red2" "$prior" "$red3" "$head"; do
git show --no-patch --format='revision=%H%nparents=%P%nsubject=%s' "$revision"
git merge-base --is-ancestor "$revision" "$head" && echo 'is-ancestor=yes' || echo 'is-ancestor=no'
done
git log --oneline "${red1}^..${head}"
git diff --check "${head}^" "$head"
printf '%s\n' '== focused current repair diff =='
git diff --name-status "$red3" "$head" -- "$src" "$lex" "$projection" crates/persistence_postgres/tests
git diff --unified=100 "$red3" "$head" -- "$src" "$lex" "$projection" crates/persistence_postgres/tests
printf '%s\n' '== source maps =='
for file in "$src" "$lex" "$projection"; do
echo "--- $file ---"
ast-grep outline "$file" --items all --type function,struct,enum,impl || true
done
printf '%s\n' '== role preprojection, persistent defaults, unicode paths, and call flow =='
git show "${head}:${src}" > /tmp/migration_validation_589_rereview.rs
git show "${head}:${lex}" > /tmp/migration_validation_impl_589_rereview.rs
rg -n -C 80 -i \
'fn (preserve_quoted_special_role_specifications|statement_sets_unsafe_persistent_replication_role_default|project_potential_unicode|unicode_identifier_end|committed_replica_trigger_execution_mode|declares_created_role|next_sql_token_span)|CURRENT_USER|CURRENT_ROLE|SESSION_USER|tepp_app_runtime|session_replication_role|ALTER[[:space:]]+(ROLE|USER|DATABASE|SYSTEM)|U&|UESCAPE|INVALID_QUOTED_IDENTIFIER|RESET|origin|local|project_committed_sql' \
/tmp/migration_validation_589_rereview.rs /tmp/migration_validation_impl_589_rereview.rs
printf '%s\n' '== focused production ranges =='
nl -ba /tmp/migration_validation_589_rereview.rs | sed -n '680,1120p'
nl -ba /tmp/migration_validation_impl_589_rereview.rs | sed -n '150,390p'
git show "${head}:${projection}" | nl -ba | sed -n '1,240p'
printf '%s\n' '== relevant public contracts =='
git ls-tree -r --name-only "$head" crates/persistence_postgres/tests |
rg -i 'migration.*(unicode.*(replication|default|login|role)|replication.*(unicode|default|login)|persistent|session.*replication|transaction).*\.rs$' |
while IFS= read -r file; do
echo "--- $file ---"
git show "${head}:${file}" | nl -ba
done
printf '%s\n' '== all exact scoped controls =='
git grep -n -C 14 -i -E \
'U&|UESCAPE|INVALID_QUOTED_IDENTIFIER|CURRENT_USER|CURRENT_ROLE|SESSION_USER|tepp_app_runtime|session_replication_role|ALTER[[:space:]]+(ROLE|USER|DATABASE|SYSTEM)|RESET|DEFAULT|origin|local|ROLLBACK|ABORT|comment|literal|dollar' \
"$head" -- "$src" "$lex" "$projection" crates/persistence_postgres/tests/*.rs
printf '%s\n' '== structural source checks =='
python3 - <<'PY'
import subprocess
head='6583ac5963665305ba08ab1ac2c5fd52b6450d22'
for path in (
'crates/persistence_postgres/src/migration_validation.rs',
'crates/persistence_postgres/src/migration_validation_impl.rs',
'crates/persistence_postgres/src/migration_transaction_projection.rs',
):
source = subprocess.check_output(['git', 'show', f'{head}:{path}'], text=True)
print(f'{path}: brace_delta={source.count("{") - source.count("}")}')
PYLength of output: 204266 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='6583ac5963665305ba08ab1ac2c5fd52b6450d22'
red='5e356d68116dfb18294a487c505227470067ae0d'
src='crates/persistence_postgres/src/migration_validation.rs'
test='crates/persistence_postgres/tests/migration_unicode_replication_role_login_default_contract.rs'
git show "${head}:${src}" > /tmp/mv589_final.rs
echo '== exact head and ancestry =='
git rev-parse HEAD
git diff --quiet "$head" HEAD && echo checkout-matches-requested-head
for revision in 64735626dd86616020cdb60b90028adbf1d2a70a f4e2aabbd844bfd16c3f83a4d18b1253bf60fdc8 41f9cb437ee5ae114b46e15ab2ed2ff8d957be43 "$red"; do
git merge-base --is-ancestor "$revision" "$head" && echo "$revision ancestor=yes" || echo "$revision ancestor=no"
done
echo '== current repair diff =='
git diff --unified=45 "$red" "$head" -- "$src" "$test"
echo '== function locations =='
rg -n '^\s*fn\s+(preserve_quoted_special_role_specifications|statement_sets_unsafe_persistent_replication_role_default|unicode_identifier_end|project_potential_unicode|committed_replica_trigger_execution_mode|declares_created_role)\b' /tmp/mv589_final.rs
echo '== special-role preprojection and caller context =='
line=$(rg -n -m1 '^\s*fn\s+preserve_quoted_special_role_specifications\b' /tmp/mv589_final.rs | cut -d: -f1)
nl -ba /tmp/mv589_final.rs | sed -n "$((line-35)),$((line+145))p"
echo '== persistent-default parser =='
line=$(rg -n -m1 '^\s*fn\s+statement_sets_unsafe_persistent_replication_role_default\b' /tmp/mv589_final.rs | cut -d: -f1)
nl -ba /tmp/mv589_final.rs | sed -n "$((line-55)),$((line+335))p"
echo '== public unicode persistent-default contract =='
git show "${head}:${test}" | nl -ba
echo '== Rust syntax-oriented static scan =='
rg -n -C 3 'preserve_quoted_special_role_specifications|replace\(|strip_prefix|starts_with|unwrap\(|expect\(' /tmp/mv589_final.rs
git diff --check "${head}^" "$head"Length of output: 50800
The checkout matches the requested head. The listed RED revisions and prior repair are ancestors of this head. I found no source-level bypass, false positive, or structural Rust issue in the requested scope.
ALTER ROLE U&"current_user"
SET session_replication_role = replica;The shared lexical pass can now project this as the named lowercase role For ordinary quoted identifiers, the preprojection still converts: "current_user"
"current_role"
"session_user"to case-distinct quoted spellings before lifecycle normalization. These identifiers therefore cannot alias the unquoted PostgreSQL pseudo-targets The persistent-default parser still fails closed for protected Unicode identities:
Safely projected unrelated Unicode role and parameter identities remain accepted. The public contract includes The lifecycle path still normalizes SQL before applying committed-state projection. Comments, string literals, and dollar-quoted bodies remain opaque. Statements in a transaction that ends with The focused diff has balanced delimiters. I used the existing migration-validation guidance for fail-closed protected Unicode identities and committed-state projection. ✏️ Learnings added
🧠 Learnings usedYou are interacting with an AI system. |
|
@coderabbitai review Please review current exact head |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
head='2279ede859f304b70d43aded832a7dfca84b0de6'
red1='49e40000a7f0c85747d9f94593b865dfbb2fb975'
red2='156b873cef8bf3fe91ee729c50f82da817ed684c'
core='crates/persistence_postgres/src/migration_core.rs'
state='crates/persistence_postgres/src/migration_rls_table_state.rs'
projection='crates/persistence_postgres/src/migration_transaction_projection.rs'
lexical='crates/persistence_postgres/src/migration_validation_impl.rs'
printf '%s\n' '== exact revision and lineage =='
printf 'checkout='; git rev-parse HEAD
git diff --quiet "$head" HEAD && echo 'checkout-matches-requested-head'
for revision in "$red1" "$red2" "$head"; do
git show --no-patch --format='revision=%H%nparents=%P%nsubject=%s' "$revision"
git merge-base --is-ancestor "$revision" "$head" && echo 'is-ancestor=yes' || echo 'is-ancestor=no'
done
git log --oneline "${red1}^..${head}"
git diff --check "${head}^" "$head"
printf '%s\n' '== locate source and test files =='
fd -a 'migration.*(rls|table|state).*\.rs|migration_transaction_projection\.rs|migration_validation_impl\.rs' crates/persistence_postgres || true
git ls-tree -r --name-only "$head" crates/persistence_postgres/tests |
rg -i 'migration.*(rls|table.*state|transaction).*\.rs$' || true
printf '%s\n' '== scoped diff =='
git diff --name-status "${red1}^" "$head" -- crates/persistence_postgres/src crates/persistence_postgres/tests
git diff --unified=100 "$red2" "$head" -- crates/persistence_postgres/src crates/persistence_postgres/tests
printf '%s\n' '== source outlines =='
for file in "$core" "$state" "$projection" "$lexical"; do
if git cat-file -e "${head}:${file}" 2>/dev/null; then
echo "--- $file ---"
ast-grep outline "$file" --items all --type function,struct,enum,impl || true
fi
done
printf '%s\n' '== direct_table_target and state callers =='
git grep -n -C 60 -E \
'direct_table_target|migration_rls_table_state|ENABLE ROW LEVEL SECURITY|DISABLE ROW LEVEL SECURITY|FORCE ROW LEVEL SECURITY|NO FORCE ROW LEVEL SECURITY|project_committed_sql|ROLLBACK|ABORT' \
"$head" -- crates/persistence_postgres/src crates/persistence_postgres/tests
printf '%s\n' '== focused source snapshots =='
for file in "$core" "$state" "$projection" "$lexical"; do
if git cat-file -e "${head}:${file}" 2>/dev/null; then
echo "--- $file ---"
git show "${head}:${file}" | nl -ba | sed -n '1,1200p'
fi
done
printf '%s\n' '== relevant public tests =='
git ls-tree -r --name-only "$head" crates/persistence_postgres/tests |
rg -i 'migration.*(rls|table.*state|transaction).*\.rs$' |
while IFS= read -r file; do
echo "--- $file ---"
git show "${head}:${file}" | nl -ba
done
printf '%s\n' '== structural source checks =='
python3 - <<'PY'
import subprocess
head='2279ede859f304b70d43aded832a7dfca84b0de6'
for path in (
'crates/persistence_postgres/src/migration_core.rs',
'crates/persistence_postgres/src/migration_rls_table_state.rs',
'crates/persistence_postgres/src/migration_transaction_projection.rs',
'crates/persistence_postgres/src/migration_validation_impl.rs',
):
try:
source = subprocess.check_output(['git', 'show', f'{head}:{path}'], text=True)
except subprocess.CalledProcessError:
continue
print(f'{path}: brace_delta={source.count("{") - source.count("}")}')
PYLength of output: 116120 🏁 Script executed: #!/bin/bash
set -euo pipefail
head='2279ede859f304b70d43aded832a7dfca84b0de6'
red1='49e40000a7f0c85747d9f94593b865dfbb2fb975'
red2='156b873cef8bf3fe91ee729c50f82da817ed684c'
state='crates/persistence_postgres/src/migration_rls_table_state.rs'
test='crates/persistence_postgres/tests/migration_rls_table_final_state_contract.rs'
projection='crates/persistence_postgres/src/migration_transaction_projection.rs'
printf 'checkout='; git rev-parse HEAD
printf 'red1='; git rev-parse "$red1"
printf 'red2='; git rev-parse "$red2"
git merge-base --is-ancestor "$red1" "$head" && echo red1-is-ancestor
git merge-base --is-ancestor "$red2" "$head" && echo red2-is-ancestor
git show --no-patch --format='head_parents=%P%nhead_subject=%s' "$head"
git log --oneline "${red1}^..${head}"
echo '== exact repair diff =='
git diff --unified=100 "$red2" "$head" -- "$state" "$test"
git show "${head}:${state}" > /tmp/migration_rls_table_state_590.rs
echo '== direct_table_target definitions and callers =='
rg -n -C 80 'fn direct_table_target\b|direct_table_target\(|struct .*Rls|enum .*Rls|ALTER|ENABLE|DISABLE|FORCE|NO|ROLLBACK|ABORT' /tmp/migration_rls_table_state_590.rs
echo '== full compact state module =='
nl -ba /tmp/migration_rls_table_state_590.rs | sed -n '1,700p'
echo '== scoped contract =='
git show "${head}:${test}" | nl -ba
echo '== committed projection interface =='
git show "${head}:${projection}" | nl -ba | sed -n '1,260p'
echo '== exact surrounding caller integration =='
git grep -n -C 35 -E 'migration_rls_table_state|RlsTableState|direct_table_target|project_committed_sql' \
"$head" -- crates/persistence_postgres/src/migration_core.rs crates/persistence_postgres/src/migration_validation.rs crates/persistence_postgres/src/migration_rls_table_state.rs
echo '== whitespace =='
git diff --check "${head}^" "$head"Length of output: 106562
The checkout matches the requested head. Both public RED commits are ancestors. The current repair is the direct child of supplemental RED I found no source-level bypass or false positive in the requested scope.
ALTER TABLE public.tenant_record ...
ALTER TABLE public . tenant_record ...
ALTER TABLE public .tenant_record ...The helper rejects a period inside the target token. It also rejects a period at the start of the following token. Therefore, it cannot use The RLS state fold returns Unqualified targets still enter the state map by their table name. The existing enable, force, disable, and no-force ordering remains unchanged.
public . tenant_record
public .tenant_recordThe contract also verifies that a rolled-back qualified disable does not affect final state. The focused Rust change has balanced delimiters. I used the existing PR guidance that Draft-skipped CI is not execution or promotion evidence. This result is exact-head source-review evidence only. 🧠 Learnings usedYou are interacting with an AI system. |
Gap / owner boundary
AGENTS contract 12 requires durable database object names to contain at least two words and use
snake_caseby default. This Draft also owns bounded PostgreSQL final-state/execution-context validation for RLS, role, trigger, routine, table, retention, session-execution and persistent login-default state. It remains a bounded validator, not a complete PostgreSQL/procedural-language parser.Temporal/event/longitudinal scientific truth remains TEPP-owned. Reusable static psychometric arithmetic remains fast-mlsirm-owned; semantic LLM routing remains contextual-orchestrator-owned. No foreign-owner source copy or mutable-PR dependency is authorized.
Current stack authority
0fa4b71c0e8cd88d95c70c806af648e853ea7b08;f335624cea977fea7d7fe6f36871868557fe2bb7;0fa4b71c..., with parents2e3c57bc...andf335624....When #538 advanced by three ordinary-forward commits for #594, this dependent PR became diverged (ahead 313 / behind 3) and temporarily non-mergeable. The repair did not rebase or force-push. The merge commit preserves the full #521 history and inherits only the two #538 file deltas absent from the old base:
.github/workflows/hourly-nim-product-development.ymlandtests/quality/test_hourly_nim_cache_boundary.py. Exact comparison now proves #538 is the merge base and this branch is behind by 0.Foundation lifecycle/security/CodeQL prerequisites are inherited, not copied or bypassed here. #538 is Ready/open/mergeable at
f335624...but its new exact-head required workflows are still incomplete. #498 Dependency Graph support, canonical.github#2276GHAS configuration-identity read authority, exact-head proof that #594 removed the two Actions cache-poisoning findings, and qualifying independent approval remain prerequisites. No merge or predecessor-evidence transfer is authorized while those gates remain incomplete.Current bounded persistence contract
crate::migrationis the public facade. Forward and rollback SQL cross one PostgreSQL-aware lexical authority before structural validation; #560 owns committed-statement projection so rolled-back statements cannot donate final-state evidence.#564–#590 progressively bind final RLS/policy/table/trigger/append-only/retention routine state plus
session_replication_rolethrough directSET, canonicalset_config, writablepg_settings.setting, CTE/data-modifying CTE, row assignment, opaque immediateDO/CALL, Unicode-escaped identifiers and persistent role/user/database/system defaults. The architectural endpoint remains first-class final table/policy/trigger/routine/retention and execution/default-context state, canonical relation identity, plus one shared PostgreSQL Unicode identifier decoder. RESET/DEFAULT/FROM CURRENT precedence is still conservatively fail-closed pending that aggregate.#590 remains the last accepted production repair in this lane: schema qualification with whitespace around
.could alias sibling table RLS state inside the bounded projector;2279ede859f304b70d43aded832a7dfca84b0de6fails closed on those unsupported qualified identities. Scoped review found no additional #590 source-level bypass or false positive, but that is not hosted GREEN or qualifying approval.#591 hypothesis retirement
A subsequent hypothesis proposed rejecting
ALTER TABLE ... SET SCHEMAas an unsafe final-state mutation. Review showed the current TEPP contract has no schema-bound owner/ACL/search_path invariant, while PostgreSQL schema movement preserves the relation object and its attached columns/RLS/policy/trigger dependencies. Treating schema movement alone as unsafe would therefore add an unsupported false positive.Ordinary-forward history is preserved:
b741bca4d72b35857b78645d07d81f96b96ab451— public RED for the hypothesis;2e3c57bcabff660a69c2ce5fcae45ffd1424bbd9— retires that RED without any production repair or history rewrite;0fa4b71c0e8cd88d95c70c806af648e853ea7b08— preserves that retirement while inheriting the new foundation head ordinary-forward;not planned / no valid delta. Reopen only if TEPP later introduces a concrete schema-bound invariant.This retirement is intentional scientific/contract hygiene: fail-closed behavior is required only when a valid owned invariant is actually threatened.
Documentation / topology single-writer handoff
Historical pre-#543 53/53 rustdoc evidence is not current acceptance. #589/#590 changed semantic/rustdoc topology; #591 adds no production denominator after retirement. #539 must remeasure the whole owned-production topology only after #538 lands and #521 is subsequently restacked from protected
mainto a new exact head.docs/product-technical-gap-baseline.mdanddocs/TRACEABILITY.mdremain in #435's single-writer lane; accepted PostgreSQL authority, the rejected #591 hypothesis, and foundation security prerequisites belong there as decision evidence rather than parallel edits from this branch.Promotion boundary
The current merge from #538 only keeps the dependent stack coherent while the foundation is still open; it is not the post-landing restack. After #538 lands normally, surviving #521 delta must still be non-force restacked onto protected
main; that new exact head must reacquire Rust/Python/docs/security/Semgrep/CodeQL, Live PostgreSQL, owned-production rustdoc 100%, authored line/branch/edge 100%, resolved valid findings, applicable scientific/recovery evidence, and qualifying independent review before Ready promotion.No blind rerun, self-approval, bypass, force push, destructive rebase, skip/xfail, threshold/denominator manipulation, source rewriting, mutable foreign dependency, or predecessor-head evidence transfer is authorized.