Skip to content

Auto-generated Pull Request for fix/list-plasmids#610

Merged
cybersiddhu merged 2 commits into
developfrom
fix/list-plasmids
Apr 20, 2026
Merged

Auto-generated Pull Request for fix/list-plasmids#610
cybersiddhu merged 2 commits into
developfrom
fix/list-plasmids

Conversation

@cybersiddhu
Copy link
Copy Markdown
Member

@cybersiddhu cybersiddhu commented Apr 20, 2026

Pulling 'fix/list-plasmids into develop. Please review and merge.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed plasmid type filtering to properly support Regular and GoldenBraid types when listing plasmids.
  • Refactor

    • Simplified plasmid filter query building logic for improved maintainability.

Allow plasmid type filtering (Regular and GoldenBraid) in stock service query conversion. Refactor filter validation to only check id and in_stock fields, delegating type filtering to new plasmidTypeQuery function. Update plasmid type tag constants to match stock service expectations.

Updates:
- Add plasmidTypeQuery function to generate stock query for plasmid types
- Modify buildListPlasmidFilterQuery to use TryCatchError for simpler error handling
- Update tag constants: RegularPlasmidTag to "vector" and GoldenBraidPlasmidTag to "GB vector"
- Add tests for plasmid type filtering functionality

Decomposes complex validation pipeline into focused checks and adds type-specific query generation.

💘 Generated with Crush

Assisted-by: Z.ai: GLM 4.7 Flash via Crush <crush@charm.land>
…ectations

Update RegularPlasmidTag and GoldenBraidPlasmidTag constants to use "vector" and "GB vector" respectively, aligning with stock service query format.

💘 Generated with Crush

Assisted-by: Z.ai: GLM 4.7 Flash via Crush <crush@charm.land>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

📝 Walkthrough

Walkthrough

The pull request refactors the plasmid filtering system to remove type verification checks that previously rejected unverified plasmid types. The validation pipeline is replaced with a consolidated function that directly generates query strings for plasmid type constraints. Plasmid tag constants are updated to new naming conventions.

Changes

Cohort / File(s) Summary
Filter Logic Refactoring
internal/graphql/resolverutils/plasmid_filter.go, internal/graphql/resolver/stock_plasmid_fp.go
Removed validation predicates for plasmid type verification; consolidated filter-to-query logic into single PlasmidFilterToQuery() function returning (string, error). Updated resolver to use TryCatchError wrapper instead of Either-chained validation pipeline.
Test Updates
internal/graphql/resolverutils/plasmid_filter_test.go, internal/graphql/resolver/stock_test.go
Renamed test functions removing "Unverified" references; updated assertions to expect successful query generation and results instead of errors for Regular and GoldenBraid plasmid types. Restructured resolver tests to use mocked StockServiceClient.
Registry Constants
internal/registry/registry.go
Updated plasmid tag values: RegularPlasmidTag from "regular plasmid" to "vector"; GoldenBraidPlasmidTag from "golden braid" to "GB vector".

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 A filter now flows without hesitation,
No verification gate in verification!
Registry tags shine with names anew,
Vector and GB—our queries break through!
Tests leap with joy, expecting success,
Plasmids now free from the unverified mess! 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is generic and vague; it uses an auto-generated format that does not clearly describe the main technical change (adding plasmid type filtering and refactoring validation logic). Provide a more descriptive title like 'Add plasmid type filtering support and refactor filter validation' or 'Refactor plasmid filter validation with type filtering support'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/list-plasmids

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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
internal/registry/registry.go (1)

42-43: Add Go doc comments for the exported plasmid tag constants.

Line 42 and Line 43 update exported constants that now define stock-service filter behavior. Please add identifier-specific comments so future changes to "vector" / "GB vector" are deliberate. As per coding guidelines, Document all exported functions, types, and constants with proper Go doc comments.

📝 Proposed documentation update
-	GoldenBraidPlasmidTag    = "GB vector"
-	RegularPlasmidTag        = "vector"
+	// GoldenBraidPlasmidTag identifies GoldenBraid plasmids in modware-annotation.
+	GoldenBraidPlasmidTag = "GB vector"
+	// RegularPlasmidTag identifies regular plasmids in modware-annotation.
+	RegularPlasmidTag = "vector"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/registry/registry.go` around lines 42 - 43, Add Go doc comments
above the exported constants GoldenBraidPlasmidTag and RegularPlasmidTag
describing their purpose and how they influence stock-service filter behavior;
e.g., a short sentence for each explaining that GoldenBraidPlasmidTag ("GB
vector") marks plasmids intended for GoldenBraid workflows and RegularPlasmidTag
("vector") marks standard vectors, so future changes to those string values are
intentional and documented. Ensure comments follow Go doc style (start with the
constant name) and are placed immediately above each constant declaration.
internal/graphql/resolverutils/plasmid_filter.go (1)

54-54: Add a Go doc comment for PlasmidFilterToQuery.

Line 54 exports a utility that now owns nil-filter handling and validation behavior, so the contract should be documented at the declaration. As per coding guidelines, Document all exported functions, types, and constants with proper Go doc comments.

📝 Proposed documentation update
+// PlasmidFilterToQuery converts a plasmid list filter into a stock-service filter query.
+// A nil filter produces an empty query.
 func PlasmidFilterToQuery(filter *models.PlasmidListFilter) (string, error) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/graphql/resolverutils/plasmid_filter.go` at line 54, Add a Go doc
comment above the exported function PlasmidFilterToQuery that documents its
behavior and contract: state that it converts a *models.PlasmidListFilter to a
SQL/query string, describe what happens when filter is nil (e.g., returns empty
query or default), list validation behavior and possible errors returned (what
conditions cause non-nil error), and mention any side-effects or assumptions
(e.g., which fields are used). Reference the function name PlasmidFilterToQuery
and keep the comment concise and in proper Go doc format starting with the
function name.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@internal/graphql/resolverutils/plasmid_filter.go`:
- Around line 68-70: When plasmidTypeQuery(filter) returns an error, the current
code returns the partially built fieldQuery which may be misused; change the
error path so you return the zero-value/empty query instead of fieldQuery along
with the error. Locate the call to plasmidTypeQuery in plasmid_filter.go (the
variables typeQuery and fieldQuery) and replace the return of fieldQuery on
error with an empty query value (the zero-value for the query type) plus err so
callers won't get a partial query when type validation fails.

---

Nitpick comments:
In `@internal/graphql/resolverutils/plasmid_filter.go`:
- Line 54: Add a Go doc comment above the exported function PlasmidFilterToQuery
that documents its behavior and contract: state that it converts a
*models.PlasmidListFilter to a SQL/query string, describe what happens when
filter is nil (e.g., returns empty query or default), list validation behavior
and possible errors returned (what conditions cause non-nil error), and mention
any side-effects or assumptions (e.g., which fields are used). Reference the
function name PlasmidFilterToQuery and keep the comment concise and in proper Go
doc format starting with the function name.

In `@internal/registry/registry.go`:
- Around line 42-43: Add Go doc comments above the exported constants
GoldenBraidPlasmidTag and RegularPlasmidTag describing their purpose and how
they influence stock-service filter behavior; e.g., a short sentence for each
explaining that GoldenBraidPlasmidTag ("GB vector") marks plasmids intended for
GoldenBraid workflows and RegularPlasmidTag ("vector") marks standard vectors,
so future changes to those string values are intentional and documented. Ensure
comments follow Go doc style (start with the constant name) and are placed
immediately above each constant declaration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e369fecf-d0b3-4018-b7a6-a139e4153b43

📥 Commits

Reviewing files that changed from the base of the PR and between 17ecce8 and e09a124.

📒 Files selected for processing (5)
  • internal/graphql/resolver/stock_plasmid_fp.go
  • internal/graphql/resolver/stock_test.go
  • internal/graphql/resolverutils/plasmid_filter.go
  • internal/graphql/resolverutils/plasmid_filter_test.go
  • internal/registry/registry.go

Comment on lines +68 to +70
typeQuery, err := plasmidTypeQuery(filter)
if err != nil {
return fieldQuery, err
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Return an empty query when type validation fails.

Line 70 returns fieldQuery together with err; for a filter like {Summary: ..., PlasmidType: "INVALID"}, direct callers could accidentally use the partial summary query despite the failed full conversion. Return the zero query on error.

🐛 Proposed fix
 	typeQuery, err := plasmidTypeQuery(filter)
 	if err != nil {
-		return fieldQuery, err
+		return "", err
 	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
typeQuery, err := plasmidTypeQuery(filter)
if err != nil {
return fieldQuery, err
typeQuery, err := plasmidTypeQuery(filter)
if err != nil {
return "", err
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/graphql/resolverutils/plasmid_filter.go` around lines 68 - 70, When
plasmidTypeQuery(filter) returns an error, the current code returns the
partially built fieldQuery which may be misused; change the error path so you
return the zero-value/empty query instead of fieldQuery along with the error.
Locate the call to plasmidTypeQuery in plasmid_filter.go (the variables
typeQuery and fieldQuery) and replace the return of fieldQuery on error with an
empty query value (the zero-value for the query type) plus err so callers won't
get a partial query when type validation fails.

@cybersiddhu cybersiddhu merged commit b825172 into develop Apr 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant