Skip to content

fix(entity_file): raise on unparseable ID_INTEGER values instead of silent fallthrough#74

Open
gkorland wants to merge 2 commits into
masterfrom
fix/id-integer-no-silent-fallthrough
Open

fix(entity_file): raise on unparseable ID_INTEGER values instead of silent fallthrough#74
gkorland wants to merge 2 commits into
masterfrom
fix/id-integer-no-silent-fallthrough

Conversation

@gkorland

Copy link
Copy Markdown

Summary

When a column declared as :ID(int) (Type.ID_INTEGER) contained a value that could not be parsed as an integer, typed_prop_to_binary silently fell through every branch and returned None because the raise SchemaError was guarded by if prop_type == Type.LONG. The None was packed into the binary payload, producing a row the server rejects with an opaque error and corrupting the ID-to-graph-node mapping edge processing depends on.

Changes

  • falkordb_bulk_loader/entity_file.py: treat ID_INTEGER and LONG identically – both must parse as an integer, otherwise raise SchemaError with a clear message that names the offending value and the declared type.

Testing

uv run flake8 clean. The success path is unchanged; only the previously-silent error path is affected.

Memory / Performance Impact

N/A.

Related Issues

From the comprehensive code-review report (BUG-2).

@coderabbitai

coderabbitai Bot commented Apr 26, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@gkorland has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 29 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7204a545-c147-4fa3-a6d3-cbd754a2d638

📥 Commits

Reviewing files that changed from the base of the PR and between 3954856 and d3d1d88.

📒 Files selected for processing (2)
  • falkordb_bulk_loader/entity_file.py
  • test/test_entity_file.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/id-integer-no-silent-fallthrough

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
Review rate limit: 0/1 reviews remaining, refill in 46 minutes and 29 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Apr 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.50%. Comparing base (3954856) to head (d3d1d88).

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #74   +/-   ##
=======================================
  Coverage   89.50%   89.50%           
=======================================
  Files           9        9           
  Lines         610      610           
=======================================
  Hits          546      546           
  Misses         64       64           

☔ 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.

@gkorland
gkorland marked this pull request as ready for review April 26, 2026 17:58
@gkorland

Copy link
Copy Markdown
Author

Copilot Code Review

No significant issues found.

The PR correctly fixes inconsistent error handling for ID_INTEGER parsing failures. Error message is clearer, logic is sound, and backward compatibility is maintained (both old and new raise SchemaError).

@gkorland

Copy link
Copy Markdown
Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens schema-enforced ID handling in the bulk loader by ensuring that integer IDs (:ID(int) / Type.ID_INTEGER) fail fast with a clear SchemaError when their values are not parseable as integers, instead of relying on less-specific downstream behavior.

Changes:

  • Raise a SchemaError for unparseable Type.ID_INTEGER values (same behavior as Type.LONG).
  • Improve the error message to include the offending value and a human-readable type name.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread falkordb_bulk_loader/entity_file.py Outdated
Comment on lines +81 to +83
# Both ID_INTEGER and LONG demand a parseable integer; falling
# through to the STRING branch would silently produce a
# type-confused ID that cannot be resolved by edge processing.

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

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

The new comment says this would "fall through to the STRING branch", but for Type.ID_INTEGER/Type.LONG this function doesn't enter the string branch; it will proceed through the remaining elifs and hit the final generic SchemaError. Please update the comment to reflect the actual control flow (and the specific failure mode you're preventing).

Suggested change
# Both ID_INTEGER and LONG demand a parseable integer; falling
# through to the STRING branch would silently produce a
# type-confused ID that cannot be resolved by edge processing.
# Both ID_INTEGER and LONG demand a parseable integer; without
# this explicit error, control would continue past the remaining
# elif branches and end in the final generic SchemaError instead
# of reporting the specific integer/ID parse failure here.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed — the comment now reads: 'without this explicit error, control would continue past the remaining elif branches and end in the final generic SchemaError instead of reporting the specific integer/ID parse failure here.' (commit d3d1d88)

Comment thread falkordb_bulk_loader/entity_file.py Outdated
Comment on lines +81 to +85
# Both ID_INTEGER and LONG demand a parseable integer; falling
# through to the STRING branch would silently produce a
# type-confused ID that cannot be resolved by edge processing.
type_name = "long" if prop_type == Type.LONG else "integer ID"
raise SchemaError(f"Could not parse '{prop_val}' as a {type_name}")

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

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

This change introduces a new, more specific failure mode/message for ID_INTEGER parsing. There are existing integration tests for integer IDs (success path), but no regression test that a non-integer :ID(...) value fails with this clear SchemaError message when --id-type integer is used. Adding a test would prevent this from regressing again.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done — added test/test_entity_file.py with four unit tests: valid and invalid paths for both Type.ID_INTEGER and Type.LONG. All four pass locally. (commit d3d1d88)

gkorland and others added 2 commits April 29, 2026 09:34
…ilent fallthrough

Previously, when a column was declared as `:ID(int)` (ID_INTEGER) and
the cell value could not be parsed as an integer, the code silently
fell through every `elif`/`else` branch and returned `None`, since the
`raise SchemaError` was guarded by `if prop_type == Type.LONG`.

A `None` return is then passed back to `pack_props` and packed into the
binary payload, producing a row that the server rejects with an
opaque error and corrupting the ID-to-graph-node mapping that edge
processing relies on.

Treat ID_INTEGER and LONG identically: both must parse as an integer,
otherwise raise `SchemaError` with a clear message naming the offending
value and column type.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…GER parse failure

- Update comment in typed_prop_to_binary to accurately describe the
  control flow: without the explicit raise, execution would continue
  past the remaining elif branches and end in the final generic
  SchemaError rather than reporting the specific integer/ID parse failure.
- Add test/test_entity_file.py with unit tests covering both the valid
  and invalid paths for Type.ID_INTEGER and Type.LONG to prevent
  silent-fallthrough regression.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gkorland
gkorland force-pushed the fix/id-integer-no-silent-fallthrough branch from eb68a3d to d3d1d88 Compare April 29, 2026 06:35
@gkorland

Copy link
Copy Markdown
Author

Agent Review Summary

PR: fix(entity_file): raise on unparseable ID_INTEGER values instead of silent fallthrough

Actions Taken

Rebased on master (was 5 commits behind).

Addressed 2 inline reviewer comments (Copilot PR Reviewer):

  1. Inaccurate comment — The original comment said control would "fall through to the STRING branch", which was wrong (the STRING branch is unreachable for ID_INTEGER/LONG since it's guarded by elif). Updated to accurately state that without the explicit raise, control falls past all remaining elif branches to the final generic SchemaError.

  2. Missing regression test — Added test/test_entity_file.py with 4 unit tests for typed_prop_to_binary:

    • Type.ID_INTEGER with valid value → succeeds
    • Type.ID_INTEGER with unparseable value → raises SchemaError with correct message (regression guard)
    • Type.LONG with valid value → succeeds
    • Type.LONG with unparseable value → raises SchemaError with correct message

Test Results

All 8 unit tests pass (flake8 clean, no regressions).

Commit: d3d1d88

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.

2 participants