Repository navigation
fix(cli): use the run's organization after attestation init - #3862
Conversation
After `attestation init --org org-a`, the commands add, push, status, and reset sent the organization of the repository `.chainloop.yml` before the organization stored in the local attestation state. When the file named another organization, they failed with "workflow run not found". The local attestation state now comes before the repository config: --org > CHAINLOOP_ORGANIZATION > local attestation state > .chainloop.yml > saved CLI default. init keeps reading the repository config, and remote state does not change. When the file names a different organization than the local state, the CLI logs which one it uses. The API token check applies to the repository organization only when that organization is used. This is within R-003 and R-004 of spec issue-3063-attestation-repo-config. Records the decision as ATT-006, which partly replaces ATT-001 and ATT-004. Closes #3861 Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: f8788f1a-57ad-450c-a7cf-229ee5f1e2d9
Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: f8788f1a-57ad-450c-a7cf-229ee5f1e2d9
PR validation — ✅ 3 passing
AI Session Checks — 🟡 85% · ✅ 0 failing
|
| Status | Attribution | File | Lines |
|---|---|---|---|
| modified | ai | app/cli/cmd/attestation_test.go |
+75 / -10 |
| modified | ai | app/cli/cmd/attestation.go |
+40 / -21 |
| modified | ai | docs/decisions/attestation-process.md |
+12 / -1 |
Policies (4)
| Status | Policy | Material | Messages |
|---|---|---|---|
| ✅ Passed | ai-config-ai-agents-allowed |
ai-coding-session-f8788f |
- |
| ✅ Passed | ai-config-no-dangerous-commands |
ai-coding-session-f8788f |
- |
| ✅ Passed | ai-config-no-secrets |
ai-coding-session-f8788f |
- |
| ✅ Passed | ai-config-mcp-servers-allowed |
ai-coding-session-f8788f |
- |
Security Checks — ✅ 6 passing
✅ AI Security Analysis
Nothing this change touches re-opens a recorded security fix.
View in Chainloop ↗ · How this works ↗
✅ 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 |
Powered by Chainloop and Chainloop Trace
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
View guided diff | Re-trigger cubic
With remote state, a local state file is a leftover of another run, so it must not select the organization. Also mark ATT-002 as partly replaced by ATT-006. Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: f8788f1a-57ad-450c-a7cf-229ee5f1e2d9
Closes #3861
After
chainloop attestation init --org org-a, the commandsadd,push,status, andresetsent the organization of the repository.chainloop.ymlinstead of the organization of the run. When the file named another organization, they failed with "workflow run not found".The organization stored in the local attestation state now comes before the repository config. The order is:
--org>CHAINLOOP_ORGANIZATION> local attestation state >.chainloop.yml> saved CLI default.initstill reads the repository config, and remote state (--attestation-id) does not change. When the file names a different organization than the local state, the CLI logs which one it uses. The API token check runs for the repository organization only when the CLI uses that organization.This is an implementation fix within R-003 and R-004 of spec
issue-3063-attestation-repo-config. R-003 puts the file before the saved CLI default, not before the organization of an attestation that is already initialized. The spec does not change. The fix keeps the behavior of #2823 and corrects the order that #3518 introduced.Decision record: adds ATT-006 to
docs/decisions/attestation-process.md. It partly replaces ATT-001 (the place of the local attestation state in the order) and ATT-004 (afterinit, the file does not act as--org).This PR was prepared with AI assistance (Claude Code).
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri