Skip to content

test(api): pin PluginCredentialType API contract values - #46026

Merged
wylswz merged 1 commit into
langgenius:mainfrom
TINGyu123644:test/add-plugin-credential-type-contract-tests
Nov 12, 2026
Merged

wylswz merged 1 commit into
langgenius:mainfrom
TINGyu123644:test/add-plugin-credential-type-contract-tests

Conversation

@TINGyu123644

Copy link
Copy Markdown
Contributor

Summary

Adds unit tests for the previously uncovered core.entities.plugin_credential_type.PluginCredentialType.

This is not just coverage padding: the source explicitly documents that MODEL = 0 and TOOL = 1 are required for API contract compatibility. Reordering members or switching to auto() would silently break plugin clients, so the 16 cases pin the wire values, to_number(), value/name lookup, invalid-input rejection, member set, hashing and repr/str.

Purely additive: one new test file, 0 deletions, no production code touched.

Verification

Local, Python 3.13, using this repo's [tool.pyrefly] and api/.ruff.toml:

  • pyrefly 1.5.0-dev.1 check (the version proposed in ci: bump tyck to check new err #45614): 0 diagnostics
  • pytest: 16 passed
  • ruff check + ruff format --check: clean
  • Import path follows the existing tests in this directory (core.entities..., no api. prefix)
  • Rebased onto current main, LF line endings

AI-assisted test generation; assertions reflect the documented behaviour of the target enum.

core.entities.plugin_credential_type.PluginCredentialType is an enum whose numeric values are an API contract (MODEL must be 0, TOOL must be 1). Add 16 regression cases covering the wire values, to_number(), construction from values, member set, name/value lookup, invalid input rejection, hashing and repr/str. Purely additive: one new test file, 0 deletions.
@github-actions github-actions Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 84.97% 84.97% +0.00%
Strict coverage 84.63% 84.63% +0.00%
Typed symbols 89,874 89,889 +15
Untyped symbols 15,961 15,962 +1
Modules 4466 4467 +1

@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.13%. Comparing base (583615e) to head (8a9d1d1).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #46026   +/-   ##
=======================================
  Coverage   90.13%   90.13%           
=======================================
  Files        6302     6302           
  Lines      394481   394481           
  Branches    79133    79133           
=======================================
+ Hits       355560   355562    +2     
+ Misses      32813    32808    -5     
- Partials     6108     6111    +3     
Flag Coverage Δ
api 90.00% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wylswz
wylswz added this pull request to the merge queue Nov 12, 2026
Merged via the queue into langgenius:main with commit 100829a Nov 12, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants