Repository navigation
Conversation
bitflicker64
left a comment
There was a problem hiding this comment.
Blocking: no. Summary: The configurable limit keeps the 256-byte default and the valid() override, and the new tests cover both. The new setting is missing from the config.md table that documents every other HugeGraphConfig key.
| edge_limit_pre_label: int = 8 | ||
|
|
||
| # graph element config | ||
| max_element_id_length: int = 256 |
There was a problem hiding this comment.
Minor: hugegraph-llm/config.md lists every other HugeGraphConfig key in the HugeGraph table, but not MAX_ELEMENT_ID_LENGTH, so users cannot find the setting this PR adds. Add a MAX_ELEMENT_ID_LENGTH row (Optional[Integer], default 256, UTF-8 bytes) to that table.
|
Fixed in a19731f — |
bitflicker64
left a comment
There was a problem hiding this comment.
Blocking: no. Score: 9/10. Summary: max_element_id_length keeps the 256-byte default and the valid() override, the new tests cover settings, override and _filter_long_id, and the config.md row from the earlier review is in place.
imbajin
left a comment
There was a problem hiding this comment.
Score: 7.5/10 · Confidence: high
Blocking: yes
Summary
A nonpositive ID length limit can discard all extracted graph elements without failing the extraction.
Evidence
The new integer setting has no positive constraint; valid() rejects byte lengths greater than or equal to the limit and _filter_long_id removes the elements.
Validation notes
Static source inspection; no running HugeGraph or LLM service was used. The prior documentation comment is addressed by the current config.md row.
| edge_limit_pre_label: int = 8 | ||
|
|
||
| # graph element config | ||
| max_element_id_length: int = 256 |
There was a problem hiding this comment.
If MAX_ELEMENT_ID_LENGTH is set to 0 or a negative integer, this unconstrained setting is accepted, but valid() rejects every ID because its UTF-8 byte length is always greater than or equal to the limit. _filter_long_id() then drops all vertices and edges after extraction and returns the empty graph with warnings rather than failing the configuration. Please validate that the configured limit is positive, and apply the same check to the explicit constructor override.
There was a problem hiding this comment.
Fixed — pushed (2d1c284). Root cause: max_element_id_length had no positivity constraint and InfoExtract.__init__ took the explicit override unchecked, while valid() rejects ids whose UTF-8 byte length is >= the limit — so a limit of 0 or a negative integer rejects every id and _filter_long_id silently returned the empty graph with warnings.
Structural fix: HugeGraphConfig now validates the setting positive in a field validator, so the configuration fails at load/update time instead of emptying the graph later; and InfoExtract.__init__ applies the same check to the effective limit, so the explicit constructor override is rejected the same way.
Tests: test_settings_reject_nonpositive_length_limit and test_explicit_length_limit_must_be_positive cover 0 and -1 at both entry points. Red without the fix ("ValueError not raised").
Resolve the TODO on InfoExtract.valid(): the extracted element-id length limit was a hard-coded 256 and could not be configured. Add HugeGraphConfig.max_element_id_length (default 256, compared as UTF-8 bytes, same semantics as before), resolve it in the InfoExtract constructor with an explicit max_length override, and let valid() fall back to the configured limit. Behavior at default settings is unchanged. Co-Authored-By: Claude Code <noreply@anthropic.com>
Name the new HugeGraphConfig.max_element_id_length setting in the configuration table with its UTF-8 byte comparison semantics. Co-Authored-By: Claude Code <noreply@anthropic.com>
Review round for apache#415: a configured MAX_ELEMENT_ID_LENGTH of 0 or a negative integer was accepted, but valid() rejects every id whose UTF-8 byte length is >= the limit - which is every id - so _filter_long_id silently emptied the graph with warnings instead of failing the configuration. HugeGraphConfig now validates max_element_id_length positive at load and update time (pydantic field validator), and InfoExtract applies the same check to the effective limit so the explicit constructor override is rejected the same way. Validation: 2 new regressions red-green (settings 0/-1 rejected, explicit override 0/-1 rejected); llm_op + config suites 146 passed (known test_external_config pair excluded, pre-existing); full hugegraph-llm suite 1294 passed 12 skipped 2 failed (same known pair); ruff clean; ty production files clean (the test file gains 2 more instances of its existing InfoExtract(None) fake-LLM pattern). Co-Authored-By: Claude Code <noreply@anthropic.com>
a19731f to
2d1c284
Compare
bitflicker64
left a comment
There was a problem hiding this comment.
Blocking: no. Score: 9/10. Summary: max_element_id_length keeps the 256-byte default, and HugeGraphConfig plus the InfoExtract constructor reject nonpositive limits, which resolves the earlier review comments. The new tests fail on the base and pass at this head.
imbajin
left a comment
There was a problem hiding this comment.
Score: 8.0/10 · Confidence: high
Blocking: no
Summary
The configurable byte threshold preserves the old default, but the documented boundary is misleading and can discard IDs users expect to keep.
Evidence
The new configuration row says IDs over the maximum are filtered, while valid() rejects byte lengths equal to the configured value as well. The added tests explicitly exercise this exclusive boundary.
Validation notes
Static source and test inspection; no running HugeGraph or LLM service was used. Existing nonpositive-limit and documentation issues are addressed at this head.
| | `MAX_GRAPH_PATH` | Optional[Integer] | 10 | 最大图路径长度 | | ||
| | `MAX_GRAPH_ITEMS` | Optional[Integer] | 30 | 最大图项目数 | | ||
| | `EDGE_LIMIT_PRE_LABEL` | Optional[Integer] | 8 | 每个标签的边数限制 | | ||
| | `MAX_ELEMENT_ID_LENGTH` | Optional[Integer] | 256 | 信息抽取元素 ID 的最大长度(按 UTF-8 字节比较,超限元素被过滤,默认 256 与历史行为一致) | |
There was a problem hiding this comment.
The new setting is described as a maximum that filters IDs exceeding it, but valid() rejects IDs whose UTF-8 byte length is equal to the configured value too. For example, setting it to 1 discards every nonempty ID, and setting it to 10 discards 10-byte IDs. Please document that IDs must be strictly shorter than this threshold (or otherwise make the configuration contract match the comparison while preserving the historical default).
Refs #107 (Tiny Task: fix TODO/FIXME in LLM code)
What
The TODO on
InfoExtract.valid()asked to makemax_lengthconfigurable in settingsinstead of a hard-coded 256. Extracted element ids over the limit are dropped before graph
write, and the limit is a deployment/storage constraint, so it belongs with the other
HugeGraph settings.
Changes
HugeGraphConfig.max_element_id_length: int = 256(compared as UTF-8 bytes — samesemantics as before).
InfoExtract.__init__(..., max_length: Optional[int] = None)resolves the configuredlimit;
valid()falls back to it while keeping an explicit override. Behavior at defaultsettings is unchanged (limit 256).
2d1c284):HugeGraphConfigvalidatesmax_element_id_lengthpositive at load/update time — the configuration fails instead ofvalid()silently rejecting every id and_filter_long_idemptying the graph — andInfoExtract.__init__applies the same check to the explicit constructor override.test_info_extract.py: settings default, explicit override,_filter_long_idfiltering, and positivity at both entry points.Validation (actually run; offline only)
src/tests/operators/llm_op/test_info_extract.py: 5 tests inTestInfoExtractIdLengthLimit,each red before its fix (stashed), green after.
SKIP_EXTERNAL_SERVICES=true uv run pytest src/tests/operators/llm_op/ src/tests/config/→ 146 passed, 3 subtests passed; full
src/tests→ 1294 passed, 12 skipped, 2 failed (theknown pre-existing Windows mode-bit pair in
test_external_config.py, unrelated).ruff format --check/ruff check→ clean on touched filesty check→ 0 diagnostics in touched production files;test_info_extract.pycarries thefile's existing
InfoExtract(None)fake-LLM diagnostics (7 after this round, 5 before —same pre-existing class)
Refs #107
🤖 Generated with Claude Code