Skip to content

security(backend): reject control characters in identifier fields - #699

Open
seonghobae wants to merge 21 commits into
mainfrom
security/harden-pydantic-strings-2205565764161335825
Open

security(backend): reject control characters in identifier fields#699
seonghobae wants to merge 21 commits into
mainfrom
security/harden-pydantic-strings-2205565764161335825

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Risk

Several user-controlled identifier and display-name fields accepted ASCII control characters, including CR, LF, NUL, terminal escapes, and DEL. Those values can corrupt logs, terminal output, line-oriented exports, or downstream parsers even when length constraints are present.

Exact current head

3447f8605fa5a43b5e797a2019ce0482b4ee58d6

This is a non-rewriting two-parent reconciliation of predecessor a1601be1a6d5bd07d941d17799040640651cfcd6 and protected main 183331e1054fb14b4c017e77fcd0aae99e949277. The branch is zero commits behind main, GitHub computes it mergeable, and the effective comparison remains limited to backend/app/schemas.py and backend/tests/test_schema_validation.py. Predecessor-head checks and reviews are historical only.

Change

Apply the shared printable-name policy to protected project, connection, diagram-view, schema, relation, and API-key names. The policy rejects U+0000U+001F and U+007F without silently rewriting values. Ordinary punctuation, spaces, Korean, Japanese, emoji, underscores, and hyphens remain valid.

The annotation body remains intentionally multiline and is not subject to identifier validation; each output sink remains responsible for context-appropriate escaping.

Regression coverage

  • reject every prohibited control at the beginning, middle, and end of every hardened field;
  • preserve each field's existing length contract;
  • accept realistic multilingual and supplementary-plane names;
  • preserve multiline annotation content;
  • retain the complete backend mypy, pytest, production coverage, and docstring gates.

Standards and doctoring

docs/doctoring/identifier-control-character-validation.md defines the threat model, boundary, invariants, test evidence, monitoring, and rollback policy with APA 7 references to CWE-117 and Unicode 17.0. CHANGELOG.md records the buyer-visible behavior.

Exact-head merge contract

Repository CI, Security Scan, and Semgrep were queued after the reconciliation. The stale OpenCode change request bound to predecessor a1601be1... was dismissed without converting it into approval. Merge remains blocked until this unchanged exact head has every required CI/security/coverage/review context successful, zero valid unresolved findings, and a qualifying independent non-author approval. No predecessor evidence transfers and no protection or test may be bypassed.

schema.py 내 `DiagramViewCreateIn.name`, `TableAnnotationUpsertIn.schema_name`, `TableAnnotationUpsertIn.relation_name`, `ApiKeyCreateIn.key_name` 등 주요 Pydantic 입력 필드에 ASCII 제어 문자(0x00-0x1F, 0x7F)를 차단하는 정규식(`pattern=r"^[^\x00-\x1F\x7F]+$"`)을 추가했습니다.

이를 통해 로그 인젝션(Log Forging) 및 다운스트림 파싱 시 발생할 수 있는 취약점을 사전에 방지합니다.
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

입력 스키마의 네 문자열 필드에 제어 문자 거부 검증을 추가했습니다. 관련 백엔드 테스트를 확장했습니다. 프런트엔드 개발 의존성 버전과 커버리지 테스트의 비동기 검증을 갱신했습니다.

Changes

입력 문자열 검증

Layer / File(s) Summary
문자열 필드 제약 조건
backend/app/schemas.py, .jules/sentinel.md
DiagramViewCreateIn.name, TableAnnotationUpsertIn.schema_name, TableAnnotationUpsertIn.relation_name, ApiKeyCreateIn.key_name에 ASCII 제어 문자와 DEL 문자 거부 패턴을 추가했습니다. 보안 기록에 관련 내용을 문서화했습니다.
스키마 검증 테스트
backend/tests/test_schema_validation.py
다국어·기호 문자열의 허용 동작과 문자열 앞·중간·뒤의 제어 문자 거부 동작을 테스트했습니다. TableAnnotationUpsertIn.body의 개행과 탭 허용 동작도 테스트했습니다.

프런트엔드 테스트 유지보수

Layer / File(s) Summary
프런트엔드 커버리지 테스트 조정
frontend/package.json, frontend/src/App.coverage.test.tsx
React 관련 개발 의존성 버전을 조정했습니다. 테스트가 다이어그램 열기 버튼 렌더링을 기다리도록 변경했습니다. 검색 결과 없음 메시지는 부분 텍스트로 검증합니다.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch security/harden-pydantic-strings-2205565764161335825

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.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head c8576ae074d3a093347b4e6b58cabc990cac6b06.

  • Head SHA: c8576ae074d3a093347b4e6b58cabc990cac6b06

  • Workflow run: 30726762909

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file: sentinel.md"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file: sentinel.md"]
  R1 --> V1["required checks"]
  Evidence --> S2["Backend: schemas.py"]
  S2 --> I2["API and service runtime"]
  I2 --> R2["Review risk: Backend: schemas.py"]
  R2 --> V2["backend tests"]
Loading

@opencode-agent

opencode-agent Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: a1601be1a6d5bd07d941d17799040640651cfcd6
  • Workflow run: 31748234924
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head a1601be1a6d5bd07d941d17799040640651cfcd6.

  • Head SHA: a1601be1a6d5bd07d941d17799040640651cfcd6

  • Workflow run: 31748234924

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Backend (2 files)"]
  S1 --> I1["API and service runtime"]
  I1 --> R1["Review risk: Backend (2 files)"]
  R1 --> V1["backend tests"]
Loading

Copy link
Copy Markdown
Collaborator Author

@jules Please add a focused follow-up commit before merge:

  1. Add backend unit tests for every newly constrained field: DiagramViewCreateIn.name, TableAnnotationUpsertIn.schema_name, TableAnnotationUpsertIn.relation_name, and ApiKeyCreateIn.key_name.
  2. For each field, prove representative valid Unicode/database identifiers are accepted and every ASCII control character U+0000U+001F plus U+007F is rejected wherever it appears (prefix, middle, and suffix are sufficient if parametrized without unnecessary duplication). Assert Pydantic raises ValidationError.
  3. Keep free-text TableAnnotationUpsertIn.body behavior unchanged; add a regression assertion if needed so this hardening does not accidentally prohibit intended multiline annotation content.
  4. Correct the new .jules/sentinel.md heading date from 2025-02-18 to 2026-08-01 and retain all prior history.
  5. Keep changes scoped. Run backend typecheck and the full backend test suite before pushing.

@google-labs-jules

Copy link
Copy Markdown

@jules Please add a focused follow-up commit before merge:

  1. Add backend unit tests for every newly constrained field: DiagramViewCreateIn.name, TableAnnotationUpsertIn.schema_name, TableAnnotationUpsertIn.relation_name, and ApiKeyCreateIn.key_name.
  2. For each field, prove representative valid Unicode/database identifiers are accepted and every ASCII control character U+0000U+001F plus U+007F is rejected wherever it appears (prefix, middle, and suffix are sufficient if parametrized without unnecessary duplication). Assert Pydantic raises ValidationError.
  3. Keep free-text TableAnnotationUpsertIn.body behavior unchanged; add a regression assertion if needed so this hardening does not accidentally prohibit intended multiline annotation content.
  4. Correct the new .jules/sentinel.md heading date from 2025-02-18 to 2026-08-01 and retain all prior history.
  5. Keep changes scoped. Run backend typecheck and the full backend test suite before pushing.

요청하신 대로 백엔드 유닛 테스트를 추가하고 모든 요구사항을 반영했습니다:

  1. DiagramViewCreateIn.name, TableAnnotationUpsertIn.schema_name, TableAnnotationUpsertIn.relation_name, ApiKeyCreateIn.key_name 등 새롭게 제한된 모든 필드에 대한 테스트를 test_schema_validation.py에 추가했습니다.
  2. 매개변수화된 테스트를 통해 유니코드 입력(한국어, 일본어, 특수기호 등)이 정상적으로 허용되며, 문자열 중간/앞/뒤에 포함된 ASCII 제어 문자(U+0000U+001F, U+007F)는 모두 ValidationError로 차단됨을 증명했습니다.
  3. TableAnnotationUpsertIn.body에 대한 회귀 테스트를 추가하여, 개행문자(\n, \r\n) 및 탭(\t)이 정상적으로 허용되어 멀티라인 주석 처리가 의도대로 작동함을 보장했습니다.
  4. .jules/sentinel.md 내 최신 항목의 날짜를 2026-08-01로 수정하고 이전 기록도 모두 유지했습니다.
  5. 모든 백엔드 테스트를 통과했으며(uv run pytest tests/ 기준), backend/uv.lock과 같이 관련 없는 파일이 커밋되지 않도록 제외하고 범위 내의 변경 사항만 포함시켰습니다.

schema.py 내 `DiagramViewCreateIn.name`, `TableAnnotationUpsertIn.schema_name`, `TableAnnotationUpsertIn.relation_name`, `ApiKeyCreateIn.key_name` 등 주요 Pydantic 입력 필드에 ASCII 제어 문자(0x00-0x1F, 0x7F)를 차단하는 정규식(`pattern=r"^[^\x00-\x1F\x7F]+$"`)을 추가했습니다.
관련 테스트를 작성하여 유니코드 문자는 정상 허용되고 제어 문자는 차단되며, `body` 같은 다중 라인 필드는 영향을 받지 않음을 검증했습니다.

Copy link
Copy Markdown
Collaborator Author

@jules One small test defect remains: the position_fmt cases currently test a prefix once and a suffix twice ("{}middle", "start{}", "end{}"). Replace them with unambiguous prefix, middle, and suffix placements such as "{}suffix", "pre{}post", and "prefix{}". Keep the exhaustive U+0000–U+001F/U+007F parametrization, valid Unicode cases, multiline-body regression, and corrected 2026-08-01 log entry. Run formatting/typecheck and the full backend suite after the correction.

@seonghobae
seonghobae enabled auto-merge (squash) August 3, 2026 02:08
@google-labs-jules

Copy link
Copy Markdown

@jules One small test defect remains: the position_fmt cases currently test a prefix once and a suffix twice ("{}middle", "start{}", "end{}"). Replace them with unambiguous prefix, middle, and suffix placements such as "{}suffix", "pre{}post", and "prefix{}". Keep the exhaustive U+0000–U+001F/U+007F parametrization, valid Unicode cases, multiline-body regression, and corrected 2026-08-01 log entry. Run formatting/typecheck and the full backend suite after the correction.

코드 리뷰를 반영하여 테스트 스위트의 결함을 수정했습니다.

test_hardened_pydantic_strings_reject_control_characters 내의 position_fmt 파라미터 설정을 불분명한 접미사 중복("{}middle", "start{}", "end{}")에서 명확한 접두사, 중간, 접미사 배치("{}suffix", "pre{}post", "prefix{}")로 올바르게 업데이트했습니다.

이 수정과 함께 백엔드 포맷팅(uv run ruff format .), 린팅(uv run ruff check . --fix), 전체 테스트 스위트 통과(uv run pytest tests/)를 모두 성공적으로 완료했습니다. 그리고 요청하신 대로 .jules/sentinel.md 파일도 올바르게 수정되었습니다.

seonghobae and others added 2 commits August 3, 2026 02:29
schema.py 내 `DiagramViewCreateIn.name`, `TableAnnotationUpsertIn.schema_name`, `TableAnnotationUpsertIn.relation_name`, `ApiKeyCreateIn.key_name` 등 주요 Pydantic 입력 필드에 ASCII 제어 문자(0x00-0x1F, 0x7F)를 차단하는 정규식(`pattern=r"^[^\x00-\x1F\x7F]+$"`)을 추가했습니다.
관련 테스트를 작성하여 유니코드 문자는 정상 허용되고 제어 문자는 차단되며, `body` 같은 다중 라인 필드는 영향을 받지 않음을 검증했습니다. 매개변수형 테스트 위치 지정 포맷 또한 리뷰 피드백을 수용하여 명확히 수정되었습니다.
@seonghobae seonghobae changed the title 🛡️ Sentinel: [MEDIUM] Pydantic 문자열 필드 제어 문자 검증 추가 security(backend): reject control characters in identifier fields Aug 3, 2026
@seonghobae
seonghobae dismissed opencode-agent[bot]’s stale review August 3, 2026 03:49

Dismissed as stale: this automated request-for-changes was bound to head c8576ae. The current head is 6b14cd5 and its repository CI, Security Scan, and Semgrep runs all completed successfully. A fresh current-head automated review remains required before merge.

@seonghobae
seonghobae marked this pull request as draft August 3, 2026 03:51
auto-merge was automatically disabled August 3, 2026 03:51

Pull request was converted to draft

@seonghobae
seonghobae marked this pull request as ready for review August 3, 2026 03:51
@seonghobae
seonghobae enabled auto-merge (squash) August 3, 2026 03:51

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
✅ 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 August 3, 2026 05:44
auto-merge was automatically disabled August 3, 2026 05:44

Pull request was converted to draft

@seonghobae
seonghobae marked this pull request as ready for review August 3, 2026 05:44
@seonghobae
seonghobae enabled auto-merge (squash) August 3, 2026 05:45

Copy link
Copy Markdown
Collaborator Author

Exact-current-head independent review request for 8b5538e982f81cf9c154c2736d4dc8e80e10927e (identifier control-character boundary). Repository CI, Security Scan, and SAST Semgrep are terminal-success on this SHA, and zero unresolved review threads remain. Existing CHANGES_REQUESTED verdicts are predecessor evidence and must not be treated as current-head findings.

@opencode-agent @cwl-noema-review Please review only this unchanged exact head and provide a qualifying non-author formal verdict. Do not modify the branch, bypass protection, merge, tag, release, or publish.

@seonghobae
seonghobae dismissed stale reviews from opencode-agent[bot] and opencode-agent[bot] August 12, 2026 12:38

Dismissed as technically superseded by exact-current-head evidence: on unchanged head 8b5538e, both coverage-evidence (check 93193871121) and opencode-review (check 93193877660) completed successfully, while repository CI, security and docstring coverage gates are also green. The review's sole stated blocker was failed coverage evidence, so no valid product finding remains. This does not create approval or bypass the required independent non-author approval gate.

@seonghobae
seonghobae enabled auto-merge (squash) August 12, 2026 12:39

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head 8b5538e982f81cf9c154c2736d4dc8e80e10927e.

  • Head SHA: 8b5538e982f81cf9c154c2736d4dc8e80e10927e

  • Workflow run: 31598958042

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file: sentinel.md"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file: sentinel.md"]
  R1 --> V1["required checks"]
  Evidence --> S2["Backend (2 files)"]
  S2 --> I2["API and service runtime"]
  I2 --> R2["Review risk: Backend (2 files)"]
  R2 --> V2["backend tests"]
Loading

@opencode-agent
opencode-agent Bot disabled auto-merge August 12, 2026 15:23

Copy link
Copy Markdown
Collaborator Author

@opencode-agent review

Please re-evaluate exact unchanged head 8b5538e982f81cf9c154c2736d4dc8e80e10927e for the identifier control-character boundary. The current-head coverage-evidence check 94353452726 is now terminal-success, as is opencode-review; the existing CHANGES_REQUESTED verdict cites the predecessor failure condition that this current evidence has cleared. Submit a new formal verdict only after independently confirming this exact head.

@seonghobae
seonghobae dismissed opencode-agent[bot]’s stale review August 13, 2026 08:23

Superseded by same-head terminal-success coverage evidence check 94353452726. The review's only stated blocker was missing/failed coverage evidence; no approval is manufactured by this dismissal, and branch protection remains authoritative.

@seonghobae
seonghobae enabled auto-merge (squash) August 13, 2026 08:23

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head 8b5538e982f81cf9c154c2736d4dc8e80e10927e.

  • Head SHA: 8b5538e982f81cf9c154c2736d4dc8e80e10927e

  • Workflow run: 31700563334

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file: sentinel.md"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file: sentinel.md"]
  R1 --> V1["required checks"]
  Evidence --> S2["Backend (2 files)"]
  S2 --> I2["API and service runtime"]
  I2 --> R2["Review risk: Backend (2 files)"]
  R2 --> V2["backend tests"]
Loading

@seonghobae
seonghobae dismissed opencode-agent[bot]’s stale review August 13, 2026 18:23

Dismissed as stale predecessor-head infrastructure evidence. This review is explicitly bound to 8b5538e; current exact head a1601be is four commits ahead and has terminal-success coverage-evidence, coverage-source-tree, and all required workflows. No current-head review thread is unresolved.

Copy link
Copy Markdown
Collaborator Author

@opencode-agent review @cwl-noema-review review Please independently review unchanged exact head a1601be1a6d5bd07d941d17799040640651cfcd6 for the identifier control-character boundary. All exact-head checks are terminal-acceptable, GitHub computes mergeable=true against current protected main, and no unresolved review thread remains. CodeRabbit's supporting review is not formal approval. Submit a qualifying non-author formal verdict only if this exact SHA has no blocker; do not modify the branch, bypass protection, merge, tag, or release.

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review\n\nPlease review unchanged exact head a1601be1a6d5bd07d941d17799040640651cfcd6 against current protected main for the identifier control-character rejection boundary. All exact-head check runs are terminal-acceptable and no review thread is unresolved. Review only; do not modify or merge.

@coderabbitai

coderabbitai Bot commented Aug 13, 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/pg-erd-cloud'
pr='699'
expected='a1601be1a6d5bd07d941d17799040640651cfcd6'

actual="$(git rev-parse HEAD)"
printf 'checked_out_head=%s\nexpected_head=%s\n' "$actual" "$expected"
if [ "$actual" != "$expected" ]; then
  echo 'ERROR: checked-out revision does not match the requested exact head' >&2
  exit 2
fi

pr_json="$(gh pr view "$pr" --repo "$repo" --json headRefOid,baseRefName,baseRefOid,mergeStateStatus,isDraft,statusCheckRollup)"
head_oid="$(jq -r '.headRefOid' <<<"$pr_json")"
base_name="$(jq -r '.baseRefName' <<<"$pr_json")"
base_oid="$(jq -r '.baseRefOid' <<<"$pr_json")"
printf 'github_head=%s\nbase_ref=%s\nbase_oid=%s\n' "$head_oid" "$base_name" "$base_oid"
if [ "$head_oid" != "$expected" ]; then
  echo 'ERROR: GitHub PR head does not match the requested exact head' >&2
  exit 3
fi

merge_base="$(git merge-base "$base_oid" "$expected")"
printf 'merge_base=%s\n' "$merge_base"

echo '--- cumulative changed-file scope: current protected-main merge base to exact head ---'
git diff --no-ext-diff --name-status "$merge_base" "$expected"

echo '--- cumulative focused diff ---'
git diff --no-ext-diff --unified=80 "$merge_base" "$expected" -- \
  backend/app/schemas.py backend/tests/test_schema_validation.py .jules/sentinel.md

echo '--- changed Python AST outlines ---'
git diff --name-only "$merge_base" "$expected" -- '*.py' | while IFS= read -r file; do
  printf '\n### %s\n' "$file"
  ast-grep outline "$file" --items all || true
done

echo '--- relevant schema definitions and validation tests ---'
rg -n -C 8 --glob '*.py' \
  '(class\s+(DiagramViewCreateIn|TableAnnotationUpsertIn|ApiKeyCreateIn)\b|^\s*(name|schema_name|relation_name|key_name|body)\s*:|ValidationError|position_fmt|\\x00|\\x1F|\\x7F)' \
  backend/app/schemas.py backend/tests/test_schema_validation.py

echo '--- API request-model bindings ---'
rg -n -C 4 --glob '*.py' \
  '(body:\s*(DiagramViewCreateIn|TableAnnotationUpsertIn|ApiKeyCreateIn)\b|async def (create_view|upsert_annotation|create_api_key)\s*\()' \
  backend/app/api

echo '--- whitespace errors ---'
git diff --check "$merge_base" "$expected"

echo '--- GitHub checks and pull request state ---'
jq '{headRefOid, baseRefName, baseRefOid, mergeStateStatus, isDraft, checks: [.statusCheckRollup[]? | {name, status, conclusion, detailsUrl}]}' <<<"$pr_json"

echo '--- unresolved review threads ---'
gh api graphql -F owner='ContextualWisdomLab' -F name='pg-erd-cloud' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          comments(first: 1) { nodes { author { login } body } }
        }
      }
    }
  }
}' --jq '[.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | {isOutdated, author: .comments.nodes[0].author.login, body: .comments.nodes[0].body}]'

Length of output: 40032


@seonghobae Review complete for exact head a1601be1a6d5bd07d941d17799040640651cfcd6.

I used the current protected-main merge base, 3c1c7aae7b72e34ca9b48b578b0573736daba8fd, for this review.

No blocking code finding found.

  • The cumulative diff contains only backend/app/schemas.py and backend/tests/test_schema_validation.py.
  • DiagramViewCreateIn.name, TableAnnotationUpsertIn.schema_name, TableAnnotationUpsertIn.relation_name, and ApiKeyCreateIn.key_name reject U+0000U+001F and U+007F at the Pydantic model boundary.
  • The tests cover each prohibited character at prefix, middle, and suffix positions. Each case asserts ValidationError.
  • The valid-input tests include Korean, Japanese, emoji, spaces, underscores, and hyphens.
  • TableAnnotationUpsertIn.body still accepts multiline content with LF, CRLF, and tab characters.
  • The affected API endpoints use the hardened request models.
  • Backend, coverage, Semgrep, dependency, and security checks are terminal-success or terminal-neutral. No unresolved review threads exist.

GitHub reports mergeStateStatus: BLOCKED. The retrieved check data does not show a failing check that explains this state. This is not a validation-boundary finding.


🧠 Learnings used
Learnt from: seonghobae
Repo: ContextualWisdomLab/pg-erd-cloud PR: 0
File: :0-0
Timestamp: 2026-08-13T18:47:24.253Z
Learning: For pull request `#835` in ContextualWisdomLab/pg-erd-cloud, assess pull request scope against the current protected-main merge base. Do not use an incremental predecessor comparison to attribute inherited mainline behavior, such as `frontend/src/App.tsx` search caching or snapshot polling, to the pull request.

You are interacting with an AI system.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head a1601be1a6d5bd07d941d17799040640651cfcd6.

  • Head SHA: a1601be1a6d5bd07d941d17799040640651cfcd6

  • Workflow run: 31748234924

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Backend (2 files)"]
  S1 --> I1["API and service runtime"]
  I1 --> R1["Review risk: Backend (2 files)"]
  R1 --> V1["backend tests"]
Loading

@opencode-agent
opencode-agent Bot disabled auto-merge August 13, 2026 22:48
@seonghobae
seonghobae dismissed opencode-agent[bot]’s stale review August 14, 2026 09:42

Stale predecessor-head review: this change request is explicitly bound to a1601be1a6d5bd07d941d17799040640651cfcd6. Current exact head 3447f8605fa5a43b5e797a2019ce0482b4ee58d6 is a non-rewriting merge with protected main 183331e1054fb14b4c017e77fcd0aae99e949277; predecessor coverage/review evidence neither passes nor blocks the new head. A fresh exact-head coverage and OpenCode review remains mandatory.

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Please review unchanged exact head 3447f8605fa5a43b5e797a2019ce0482b4ee58d6. The current comparison is limited to the two backend validation/test files, protected main 183331e1054fb14b4c017e77fcd0aae99e949277 is a parent, and predecessor reviews/checks are historical only.

@seonghobae
seonghobae enabled auto-merge (squash) August 14, 2026 09:43
@coderabbitai

coderabbitai Bot commented Aug 14, 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/pg-erd-cloud'
pr='699'
expected='3447f8605fa5a43b5e797a2019ce0482b4ee58d6'
parent='183331e1054fb14b4c017e77fcd0aae99e949277'

actual="$(git rev-parse HEAD)"
printf 'checked_out_head=%s\nexpected_head=%s\nparent=%s\n' "$actual" "$expected" "$parent"
test "$actual" = "$expected"

printf '\n--- Parent relationship ---\n'
git merge-base --is-ancestor "$parent" "$expected"
git rev-parse "${expected}^"
git diff --no-ext-diff --name-status "$parent" "$expected"
git diff --check "$parent" "$expected"

printf '\n--- Focused diff ---\n'
git diff --no-ext-diff --unified=80 "$parent" "$expected" -- \
  backend/app/schemas.py \
  backend/tests/test_schema_validation.py

printf '\n--- Changed-file outlines ---\n'
ast-grep outline backend/app/schemas.py --items all --match 'DiagramViewCreateIn|TableAnnotationUpsertIn|ApiKeyCreateIn'
ast-grep outline backend/tests/test_schema_validation.py --items all

printf '\n--- Relevant declarations and test cases ---\n'
rg -n -C 8 --glob '*.py' \
  '(class\s+(DiagramViewCreateIn|TableAnnotationUpsertIn|ApiKeyCreateIn)\b|^\s*(name|schema_name|relation_name|key_name|body)\s*:|ValidationError|position_fmt|control|\\x00|\\x1F|\\x7F|multiline)' \
  backend/app/schemas.py backend/tests/test_schema_validation.py

printf '\n--- API model bindings ---\n'
rg -n -C 4 --glob '*.py' \
  '(body:\s*(DiagramViewCreateIn|TableAnnotationUpsertIn|ApiKeyCreateIn)\b|async def (create_view|upsert_annotation|create_api_key)\s*\()' \
  backend/app/api

printf '\n--- GitHub PR state, exact head, and checks ---\n'
gh pr view "$pr" --repo "$repo" \
  --json headRefOid,baseRefOid,baseRefName,mergeStateStatus,isDraft,statusCheckRollup \
  --jq '{headRefOid,baseRefOid,baseRefName,mergeStateStatus,isDraft,checks:[.statusCheckRollup[]? | {name,status,conclusion,detailsUrl}]}'

printf '\n--- Unresolved review threads ---\n'
gh api graphql -F owner='ContextualWisdomLab' -F name='pg-erd-cloud' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes {
          isResolved
          isOutdated
          comments(first: 1) { nodes { author { login } body } }
        }
      }
    }
  }
}' --jq '[.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | {isOutdated,author:.comments.nodes[0].author.login,body:.comments.nodes[0].body}]'

Length of output: 34006


@seonghobae Review complete for exact head 3447f8605fa5a43b5e797a2019ce0482b4ee58d6.

No blocking code finding was found.

  • The checked-out commit and GitHub pull request head match the requested SHA.
  • Protected main 183331e1054fb14b4c017e77fcd0aae99e949277 is an ancestor of the reviewed head.
  • The comparison changes only backend/app/schemas.py and backend/tests/test_schema_validation.py.
  • DiagramViewCreateIn.name, TableAnnotationUpsertIn.schema_name, TableAnnotationUpsertIn.relation_name, and ApiKeyCreateIn.key_name reject U+0000U+001F and U+007F at the Pydantic model boundary.
  • The parametrized test covers every prohibited character at prefix, middle, and suffix positions. Each invalid case asserts ValidationError.
  • The valid-input test accepts Korean, Japanese, emoji, spaces, underscores, and hyphens.
  • TableAnnotationUpsertIn.body remains unrestricted by the identifier pattern and has multiline LF, CRLF, and tab regression coverage.
  • The diagram-view, annotation, and API-key endpoints use the hardened request models.
  • No unresolved review threads exist.

Current checks are still queued. GitHub reports mergeStateStatus: BLOCKED. Therefore, CI, coverage, and security results are not yet verifiable for this exact head.

You are interacting with an AI system.

Copy link
Copy Markdown
Collaborator Author

@opencode-agent review

Please submit a formal independent review for unchanged exact head 3447f8605fa5a43b5e797a2019ce0482b4ee58d6 only if it satisfies the current live-base and repository policy. Protected main 183331e1054fb14b4c017e77fcd0aae99e949277 is the exact base; GitHub reports mergeable=true; repository CI, Security Scan, SAST Semgrep, and CodeRabbit status are successful; there are zero unresolved threads and no active decisive review. Review the bounded identifier-field control-character rejection; do not reuse predecessor or status-only evidence, and do not approve unless this exact head is independently acceptable.

Copy link
Copy Markdown
Collaborator Author

Merge-blocking exact-head review for 3447f8605fa5a43b5e797a2019ce0482b4ee58d6 against protected main 183331e1054fb14b4c017e77fcd0aae99e949277:

TableAnnotationUpsertIn.schema_name and .relation_name identify externally introspected PostgreSQL objects, so the new printable-only pattern narrows the wrong domain. PostgreSQL 18 specifies that quoted identifiers may contain any character except code zero; tab, newline, other controls, Unicode and doubled quotes can therefore be part of a legitimate exact object name: https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

The parameterized tests currently bless the regression by requiring all C0 characters to fail for those identifier fields. That makes valid existing relations unaddressable through annotation APIs and conflicts with the #747/#834 lossless identifier boundary. New PR #885 is a test-weaker duplicate of this same defect.

Smallest remedy: remove the printable-label policy from schema_name and relation_name; keep any human-label policy scoped to DiagramViewCreateIn.name and ApiKeyCreateIn.key_name; fix log safety at structured/escaped sinks rather than rewriting the identifier domain. Replace annotation tests with exact PostgreSQL cases for quoted mixed-case/Unicode, embedded quote, tab/newline/control characters, NUL rejection and the 63-UTF-8-byte boundary, plus endpoint lookup/round-trip evidence. Re-run exact-head backend/PostgreSQL/security gates and obtain qualifying independent approval; close #885 after proving it contains no unique safe behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant