Skip to content

feat(#7829): remove DeleteDropUserHandler, a deprecated handler no route constructs - #8763

Merged
robfrank merged 3 commits into
mainfrom
feat/7829-remove-deletedropuserhandler
Oct 1, 2026
Merged

robfrank merged 3 commits into
mainfrom
feat/7829-remove-deletedropuserhandler

Conversation

@robfrank

@robfrank robfrank commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #7829

DeleteDropUserHandler (the deprecated DELETE /server/user?userName= handler) has been constructed by nothing since the HTTP server refactor in #1250 removed its route. It still compiled and still called ServerSecurity.dropUserClusterWide, so audits of the security entry points (#7559) counted it as a live door. This PR deletes it and adds a source-level guard, EveryHttpHandlerIsConstructedTest, which fails when any concrete handler in com.arcadedb.server.http.handler is not constructed (new X(, X::new, extends X) by the main sources of any module. The next orphaned handler then shows up in CI instead of in an audit.

Before deleting, I checked for references to the route, as the issue asked:

  • OpenAPI: SecurityAdminApiSpec documents only /api/v1/server/users. There is no /server/user/{name} path.
  • No reference in docs/, the Studio sources, or any JS/TS/Python/Go client (grep -E "server/user[^s]" returns nothing).
  • The http.drop-user metric is still incremented by PostServerCommandHandler's drop user command, so no metric goes away.

Test plan

  • EveryHttpHandlerIsConstructedTest fails on main with Expecting empty but was: ["DeleteDropUserHandler"]
  • It passes after the deletion (0.7 s). It has two sanity checks: at least 30 handlers must be found, and DeleteUserHandler must be seen as constructed
  • HardcodedTestServerPortsTest and OpenApiSpecGeneratorTest are green
  • mvn -pl server -am test compiles

Coverage

Invariant: every concrete HTTP handler in com.arcadedb.server.http.handler is constructed by production code.

Entry point / class Status
DeleteDropUserHandler deleted here
All other concrete *Handler in the package (65 files) swept: none others unconstructed (checked by a grep loop and now by the test)
Issue7559SecurityPreconditionOnFollowerTest javadoc mention updated to say the class was removed

Known gaps: None. The guard covers only the server handler package. Plugin modules keep their handlers in their own packages, where they are registered by the plugin itself.

Adversarial pass

No subagent tool was available in this run, so the author ran the Phase 1.5 pass instead. That makes it less independent than the process intends. Checks and results:

  • Does anything still reach the route? No. HttpServer routes DELETE /server/users to DeleteUserHandler, and git log -S shows the new DeleteDropUserHandler( call was removed in Refactor HTTP Server #1250.
  • Is the route documented anywhere? No (see above).
  • Could the guard pass vacuously? No. It asserts a minimum handler count and that a known-routed handler is detected, and it was observed red before the deletion.
  • (Added in review) A test that restores the handler and adds // was: new DeleteDropUserHandler(this) to HttpServer is still red, so a comment does not count as construction.

Review cycles

Cycle Head Changes Bot outcome
1 0977634 initial: delete the handler, add the guard claude: LGTM, 6 non-blocking notes. Applied: strip comments and literals before matching, and match non-public/final handler classes
2 477fcf9 comment/literal stripping, wider class match claude: LGTM, 6 non-blocking notes. Applied: self-file exclusion is now exact (only server/.../handler/X.java), sources are scanned one file at a time, and the javadoc explains extends X
3 e69ff02 exact self-exclusion, streaming scan claude: LGTM, only non-blocking notes. None applied (see below)

Deferred items (skipped, non-blocking)

  • "Matching is by simple name, not FQN": a same-named handler constructed in another package would hide an orphan. No such name collision exists today, and resolving it would need import-aware parsing. Skipped.
  • "Class detection misses annotated declarations on the same line / public static class": every handler in the package declares its class at the start of the line. A miss here only skips a file. It never produces a false alarm, and the minimum-count check limits how much can be skipped. Skipped.
  • "Reflection / ServiceLoader registration would be reported": nothing registers handlers that way. The failure message says what to do. Skipped.
  • "Path.of("..") working-directory dependency" and "startsWith in SKIPPED_TOP_LEVEL": these match the existing HardcodedTestServerPortsTest convention. Skipped for consistency.
  • "Non-recursive listing": intended. The javadoc scopes the guard to this package.

Final state

clean-approval

🤖 Generated with Claude Code

…ute constructs

The DELETE /server/user route was dropped in #1250 and its handler left behind.
It still called ServerSecurity.dropUserClusterWide, so security audits counted
it as a live entry point (#7559). A source-level test now fails when any
concrete handler in com.arcadedb.server.http.handler is constructed nowhere.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 330e80d2-b4e8-4346-9d3d-b767d3c3e51f

📥 Commits

Reviewing files that changed from the base of the PR and between a94d47d and e69ff02.

📒 Files selected for processing (3)
  • ha-raft/src/test/java/com/arcadedb/server/ha/raft/Issue7559SecurityPreconditionOnFollowerTest.java
  • server/src/main/java/com/arcadedb/server/http/handler/DeleteDropUserHandler.java
  • server/src/test/java/com/arcadedb/server/http/handler/EveryHttpHandlerIsConstructedTest.java
💤 Files with no reviewable changes (1)
  • server/src/main/java/com/arcadedb/server/http/handler/DeleteDropUserHandler.java

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The deprecated DeleteDropUserHandler was removed. A source-scanning test now checks that each concrete HTTP handler is referenced by production code. A related test comment now states that the handler was removed.

Changes

HTTP Handler Cleanup

Layer / File(s) Summary
Remove the unreferenced handler and check production references
server/src/test/java/com/arcadedb/server/http/handler/EveryHttpHandlerIsConstructedTest.java, server/src/main/java/com/arcadedb/server/http/handler/DeleteDropUserHandler.java, ha-raft/src/test/java/com/arcadedb/server/ha/raft/Issue7559SecurityPreconditionOnFollowerTest.java
Removes DeleteDropUserHandler. Adds a source-scanning test that checks production references to concrete handlers. Updates a test comment to state that the handler was removed.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to e69ff

The cleanup preserves the documented user-deletion endpoint and adds a check for unused handlers. No actionable merge-blocking risk remains after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR satisfies the coding requirements in directly linked issue #7829. It removes DeleteDropUserHandler, which the issue identifies as unconstructed, and adds EveryHttpHandlerIsConstructedTest t…
Out of Scope Changes check ✅ Passed The changes stay within issue #7829. The deleted handler, the construction-guard test, and the updated explanatory comment all support removal of the orphan handler and prevention of similar orphan ha…
Title check ✅ Passed The title clearly identifies the main change: removal of the deprecated, unconstructed DeleteDropUserHandler. It is concise and relevant, although it does not mention the added guard test.
Description check ✅ Passed The description provides detailed change context, motivation, related issue information, validation results, coverage, known scope, and review notes. It does not use the exact template headings and do…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

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

@mergify

mergify Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@codacy-production

codacy-production Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage ∅ diff coverage · -5.98% coverage variation

Metric Results
Coverage variation ✅ -5.98% coverage variation
Diff coverage ✅ ∅ diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (a94d47d) 201284 169749 84.33%
Head commit (e69ff02) 233846 (+32562) 183229 (+13480) 78.35% (-5.98%)

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 (#8763) 0 0 ∅ (not applicable)

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.

@claude

claude Bot commented Sep 30, 2026

Copy link
Copy Markdown

Review

Overall: LGTM. The deletion is safe and the guard test is a good idea. A few non-blocking notes.

Deletion

  • I grepped the tree: the only remaining mentions of DeleteDropUserHandler are the two javadocs (the updated one in Issue7559SecurityPreconditionOnFollowerTest and the new test). No code, route, OpenAPI or metric references remain. http.drop-user is still incremented elsewhere, as the description says.
  • No behavior or security regression: the handler was unreachable, and removing it shrinks the surface that calls dropUserClusterWide.

EveryHttpHandlerIsConstructedTest (minor robustness points, none blocking)

  1. The regex scan does not strip comments or string literals, so a javadoc or comment like new FooHandler( in another main source file would mark an orphan as "constructed" (a false negative). Stripping //, /* */ and string literals before matching would make the guard stricter. It is best effort as it stands, which is probably acceptable.
  2. extends X counts as construction. A concrete handler that is only subclassed, and never instantiated itself, passes. That seems intentional for the abstract bases (already skipped by the public class filter), but it could also hide a concrete orphan that has a subclass.
  3. concreteHandlers() matches only public class. A package-private or final/public final class handler would be silently ignored. Consider (public\s+)?(final\s+)?class.
  4. The .worktrees / node_modules skip list is a good call. The scan reads every module's main sources (a few thousand files) into a Map<String,String> just to regex them. It runs in about 0.8 s per the description, so it is fine, but it could match line by line or drop each file's content after scanning if it ever grows.
  5. The relative Path.of("..") depends on surefire's working directory being the module. The isDirectory() assertion fails loudly if not, which is the right behavior.
  6. Style: the test follows the assertThat(...) convention and needs no @Tag, since it is fast. Nice that the sanity checks (minimum handler count, DeleteUserHandler seen) prevent a vacuous pass.

Test coverage: the PR shows the guard red on main and green after the deletion, which is the regression proof needed here. I did not run the build myself.

No blockers from my side.

…ch non-public and final handlers

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Sep 30, 2026

Copy link
Copy Markdown

Review

Verdict: looks good to merge. No blocking issues.

Deletion

  • Confirmed no remaining reference to DeleteDropUserHandler in the tree apart from the two javadoc mentions (the new test and Issue7559SecurityPreconditionOnFollowerTest), both of which read correctly.
  • The http.drop-user metric is still emitted by PostServerCommandHandler, as the description says, and the cluster-wide drop path is still reachable through DELETE /server/users and the drop user command. Removing dead code here shrinks the audit surface without changing behaviour.

EveryHttpHandlerIsConstructedTest

Good idea, and the two sanity assertions (minimum handler count, known-routed DeleteUserHandler seen) stop it from passing vacuously. It follows the same Path.of("..") reactor-root convention as HardcodedTestServerPortsTest. Some small observations, none blocking:

  1. extends X counts as construction. If a concrete handler is only ever subclassed and the subclass is itself orphaned, the parent is masked. PostQueryHandler extends PostCommandHandler is an example of the shape. The subclass would still be flagged, so the orphan is caught, but only one level at a time. Acceptable; maybe worth a one-line note in the javadoc.
  2. Matching is by simple name, not FQN. A same-named handler class in a plugin package that is constructed would mark the server one as constructed, and the self-file exclusion (endsWith("/" + handler + ".java")) would also skip a same-named file in another module. Unlikely today, but a false negative is silent. Matching the package (or at least excluding only server/.../handler/<X>.java) would make it exact.
  3. Concrete-class detection uses ^\s*(public\s+)?(final\s+)?class Name. It works for the current files but would miss a class with a leading annotation on the same line or sealed/non-sealed. If a file ever fails to match, it is silently treated as abstract and skipped, so the "at least 30 handlers" check is the only safety net. Fine for now.
  4. Reflection / ServiceLoader registration would be reported as unconstructed. The failure message says "register it in HttpServer or delete it", which is the right default, but an allow-list escape hatch may be needed if that pattern ever appears.
  5. Performance/CI: the test reads every src/main/java file in every module into a Map<String, String> (a few thousand files, a few tens of MB). It runs in under a second per the PR description, so fine, though you could scan file by file and only keep the matched names to avoid holding all sources in memory.
  6. Style: the test is tagged as a plain unit test, uses assertThat as required, and adds no dependencies, no System.out, and no wall-clock assertions. Nothing to fix there.

Security / performance

Removing a root-only delete-user door reduces attack surface; no new code runs at runtime. The test is build-time only.

Nice, tidy PR.

…scan sources one file at a time

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Sep 30, 2026

Copy link
Copy Markdown

Review

Overall: a clean, well-scoped change. Nothing blocks the merge. I checked the tree and no reference to DeleteDropUserHandler remains other than the two javadoc mentions, which the PR already words as history. Removing the class is safe.

Deletion

  • Correct. The http.drop-user metric is still incremented by PostServerCommandHandler, and DELETE /server/users goes to DeleteUserHandler, so no documented behaviour is lost.
  • Only the @Deprecated class is removed. The now-orphaned ServerSecurity.dropUserClusterWide still has live callers through the other paths, so it needs no change.

EveryHttpHandlerIsConstructedTest

The design is sound: it strips comments and literals, has two sanity assertions so it can't pass vacuously, and has a single clear failure message. A few notes, none blocking:

  1. Working directory dependency. REACTOR_ROOT = Path.of("..") assumes Surefire runs with the server module as cwd. The isDirectory assertion fails loudly if that's wrong (good), but running from an IDE at the repo root gives a confusing failure. Consider a short hint in the assertion message, or resolve the root by walking up from user.dir until server/src/main/java is found.
  2. Class detection misses annotated declarations on the same line. concreteHandlers() requires ^\s*(public\s+)?(final\s+)?class Name at line start. Something like @Deprecated public class FooHandler on one line, or public static class, would be skipped, so a future orphan written that way is silently not checked. The current tree has only one annotation, on its own line in GetDatabasesHandler, so this is fine today. Allowing an optional leading annotation ((?:@\w+(?:\([^)]*\))?\s+)*) would close it.
  3. Non-recursive listing. Files.list(HANDLER_PACKAGE) ignores any future sub-package of handlers. The Javadoc says "in this package" so this is consistent, but a one-line note would make it explicit.
  4. Simple-name matching. A new FooHandler( in another module for a different class with the same simple name (e.g. a plugin's own GetDatabasesHandler) would count as constructing the server one. Low probability, and the failure mode is a missed orphan, not a false alarm.
  5. Scan cost. It reads every main .java file in every module with a DOTALL lazy regex. The PR reports 0.8 s, which is fine, but the /\*.*?\*/ and string patterns are worth keeping an eye on if very large generated sources are added. Skipping target/ is already handled by only walking src/main/java.
  6. SKIPPED_TOP_LEVEL uses startsWith, so any module directory named e.g. node_modules-foo is skipped too. Harmless, but equals for node_modules would be more precise.

Style vs CLAUDE.md

  • Test uses assertThat(...) style, final params/variables, no System.out, no new dependencies. Good.
  • No @Tag is needed since it runs in under a second.
  • The test has no timing assertions, so the StallAwareStopwatch rule does not apply.

Security / performance

No runtime impact beyond removing a dead, root-only endpoint class. The removal slightly shrinks the audit surface, which is the stated goal.

LGTM.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.07%. Comparing base (a94d47d) to head (e69ff02).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8763   +/-   ##
=========================================
  Coverage     76.06%   76.07%           
+ Complexity     3704     3703    -1     
=========================================
  Files          2075     2074    -1     
  Lines        201284   201269   -15     
  Branches      42403    42399    -4     
=========================================
+ Hits         153106   153113    +7     
+ Misses        31577    31545   -32     
- Partials      16601    16611   +10     

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@robfrank
robfrank merged commit 77d08b8 into main Oct 1, 2026
35 of 37 checks passed
@robfrank
robfrank deleted the feat/7829-remove-deletedropuserhandler branch October 1, 2026 07:13
robfrank added a commit that referenced this pull request Oct 6, 2026
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.

Remove DeleteDropUserHandler: the deprecated DELETE /api/v1/server/user/{name} route is constructed nowhere

1 participant