Repository navigation
fix(trace): exclude generated files from the AI-generated line counts - #3790
Conversation
The trace state now keeps the lines of the agent edits per file, so the push can leave out the files that .gitattributes marks linguist-generated from ai_generated_lines_added and ai_generated_lines_removed, as it already does for the other line counts. Fixes PFM-8130 Assisted-by: Claude Code Signed-off-by: Jose Ignacio Paris Prieto <jiparis@chainloop.dev> Chainloop-Trace-Sessions: d38ce0e4-9555-422b-a581-9ee2f03c8a78
PR validation — ✅ 3 passing
AI Session Checks — 🟢 89% · ✅ 0 failing
|
| Status | Attribution | File | Lines |
|---|---|---|---|
| modified | ai | app/cli/internal/trace/attribution/generated_test.go |
+64 / -0 |
| modified | ai | app/cli/internal/trace/attribution/enrich_test.go |
+0 / -55 |
| modified | ai | app/cli/pkg/action/trace_line_attribution_test.go |
+46 / -7 |
| modified | ai | app/cli/internal/trace/state/ailines.go |
+31 / -7 |
| modified | ai | app/cli/internal/trace/state/ailines_test.go |
+16 / -2 |
| modified | ai | app/cli/internal/trace/attribution/generated.go |
+15 / -0 |
| modified | ai | app/cli/pkg/action/trace_codex_hook_test.go |
+3 / -2 |
| modified | ai | app/cli/internal/trace/attribution/enrich.go |
+0 / -4 |
| modified | ai | app/cli/internal/trace/README.md |
+1 / -1 |
| modified | ai | app/cli/pkg/action/trace_hook_handler.go |
+1 / -0 |
Policies (4)
| Status | Policy | Material | Messages |
|---|---|---|---|
| ✅ Passed | ai-config-ai-agents-allowed |
ai-coding-session-d38ce0 |
- |
| ✅ Passed | ai-config-no-dangerous-commands |
ai-coding-session-d38ce0 |
- |
| ✅ Passed | ai-config-no-secrets |
ai-coding-session-d38ce0 |
- |
| ✅ Passed | ai-config-mcp-servers-allowed |
ai-coding-session-d38ce0 |
- |
Security Checks — ✅ 5 passing
✅ Reviewed this change against the project's security context (4 concerns hunted) — no introduced risk found.
View in Chainloop ↗ · How this works ↗
✅ Reviewed this change against the project's security context (4 concerns hunted) — no introduced risk found.
View in Chainloop ↗ · How this works ↗
✅ Reviewed this change against the project's security context (4 concerns hunted) — no introduced risk found.
View in Chainloop ↗ · How this works ↗
✅ Reviewed this change against the project's security context (4 concerns hunted) — no introduced risk found.
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
The AI coding session evidence already leaves out files that
.gitattributesmarkslinguist-generatedfromfilesand from its line and file counts. Theai_generated_lines_addedandai_generated_lines_removedtotals still included them. So when the agent ran a generator such aswireormake generate, the generated diff counted as lines the AI wrote.The trace state now keeps the lines of the agent edits per file. At push time, the totals leave out generated files with the same matcher that filters the code changes. The trace README is updated to match.
Fixes PFM-8130. Related to spec issue-3639 (R-011, D-011).
AI disclosure: this change was developed with the assistance of Claude Code.