Repository navigation
feat(execution-factory): let a Cypher function input be optional - #1316
Merged
Merged
Conversation
There was a problem hiding this comment.
IS NULL 检测按 blankCypherLiterals 后的文本和 scan 的 span 偏移判断,字符串、注释里的 $name IS NULL 不会误判;cypherArguments 跳过未传的可选输入,zh/en 文案也都改了,没发现阻塞项。剩下一个疑点要作者确认:参数完全不传时后端怎么处理。
影响范围与未覆盖面
- 影响范围:影响执行工厂 Cypher 函数工作台的输入同步和试跑参数校验;已保存的函数里 required 为 undefined 的输入仍按必填处理。
- 未覆盖:后端(bkn-backend 与执行工厂)怎么处理缺失参数,前端仓库里核实不了。
待确认项(不阻断放行)
- src/modules/execution-factory/utils/cypher-function.ts — 可选输入没传时,cypherArguments 会把它从 parameters 里整个去掉,而不是传 null。原注释写的是「a statement using
$namefails without one」,所以要确认两件事:bkn-backend 的 run_cypher 是否把缺失的参数当 null;执行工厂实际调用函数时是不传还是传 null。只要有一方会报 missing parameter,就应该改成显式传 `nam…
有异议或想再评一轮,请回复 /review——普通回帖不会触发复评,且回帖人需为本仓 OWNER/MEMBER/COLLABORATOR。
bkn-backend now makes a condition optional with ($name IS NULL OR ...). The function workbench starts an input the statement tests with IS NULL as optional and keeps the author's choice for it, while every other input stays required. The trial run leaves an optional input out when it is not given. The AI prompt and the Cypher reference describe the form. Refs openbkn-ai/bkn-foundry#2670 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sh00tg0a1
force-pushed
the
feat/cypher-optional-inputs
branch
from
November 11, 2026 15:07
b3d26d9 to
a0388e9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
What Changed
Brief description of changes:
$name IS NULL(orIS NOT NULL) starts optional, and keeps whatever the author sets for "required". Every other input stays required, as before.($name IS NULL OR condition).Why
WHERE ($code IS NULL OR s.code = $code), and lets execution-factory leave out an input markedrequired: false. The workbench forced every Cypher input back to required whenever the statement changed, so this kind of function could not be saved from Studio.How
syncCypherInputs: finds the parameters followed byIS NULL/IS NOT NULL, with string literals and comments blanked first.required: false.requiredvalue.required: true, as before.cypherArguments: skips an input withrequired: falsethat is not given or is null. An input with norequiredfield still counts as required.Testing
vitestforsrc/modules/execution-factory,src/modules/knowledge-network/cypherand the locale parity test (572 tests), pluscypher-reference.test.tsandCypherQueryScene.test.tsx.tsc -b;eslintandprettieron the touched files; the hardcoded-Chinese scan; the license check.Test notes:
IS NULLstarts optional, and a declared one keepsrequired.'$code IS NULL'inside a string literal does not count. An input without the test is set back to required.Risk & Rollback
$x IS NULLis refused at save (the explain fails), so nothing wrong gets saved.Additional Notes
syncCypherInputs(row-count inputs typed as numbers). Whichever merges second needs a small rebase.🤖 Generated with Claude Code