Repository navigation
fix(engine) #5627: report a procedure's wrong argument count the way a function's is - #5698
Conversation
…a function's is Procedure declared a validateArgs() of its own that hand-wrote the count check and raised IllegalArgumentException, which CallStep.executeProcedure wrapped as a CommandExecutionException - a 500 for what is entirely the caller's mistake, while the same mistake on a function had given 400 since #5602. Procedure now has checkArity(), phrased through the shared FunctionArity, so the sentence and the exception type match the function side. It also picks up the two guards the hand-written check lacked: effectiveMax(), so a procedure spelling unbounded as -1 is not read as "at most -1 arguments", and a null argument array counted as no arguments rather than dereferenced. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 6 |
🟢 Coverage 100.00% diff coverage · -7.49% coverage variation
Metric Results Coverage variation ✅ -7.49% coverage variation Diff coverage ✅ 100.00% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (83448ea) 150078 114508 76.30% Head commit (1ffdcff) 182250 (+32172) 125404 (+10896) 68.81% (-7.49%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#5698) 11 11 100.00% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Tick the box to add this pull request to the merge queue (same as
|
Review: #5627 procedure arity unificationReviewed the diff against What's correct and verified
Observations (non-blocking)
Not verifiedCould not run Nice work - the change is minimal, the guards are correct, and the test coverage (CALL path, range vs exact, too-many, OPTIONAL, null array, full-registry sweep) is thorough. |
…he message contract change Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Review: procedure arity unification (#5627)I traced the full path ( What's right
Minor / optional
Nothing blocking. Nice, careful change. |
…Arity.check Function.checkArity and Procedure.checkArity were byte-identical but for the noun - the same shape the two messages had before this issue, and how they came to disagree. Both are now one line over a shared FunctionArity.check, so the effectiveMax() and null-array rules exist once. Also drops an @author tag attributing the new test to someone who did not write it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Review: unify procedure wrong-argument-count reporting (#5627)Reviewed against What I verified
Observations (non-blocking)
Couldn't verify locallyMaven compile/test is blocked in this sandbox (no network), so I relied on the PR's documented compile + test runs. All symbols the new test references ( Nice work - the reasoning in the commit messages and tracking doc made this easy to follow, and the "keep the noun, share everything after it" decision is the right one. |
…cks as a follow-up Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Review: #5627 procedure arity unificationReviewed the full diff and traced the call path ( What's good
Minor observations (non-blocking)
NoteI could not execute Nice, surgical change with the messaging and status now genuinely unified across the two callable kinds. |
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Review - PR #5698: unify procedure wrong-argument-count reportingReviewed the diff, the surrounding What's right
Minor notes (non-blocking)
VerificationCould not run Nice, surgical change. Automated review by Claude. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5698 +/- ##
============================================
- Coverage 67.49% 66.83% -0.66%
- Complexity 0 1112 +1112
============================================
Files 1770 1771 +1
Lines 150078 150258 +180
Branches 31809 31867 +58
============================================
- Hits 101290 100421 -869
- Misses 35607 36788 +1181
+ Partials 13181 13049 -132 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Closes #5627
Follow-up from #5602 (PR #5612), which unified the function side and deliberately left the procedure side alone.
Proceduredeclared avalidateArgs()of its own that hand-wrote the count check and raisedIllegalArgumentExceptionwith older wording, soCallStep.executeProcedurewrapped it in aCommandExecutionException- a 500 for what is entirely the caller's mistake, while the identical mistake against a function had returned 400 withFunction 'x' expects N arguments but got Msince #5602.Procedurenow has acheckArity()reading its declaredgetMinArgs()/getMaxArgs()and phrased through the sharedFunctionArity, so a wrong argument count reads with the same sentence and carries the same status whichever kind the name resolved to:Procedure 'algo.dijkstra' expects 4-5 arguments but got 2. The move also picks up the two guards the hand-written check lacked -FunctionArity.effectiveMax(), so a procedure spelling "unbounded" the registry's way (-1) is not read as "at most -1 arguments", and a null argument array counted as zero arguments instead of dereferenced.The word stays
Procedurerather thanFunction: reusingFunctionArity.messageverbatim would tell a caller thatalgo.dijkstrais a function, which it is not. The sentence shape, the accepted-count phrasing and the exception type are what the issue asks to unify, and all three now match.The ~80 hand-written
validateArgs(args)calls at the top of eachexecute()are kept, and the issue's question about dropping them is answered in the tracking doc: unlike the function-side duplicationFunction.checkArityreplaced, these are not a second hand-written count check that can drift - they call the same default method reading the same declared bounds - andProcedure.execute()is public, so dropping the guard would leave a direct caller with anArrayIndexOutOfBoundsExceptioninstead of the client error.Note on existing tests.
ProcedureInterfaceTest's five arity cases assertedIllegalArgumentExceptionand the literal strings"exactly 2"/"2 to 4"- which are the behaviour this issue asks to replace. They were testing the correct thing (the guard fires, with the right numbers) against the wording of the day, so the assertions are retargeted at the new contract rather than deleted or loosened to accept both. This is a deliberate exception to the "never modify existing tests" rule, flagged here for review.Test plan
mvn -pl engine test -Dtest=ProcedureArityIssue5627Test- 8 cases, all new. 7 of them fail onmain(the eighth asserts a correct call still runs). Covers: theCALLpath raisingCommandSemanticExceptionrather than a wrappedCommandExecutionException; exact-count and range phrasings; too many as well as too few;OPTIONAL CALLno longer swallowing it; a null argument array; a sweep over every registered procedure asserting the canonical sentence, so a procedure added later cannot reintroduce a wording of its own.mvn -pl engine test -Dtest=ProcedureInterfaceTest- 10 cases, including the new unbounded-maximum (-1andInteger.MAX_VALUE) and null-array coverage.mvn -pl engine test -Dtest='com.arcadedb.query.opencypher.**,com.arcadedb.function.**'- 8918 tests, 0 failures, 98 skipped.mvn -DskipTests compile- full reactor.Error executing procedure,requires exactly N argument(s),requires N to M arguments, got) finds no other dependant.🤖 Generated with Claude Code