Conversation
max_retries counts attempts, not extra retries: the retry loop starts at attempt = 0 and runs while attempt < max_retries, incrementing attempt only on failure. A value of 0 or less therefore skips the loop and falls through to return True, so upload_points(max_retries=0) reports success having sent nothing. Both uploaders share the loop, so both transports were affected. A retry budget computed from config turns 'no retries left' into 'upload nothing and claim success'. Reject the value up front, matching the parameter validation the client already does for limit and the MMR bounds.
❌ Deploy Preview for poetic-froyo-8baba7 failed.
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe REST and gRPC batch upload functions now raise Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to The change prevents a non-positive budget from reporting a successful upload without sending data, while preserving one-attempt uploads. No actionable merge risk is established. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
Summary
upload_points(..., max_retries=0)reports success without uploading anything. Every point in the batch is silently dropped.Why it happens
max_retriescounts attempts, not extra retries — the retry loops in both uploaders start atattempt = 0and runwhile attempt < max_retries, withattemptonly ever incremented inside the failure branch:The retry loop
With
max_retries <= 0the loop body never executes and the function falls through toreturn True:Nothing warns, nothing raises, and the caller has no way to tell the points were dropped.
upload_pointsandupload_collectionboth takemax_retries: int = 3and forward it straight through, so a retry budget computed from config —max(0, budget - used)is the natural way to write one — turns "no retries left" into "upload nothing, report success".grpc_uploader.upload_batch_grpchas the identical loop, so both transports are affected.What this changes
Both uploaders now reject a non-positive budget up front, matching the parameter-validation style the client already uses for
limitand the MMR bounds inlocal/qdrant_local.py:The guard
One question for maintainers rather than a guess from me:
0could also be read as "make one attempt, do not retry", which is a defensible reading of the name. Either way it must not mean "send nothing and claim success" — if you would prefer0to mean a single attempt, that is a one-line change to the bound and I am happy to make it instead.Validation
tests/test_uploader_max_retries.py, 8 tests, no live Qdrant required:Test output
The four that pass either way are deliberate controls:
max_retries=1must still upload exactly once on both transports, the public default must stay3, and the normal call path with a realPointStructmust be untouched. So the guard cannot be mistaken for having broken single-attempt uploads.Also checked, so you do not have to:
ruff format --line-length=99 --check(the only ruff hook this repo enables — the linter is commented out in.pre-commit-config.yaml) is clean on all three files;ruff checkreports the same 8 pre-existing findings before and after; andtests/embed_testshas one pre-existing failure (test_bm25_core, missingqdrant_clibinary) that fails identically onmaster.I did not run the integration tests, which need a Qdrant server.
All Submissions:
devbranch. Did you create your branch fromdev? — this targetsmaster, the default branch;devdoes not exist on this repository.New Feature Submissions:
pre-commitwithpip3 install pre-commitand set up hooks withpre-commit install?Changes to Core Features: