Repository navigation
fix(cli): stop printing repository config lookup debug line - #3593
Conversation
Attestation commands resolved the repository organization before the root command set the log level, so a debug line about a missing .chainloop.yml was printed on every run even without --debug. Set the log level before resolving the organization, ignore a missing .chainloop.yml, and warn when the file exists but cannot be loaded. Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: 256841e0-47e6-4647-b095-1cce91a60480
PR validation — ✅ 3 passing
AI Session Checks — 🟡 81% · ✅ 0 failing
|
| Status | Attribution | File | Lines |
|---|---|---|---|
| modified | ai | app/cli/cmd/attestation_test.go |
+55 / -1 |
| modified | ai | app/cli/cmd/attestation.go |
+12 / -2 |
| modified | ai | app/cli/cmd/attestation_init.go |
+4 / -2 |
Policies (4)
| Status | Policy | Material | Messages |
|---|---|---|---|
| ✅ Passed | ai-config-ai-agents-allowed |
ai-coding-session-256841 |
- |
| ✅ Passed | ai-config-no-dangerous-commands |
ai-coding-session-256841 |
- |
| ✅ Passed | ai-config-no-secrets |
ai-coding-session-256841 |
- |
| ✅ Passed | ai-config-mcp-servers-allowed |
ai-coding-session-256841 |
- |
Security Checks — ✅ 5 passing
✅ secret-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | secrets-detection |
- |
✅ sast-scan
| Status | Policy | Messages |
|---|---|---|
| ✅ Passed | owasp-top10-2025 |
- |
| ✅ Passed | sast |
- |
| ✅ Passed | cwe-top25 |
- |
| ✅ Passed | cwe-top26-40-cusp |
- |
Scans not applied (3)
| Scan | Reason |
|---|---|
vulnerability-scan |
no manifest/lockfile changed |
github-actions-scan |
no workflow files changed |
iac-scan |
no IaC files changed |
Security context
✅ Nothing this change touches has a recorded security-fix history.
View in Chainloop ↗ · How this works ↗
Powered by Chainloop and Chainloop Trace
attestation init reads .chainloop.yml a second time for project metadata and logged a debug line when the file was missing. A missing file is the normal case, so do not log it. Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: 256841e0-47e6-4647-b095-1cce91a60480
Attestation commands (
init,add,push,status,reset) printedDBG failed to load repository organization error=".chainloop.yml not found"on every run in a repository without a.chainloop.yml, even without--debug. The attestation command resolved the repository organization before the root command set the log level, so the debug line went through a logger with no level set.Changes:
PersistentPreRunEsets the log level before it resolves the organization, so anything logged there honors--debug..chainloop.ymlis the normal case and is no longer logged at any level..chainloop.ymlthat exists but cannot be loaded (for example, invalid YAML) is now logged as a warning.The issue proposed calling the organization lookup after the root
PersistentPreRunE. That order would break organization resolution from.chainloop.yml: the root hook reads the resolved organization to build the control plane connection (and to decide whether to fetch and save a default organization). So the call order is kept and only the log level is set earlier.Tested with a new table-driven test that runs the attestation
PersistentPreRunEwith an unleveled logger, as seeded bymain.go: no output for a missing file (with and without--debug), a warning for an invalid file, and the expected log level afterwards. Both guards were mutation-checked. Existing organization resolution tests pass unchanged.AI disclosure: this change was produced with Claude Code.
Fixes #3592
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri using the eng-autopilot skill