Skip to content

Refactor FCAF DCQL validator into focused modules - #1362

Open
puria with Copilot wants to merge 5 commits into
mainfrom
copilot/refactor-fcaf-dcql-go
Open

Refactor FCAF DCQL validator into focused modules#1362
puria with Copilot wants to merge 5 commits into
mainfrom
copilot/refactor-fcaf-dcql-go

Conversation

Copilot AI commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

The FCAF DCQL validator had grown into a difficult-to-navigate monolithic file. This refactor improves structure without changing validation behavior.

  • Module split
    • Extract credential-set validation.
    • Extract claims and claim-path validation.
    • Extract trusted-authority matching.
    • Extract response, error, and shared JSON helpers.
  • Focused coverage
    • Add direct tests for JSON normalization and duplicate DCQL query IDs.

The validator remains registered and called through the same interface:

result := DCQLResponseConstraintsValidator{}.Validate(ctx, input)

Copilot AI and others added 2 commits September 7, 2026 15:26
Co-authored-by: puria <10379+puria@users.noreply.github.com>
Co-authored-by: puria <10379+puria@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor fcaf dcql.go for improved structure Refactor FCAF DCQL validator into focused modules Sep 7, 2026
Copilot AI requested a review from puria September 7, 2026 15:27
@puria

puria commented Sep 9, 2026

Copy link
Copy Markdown
Member

@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>

Copilot AI commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts with main and preserved the modular DCQL split, including main’s newer validator modes and scenarios. The merge commit is 7a9b7f9; go test ./pkg/fcaf/validators passes.

Co-authored-by: puria <10379+puria@users.noreply.github.com>
@puria
puria marked this pull request as ready for review September 10, 2026 09:52
Copilot AI lite review requested due to automatic review settings September 10, 2026 09:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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.

Comment thread go.mod
Comment on lines 14 to 15
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
Comment on lines 20 to 21
}

//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
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.

[Refactor] fcaf dcql.go should be totally refactored

3 participants