Refactor FCAF DCQL validator into focused modules#1362
Conversation
Co-authored-by: puria <10379+puria@users.noreply.github.com>
Co-authored-by: puria <10379+puria@users.noreply.github.com>
|
@copilot resolve the merge conflicts in this pull request |
…-dcql-go # Conflicts: # pkg/fcaf/validators/dcql.go Co-authored-by: puria <10379+puria@users.noreply.github.com>
Resolved the merge conflicts with main and preserved the modular DCQL split, including main’s newer validator modes and scenarios. The merge commit is |
Co-authored-by: puria <10379+puria@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
go.mod/go.sum currently remove a required private module (github.com/forkbombeu/credimi-extra) that is still imported in credimi_extra-tagged code paths, which is expected to break builds/lint.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR refactors the FCAF DCQL validator by splitting the previously monolithic dcql.go into smaller, focused modules while keeping the validator entrypoint/interface unchanged, and adds a couple of targeted regression tests for refactor-sensitive helpers.
Changes:
- Split DCQL validation helpers into focused files (types/helpers, credentials, claims, response parsing, trusted-authorities).
- Add tests for JSON-object normalization from string input and duplicate DCQL credential query IDs.
- Update Go module metadata (but currently drops required private dependencies).
File summaries
| File | Description |
|---|---|
| pkg/fcaf/validators/dcql.go | Keeps the validator entrypoint; removes large helper blocks now extracted into new modules. |
| pkg/fcaf/validators/dcql_types.go | Adds shared JSON/type helpers and DCQL credential-query validation utilities. |
| pkg/fcaf/validators/dcql_credentials.go | Extracts credential-set related validation helpers. |
| pkg/fcaf/validators/dcql_claims.go | Extracts claims and claim-path validation helpers. |
| pkg/fcaf/validators/dcql_response.go | Extracts vp_token/response validation and shared response/error helpers. |
| pkg/fcaf/validators/dcql_trusted_authorities.go | Extracts trusted-authority matching validation logic. |
| pkg/fcaf/validators/dcql_refactor_test.go | Adds regression tests for JSON normalization and duplicate query IDs. |
| go.mod | Updates module requirements (currently removes credimi-extra). |
| go.sum | Updates dependency checksums accordingly. |
Review details
- Files reviewed: 7/9 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| github.com/forkbombeu/credimi-conformance-assessment v1.3.1 | ||
| github.com/forkbombeu/credimi-extra v1.14.4 | ||
| github.com/forkbombeu/eudi-conformance-evidence v1.0.2 |
| } | ||
|
|
||
| //nolint:gocyclo // DCQL modes share decoding and evidence normalization in one registry validator. | ||
| func (DCQLResponseConstraintsValidator) Validate(_ context.Context, input Input) Result { |
| // SPDX-FileCopyrightText: 2026 Forkbomb BV | ||
| // | ||
| // SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
|
||
| package validators |
The FCAF DCQL validator had grown into a difficult-to-navigate monolithic file. This refactor improves structure without changing validation behavior.
The validator remains registered and called through the same interface: