Skip to content

🧪 [테스트 커버리지 개선: get_encryption_keyring] - #1290

Closed
seonghobae wants to merge 6 commits into
developfrom
test/encryption-keyring-models-16609055666231458608
Closed

🧪 [테스트 커버리지 개선: get_encryption_keyring]#1290
seonghobae wants to merge 6 commits into
developfrom
test/encryption-keyring-models-16609055666231458608

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Superseded

This focused test lane is closed without merge because its complete useful diff has been preserved on the current-base canonical encryption-key regression PR #1287.

The db.models.get_encryption_keyring coverage from current head fe9d0bd09ec3db1c263a72d7f29f813e1d2578cb—active-key construction, previous-key preservation, real Fernet decryptability, and fail-closed missing-key behavior—is now present on #1287 as backend/tests/test_db_models.py.

#1287 also consolidates adjacent runtime keyring and key-identifier boundary coverage, reducing parallel micro-PRs on one encryption-key contract. #1287 must independently pass exact-head CI, coverage, security, review, and protected-branch governance before merge.

@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 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 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e8d44f4c-9c5d-4153-93da-d00528ab0a5c

📝 Walkthrough

Walkthrough

The pull request adds a Trivy vulnerability ignore entry and tests for get_encryption_keyring. The tests cover keyring creation, previous-key handling, active-key IDs, and missing-key errors.

Changes

Security ignore update

Layer / File(s) Summary
Trivy vulnerability ignore
.trivyignore
Adds CVE-2026-67213 to the Trivy ignore list.

Encryption keyring tests

Layer / File(s) Summary
Encryption keyring validation
backend/tests/test_db_models.py
Adds tests for primary-key creation, previous-key parsing, active-key IDs, and the RuntimeError raised when the required encryption key is missing.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
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 The title clearly identifies the test coverage improvement for get_encryption_keyring, which is the main change in the pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/encryption-keyring-models-16609055666231458608

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.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (2)
backend/tests/test_db_models.py (2)

37-44: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover empty and whitespace-only keys.

backend/core/runtime_secrets.py:144-176 rejects both None and values where active_key_value.strip() is empty. This test covers only None. Parametrize ENCRYPTION_KEY with None, SecretStr(""), and SecretStr(" ").

As per coding guidelines, backend tests must include focused contract tests for changed behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/tests/test_db_models.py` around lines 37 - 44, Expand
test_get_encryption_keyring_missing_key to be parametrized over None,
SecretStr(""), and SecretStr("   ") for settings.ENCRYPTION_KEY, while keeping
ENCRYPTION_PREVIOUS_KEYS set to None. Preserve the existing RuntimeError
assertion and message match for every invalid key representation.

Source: Coding guidelines


16-18: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Assert the configured key material.

These tests verify IDs and counts, but not that key and key2 become the active and previous encryption keys. A regression that swaps or ignores key values can still pass. Use the existing keyring API or exposed key objects to verify both generated keys. backend/db/models.py:56-68 passes both configured values into the keyring builder.

As per coding guidelines, backend tests must include focused contract tests for changed behavior.

Also applies to: 30-34

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@backend/tests/test_db_models.py` around lines 16 - 18, Extend the focused
tests around get_encryption_keyring to assert that the generated active and
previous key objects contain the configured key and key2 material, using the
existing EncryptionKeyRing API or exposed key objects. Preserve the existing ID
and count assertions while covering both key assignments so swaps or ignored
values fail.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@backend/tests/test_db_models.py`:
- Around line 37-44: Expand test_get_encryption_keyring_missing_key to be
parametrized over None, SecretStr(""), and SecretStr("   ") for
settings.ENCRYPTION_KEY, while keeping ENCRYPTION_PREVIOUS_KEYS set to None.
Preserve the existing RuntimeError assertion and message match for every invalid
key representation.
- Around line 16-18: Extend the focused tests around get_encryption_keyring to
assert that the generated active and previous key objects contain the configured
key and key2 material, using the existing EncryptionKeyRing API or exposed key
objects. Preserve the existing ID and count assertions while covering both key
assignments so swaps or ignored values fail.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3ede37ca-b7ac-42f6-b4e8-b24c40dd1348

📥 Commits

Reviewing files that changed from the base of the PR and between f781701 and 4e91c2a.

📒 Files selected for processing (2)
  • .trivyignore
  • backend/tests/test_db_models.py

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 10, 2026

@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 4e91c2ab5082440458e787b8af08f869a2aa4a0b.

  • Head SHA: 4e91c2ab5082440458e787b8af08f869a2aa4a0b

  • Workflow run: 31351926847

  • Workflow attempt: 1

Coverage evidence

Coverage evidence job did not run or did not publish coverage evidence.

Changed-File Evidence Map

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

@opencode-agent

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: 4e91c2ab5082440458e787b8af08f869a2aa4a0b
  • Workflow run: 31351926847
  • 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 4e91c2ab5082440458e787b8af08f869a2aa4a0b.

  • Head SHA: 4e91c2ab5082440458e787b8af08f869a2aa4a0b

  • Workflow run: 31351926847

  • Workflow attempt: 1

Coverage evidence

Coverage evidence job did not run or did not publish coverage evidence.

Changed-File Evidence Map

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

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

PR governance metadata gate is not ready for fe9d0bd09ec3db1c263a72d7f29f813e1d2578cb:

  • Review decision is CHANGES_REQUESTED; address requested changes before merge.

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