Skip to content

fix(crafter): surface auto-discovery validation errors#2983

Merged
jiparis merged 1 commit into
chainloop-dev:mainfrom
waveywaves:fix/dns1123-error-masking
Jul 9, 2026
Merged

fix(crafter): surface auto-discovery validation errors#2983
jiparis merged 1 commit into
chainloop-dev:mainfrom
waveywaves:fix/dns1123-error-masking

Conversation

@waveywaves

@waveywaves waveywaves commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Stop auto-detecting further material kinds when AddMaterialContractFree returns a protovalidate.ValidationError.
  • Surface invalid material-name validation errors directly instead of masking them behind a generic auto-discovery failure.

Fixes #2394

Assisted-by: pi

@waveywaves waveywaves force-pushed the fix/dns1123-error-masking branch from 9241f71 to 2c1b24b Compare April 3, 2026 11:26
@javirln

javirln commented Apr 7, 2026

Copy link
Copy Markdown
Member

@waveywaves is this ready to be reviewed?

@waveywaves waveywaves force-pushed the fix/dns1123-error-masking branch from 2c1b24b to 7fb43ea Compare April 7, 2026 08:16
@waveywaves waveywaves marked this pull request as ready for review April 7, 2026 08:16

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="pkg/attestation/crafter/crafter.go">

<violation number="1" location="pkg/attestation/crafter/crafter.go:670">
P2: DNS-1123 invalid-name errors are generic errors and are not treated as terminal in auto-detect, so they are retried and wrapped by the generic auto-discovery failure instead of being surfaced immediately.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread pkg/attestation/crafter/crafter.go
@waveywaves waveywaves force-pushed the fix/dns1123-error-masking branch from 7fb43ea to a1b71af Compare April 8, 2026 10:20
@waveywaves

Copy link
Copy Markdown
Contributor Author

@jiparis Ready for review — all commits GPG-signed and rebased on main. This fixes a variable shadowing bug that silently masks DNS-1123 validation errors in AddMaterialContractFree (issue #2394).

@waveywaves

Copy link
Copy Markdown
Contributor Author

@javirln Yes, this is ready for review! All commits are GPG-signed and rebased on latest main. Sorry for the delayed reply.

@waveywaves

Copy link
Copy Markdown
Contributor Author

@migmartri Would you be able to take a look at this one? It fixes a variable shadowing bug where DNS-1123 validation errors get silently masked in AddMaterialContractFree (issue #2394). All commits GPG-signed, CI green, cubic-dev-ai's finding already addressed. Happy to answer any questions!

Comment thread pkg/attestation/crafter/crafter.go Outdated
@jiparis

jiparis commented Apr 27, 2026

Copy link
Copy Markdown
Member

Thanks @waveywaves . Check my comment for the actual fix. #2394 is not about DNS names, but just surfacing the error as you did in that line. Please check.

@waveywaves waveywaves force-pushed the fix/dns1123-error-masking branch from a1b71af to 0e8c50d Compare April 29, 2026 13:06
@waveywaves

Copy link
Copy Markdown
Contributor Author

Thanks @jiparis — you're right, the DNS-1123 regex was out of scope. Stripped the PR back to just the two relevant changes:

  1. Variable shadowing fix: m, err :=m, err = so the error propagates out of the loop
  2. protovalidate.ValidationError early break so schema-level failures aren't masked by the kind-probing loop

All the unrelated changes (gracefulGitRepoHead refactor, policyEvalMatches removal, RunCollectors optimization) are gone. One file, 13 insertions, 7 deletions.

@waveywaves waveywaves force-pushed the fix/dns1123-error-masking branch from 0e8c50d to 6d1a3bb Compare April 29, 2026 13:08
@waveywaves waveywaves force-pushed the fix/dns1123-error-masking branch from 6d1a3bb to 80f7d34 Compare May 17, 2026 19:27
@waveywaves waveywaves force-pushed the fix/dns1123-error-masking branch from 80f7d34 to 7a7bc0f Compare June 30, 2026 11:16
Comment thread pkg/attestation/crafter/crafter.go Outdated
@waveywaves waveywaves force-pushed the fix/dns1123-error-masking branch from 7a7bc0f to d9e64ff Compare July 9, 2026 09:16
@waveywaves waveywaves changed the title fix(crafter): surface DNS-1123 validation errors instead of masking them fix(crafter): surface auto-discovery validation errors Jul 9, 2026
@waveywaves

waveywaves commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the latest feedback: dropped the outer m/err change, kept the early protovalidate.ValidationError return as the actual fix, added a regression test for invalid auto-detected material names, and refreshed the PR/commit AI disclosure to use Assisted-by: pi instead of the stale Claude Code wording.

Validated with:

go test ./pkg/attestation/crafter/...

@jiparis jiparis self-requested a review July 9, 2026 09:58
Stop probing material kinds when auto-detection hits a protovalidate
ValidationError. Schema-level failures, such as invalid material names,
are not kind mismatches and should be surfaced directly.

Fixes: chainloop-dev#2394

Assisted-by: pi
Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
@waveywaves waveywaves force-pushed the fix/dns1123-error-masking branch from d9e64ff to f315e32 Compare July 9, 2026 10:11
@jiparis

jiparis commented Jul 9, 2026

Copy link
Copy Markdown
Member

Thanks @waveywaves !

@jiparis jiparis merged commit 230dcec into chainloop-dev:main Jul 9, 2026
14 checks passed
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.

Material type auto-discovery hides material name not being dns-1123 compliant

3 participants