Skip to content

Comments

Add DotFolderByPath GraphQL root query for folder tree browsing#34693

Open
fmontes wants to merge 17 commits intomainfrom
issue-34692-add-dotfolder-graphql-query
Open

Add DotFolderByPath GraphQL root query for folder tree browsing#34693
fmontes wants to merge 17 commits intomainfrom
issue-34692-add-dotfolder-graphql-query

Conversation

@fmontes
Copy link
Member

@fmontes fmontes commented Feb 19, 2026

folder-gql.mp4

Summary

Closes #34692

Adds a new DotFolderByPath GraphQL root query that returns a folder at a given path with recursive children traversal, enabling full folder tree browsing.

Example:

query {
  DotFolderByPath(path: "/application/") {
    folderTitle
    folderPath
    children {
      folderTitle
      folderPath
    }
  }
}

Implementation

Follows the established provider pattern (same as DotNavigation):

  • FolderCollectionTypeProvider — defines DotFolderCollectionItem type with recursive children field using GraphQLTypeReference
  • FolderCollectionFieldProvider — defines the DotFolderByPath(path: String!) root query field returning a single folder object
  • FolderCollectionDataFetcher — resolves the folder at the given path via FolderAPI.findFolderByPath(), eagerly loads children with configurable max depth (GRAPHQL_FOLDER_COLLECTION_MAX_DEPTH, default 3)
  • GraphqlAPIImpl — registered both new providers

Design decisions

  • Query name DotFolderByPath instead of DotFolder to avoid conflict with the existing DotFolder type in CustomFieldType.FOLDER
  • Max depth default 3 (configurable via env var) to limit eager loading performance impact
  • Children return null on error instead of empty list, so clients can distinguish "no children" from "error loading children"
  • Specific exception handling — catches DotSecurityException (permission denied), DotDataException (data layer), and generic Exception separately with distinct log messages
  • folderId uses folder.getInode() — consistent with existing DotFolderTransformerImpl

Files changed

File Change
FolderCollectionTypeProvider.java New — recursive GraphQL type
FolderCollectionFieldProvider.java New — root query field
FolderCollectionDataFetcher.java New — data fetcher with depth guard
FolderCollectionDataFetcherTest.java New — unit tests
GraphqlAPIImpl.java Modified — register providers

Test plan

  • Unit tests for FolderCollectionDataFetcher
  • Build passes (./mvnw install -pl :dotcms-core -DskipTests)
  • Manual test: query DotFolderByPath(path: "/") returns root folder with children
  • Manual test: nested children queries resolve correctly
  • Manual test: non-existent path returns null
  • Integration tests verify schema structure

🤖 Generated with Claude Code

Add a new DotFolder GraphQL root query that returns a folder at a given
path with recursive children traversal, enabling full folder tree
browsing via GraphQL.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fmontes fmontes linked an issue Feb 19, 2026 that may be closed by this pull request
9 tasks
@fmontes fmontes requested a review from Copilot February 19, 2026 00:23
@github-actions github-actions bot added Area : Backend PR changes Java/Maven backend code Area : CI/CD PR changes GitHub Actions/workflows Area : Documentation PR changes documentation files Area : Frontend PR changes Angular/TypeScript frontend code Area : SDK PR changes SDK libraries labels Feb 19, 2026
@fmontes fmontes changed the base branch from master to main February 19, 2026 00:24
Copy link
Contributor

Copilot AI left a comment

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 adds extensive GitHub Actions CI/CD workflow infrastructure and improvements to support multi-Java-version releases, enhanced testing, and better developer experience through GitHub Codespaces integration.

Changes:

  • Introduces new release workflows with Java version override capabilities
  • Adds PR area labeling automation for better issue organization
  • Creates GitHub Codespaces configuration for cloud-based development
  • Implements Cursor IDE rules and Claude Code agent/skill system for AI-assisted code review
  • Refactors issue templates for better team collaboration

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
.github/workflows/cicd_comp_release-prepare-phase.yml New workflow for preparing releases with version validation and branch creation
.github/workflows/cicd_comp_release-phase.yml New workflow for release artifact deployment and SBOM generation
.github/workflows/cicd_6-release.yml Main release orchestration workflow with Java version override support
.github/workflows/cicd_comp_deployment-phase.yml Enhanced deployment phase with Java version and artifact suffix support
.github/workflows/cicd_comp_build-phase.yml Updated build phase with Java version and compiler release override capabilities
.github/workflows/cicd_comp_pr-area-labeler.yml New workflow for automatically labeling PRs based on changed file paths
.github/workflows/cicd_comp_finalize-phase.yml Enhanced finalization with comprehensive job status checking via GitHub API
.github/filters.yaml Expanded filter definitions for area labeling and test triggering
.github/area-labels.yml Configuration mapping file path filters to GitHub area labels
.github/actions/core-cicd/maven-job/action.yml Enhanced Maven job action with Java version override and compiler release configuration
.devcontainer/devcontainer.json New GitHub Codespaces configuration with Docker-in-Docker support
.devcontainer/setup.sh Setup script for initializing Codespaces environment with dotCMS services
.claude/skills/review/SKILL.md New AI-powered PR review skill with multi-agent architecture
.claude/agents/file-classifier.md Agent for classifying PR files by domain for specialized review
.cursor/rules/*.mdc Cursor IDE context rules for Java, frontend, testing, and documentation
.github/ISSUE_TEMPLATE/*.yaml Refactored issue templates (defect, feature, task, spike, epic, pillar)

@dotCMS dotCMS deleted a comment from Copilot AI Feb 19, 2026
@dotCMS dotCMS deleted a comment from Copilot AI Feb 19, 2026
@dotCMS dotCMS deleted a comment from Copilot AI Feb 19, 2026
@fmontes fmontes requested a review from Copilot February 19, 2026 00:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

- Rename query field from DotFolder to DotFolderByPath to avoid
  conflict with existing DotFolder type in CustomFieldType
- Lower default max recursion depth from 5 to 3 for performance
- Return null instead of empty list on children error to distinguish
  from folders with no children
- Add warning log when max depth limit is reached
- Document performance implications in javadoc

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot removed Area : Frontend PR changes Angular/TypeScript frontend code Area : SDK PR changes SDK libraries Area : Documentation PR changes documentation files labels Feb 19, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

…ataFetcher

Test property mapping, depth guard, and map key presence using
real Folder objects without requiring integration test infrastructure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fmontes fmontes changed the title Add DotFolder GraphQL root query for folder tree browsing Add DotFolderByPath GraphQL root query for folder tree browsing Feb 19, 2026
@fmontes fmontes requested a review from Copilot February 19, 2026 04:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

fmontes and others added 3 commits February 19, 2026 05:56
- Add null check for host in FolderCollectionDataFetcher to prevent NPE
  when host cannot be resolved from request
- Fix Logger lambda style in FolderCollectionTypeProvider to match
  NavigationTypeProvider convention (no space before arrow)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Split Start/Stop into separate tasks (Start prompts for mode, Stop is one-click)
- Add Build + Run combined task
- Add Clean Build task (removes target/ to fix stale jar issues)
- Add run mode selection (normal, debug, debug-suspend)
- Fix port always being passed to Docker for all run modes
- Remove unnecessary DOCKER_HOST exports

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fmontes fmontes marked this pull request as ready for review February 19, 2026 12:15
Copy link
Contributor

@fabrizzio-dotCMS fabrizzio-dotCMS left a comment

Choose a reason for hiding this comment

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

A postman test is in order here

fmontes and others added 5 commits February 19, 2026 12:11
Change max depth log from warn to debug to reduce production log noise.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Test buildFolderMap with real DB folders: property mapping, children
loading, recursive grandchildren, max depth guard, and leaf folders.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address PR review feedback:
- Propagate exceptions in buildFolderMap via GraphQL errors array instead
  of silently returning null children (hassandotcms feedback)
- Add optional 'site' parameter to resolve host explicitly, falling back
  to request host when not provided (dsilvam feedback)
- Add Postman tests for DotFolderByPath query (success, site param,
  error cases)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dario-daza dario-daza self-requested a review February 23, 2026 15:18
@fmontes
Copy link
Member Author

fmontes commented Feb 23, 2026

@nollymar @fabrizzio-dotCMS @hassandotcms @dsilvam ready here...

foldergql2.mp4

…eporting

- Validate site parameter explicitly via HostAPI.findByIdOrKey() instead of
  relying on host resolution that silently falls back to the default site
- Improve error messages: "Site 'X' not found" and "Folder not found at path
  '/path' on site 'hostname'" instead of generic "Resource not found" messages
- Catch DotSecurityException from findFolderByPath and throw clear
  PermissionDeniedGraphQLException
- Surface permission errors for child folders: use system user to discover all
  children, diff against permitted set, report denied count in GraphQL errors
  array without leaking folder names/paths for security
- Compute requested depth from query AST so permission checks and child loading
  only happen at levels the query actually requests
- Add PERMISSION_DENIED code to PermissionDeniedGraphQLException extensions
- Add computeRequestedDepth unit tests and permission integration test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fmontes and others added 3 commits February 24, 2026 11:40
…cher test

The permission test was failing because child2 inherited READ permission
from the parent folder. Use permissionIndividually() to break inheritance
so the limited user correctly cannot access child2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area : Backend PR changes Java/Maven backend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Add DotFolderByPath GraphQL root query for folder tree browsing

6 participants