Skip to content

dql/fetcher#2637

Merged
xushiwei merged 3 commits intogoplus:mainfrom
xushiwei:q
Feb 17, 2026
Merged

dql/fetcher#2637
xushiwei merged 3 commits intogoplus:mainfrom
xushiwei:q

Conversation

@xushiwei
Copy link
Member

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @xushiwei, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the DQL (Declarative Query Language) system by enhancing error handling, updating query syntax for clarity and robustness, and making internal compiler adjustments. The changes aim to provide a more reliable and explicit querying experience, particularly with NodeSet operations and attribute access, while also improving the management of generated code.

Highlights

  • DQL Error Handling: Introduced an Ok() method (or XGo_ok()) to NodeSet types across various DQL packages (fs, golang, html, maps, reflects, xgo, xml), providing a standardized way to check for errors in query results.
  • DQL Query Syntax Refinement: Updated DQL query syntax in several fetcher examples (issueTask.xgo, repoList.xgo, fndoc.xgo), specifically removing the implicit non-nullable ! operator and requiring explicit self references for attribute and text comparisons in certain conditions.
  • DQL Compiler Adjustments: Adjusted the DQL compiler's handling of selector expressions and assignment statements in cl/expr.go and cl/stmt.go for improved code generation.
  • Generated Code Management: Added new auto-generated Go files (xgo_autogen.go) for DQL fetchers and updated the .gitignore to properly exclude these generated files from version control.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .gitignore
    • Added an exclusion rule for xgo_autogen.go files within the dql/fetcher directory.
  • cl/_testgop/dql2/in.xgo
    • Modified the DQL example to assign a query result to a variable before echoing it.
  • cl/_testgop/dql2/out.go
    • Updated the generated Go code for the DQL example to reflect the new variable assignment.
  • cl/expr.go
    • Modified the compileSelectorExpr function call to correctly pass the lhs argument.
  • cl/stmt.go
    • Changed the initial value of lhs in compileAssignStmt from 0 to 1.
  • dql/fetcher/github.com/issueTask/issueTask.xgo
    • Removed the non-nullable ! operator from a text extraction in a DQL query.
  • dql/fetcher/github.com/issueTask/xgo_autogen.go
    • Added a new auto-generated Go file for the issueTask DQL fetcher.
  • dql/fetcher/github.com/repoList/repoList.xgo
    • Updated DQL queries to remove the non-nullable ! operator and use explicit self.value and self.text for comparisons.
  • dql/fetcher/github.com/repoList/xgo_autogen.go
    • Added a new auto-generated Go file for the repoList DQL fetcher.
  • dql/fetcher/hrefs/xgo_autogen.go
    • Added a new auto-generated Go file for the hrefs DQL fetcher.
  • dql/fetcher/pytorch.org/fndoc/fndoc.xgo
    • Removed the non-nullable ! operator from a text extraction in a DQL query.
  • dql/fetcher/pytorch.org/fndoc/xgo_autogen.go
    • Added a new auto-generated Go file for the fndoc DQL fetcher.
  • dql/fs/fs.go
    • Added an Ok() method to the NodeSet type to check for errors.
  • dql/golang/golang.go
    • Added an Ok() method to the NodeSet type to check for errors.
  • dql/html/html.go
    • Added an Ok() method to the NodeSet type to check for errors.
  • dql/maps/maps.go
    • Added an XGo_ok() method to the NodeSet type to check for errors.
  • dql/reflects/reflects.go
    • Added an XGo_ok() method to the NodeSet type to check for errors.
  • dql/xgo/xgo.go
    • Added an Ok() method to the NodeSet type to check for errors.
  • dql/xml/xml.go
    • Added an XGo_ok() method to the NodeSet type to check for errors.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.10%. Comparing base (5e3caf6) to head (6155935).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2637   +/-   ##
=======================================
  Coverage   94.10%   94.10%           
=======================================
  Files          32       32           
  Lines        9964     9964           
=======================================
  Hits         9377     9377           
  Misses        419      419           
  Partials      168      168           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new dql/fetcher feature, enabling data fetching and parsing from web pages using DQL, and adds several fetchers for sources like GitHub and PyTorch documentation. While it includes fixes and enhancements to the DQL implementation and XGo compiler, critical issues have been identified. The hrefs fetcher allows arbitrary URL fetching, posing a significant SSRF risk, and the autogenerated code uses unsafe type assertions like input.(string) which can lead to runtime panics and Denial of Service. Furthermore, the newly generated xgo_autogen.go files contain syntactically incorrect if statements that will cause compilation to fail. All these issues must be addressed in the source .xgo files or the code generator.

Comment on lines +35 to +37
if
//line dql/fetcher/github.com/issueTask/issueTask.xgo:39:1
_xgo_val, _xgo_err := self.XGo_first(); _xgo_err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The generated if statement is syntactically incorrect due to the newline after the if keyword. This will cause a compilation error. This issue appears in all newly added xgo_autogen.go files in this pull request.

In Go, the if keyword and its condition (including any initialization statement) must be on the same line.

                                if _xgo_val, _xgo_err := self.XGo_first(); _xgo_err == nil {

Comment on lines +43 to +46
func URL(input interface{}) string {
//line dql/fetcher/hrefs/hrefs.xgo:40:1
return input.(string)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

security-high high

The hrefs fetcher is registered with a URL function that returns the input string directly without any validation, sanitization, or domain prefixing. This allows for arbitrary URL fetching, which is a classic Server-Side Request Forgery (SSRF) vulnerability if the fetcher.Do function is called with user-controlled input for this fetcher type. An attacker could use this to scan internal networks or access sensitive internal services (e.g., cloud metadata services). Additionally, the direct type assertion input.(string) will cause a runtime panic if the input is not a string, leading to a potential Denial of Service (DoS). It is recommended to implement a whitelist of allowed domains or restrict this fetcher to specific safe protocols and to use a type switch or comma-ok assertion for safer type handling.

@xushiwei xushiwei merged commit 9bcb8c1 into goplus:main Feb 17, 2026
11 checks passed
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