Remove debug logging from ticket linking function
The ticket propagation issues have been resolved. Debug logging is no longer needed in production code. Changes: - Removed AuditLog debug logging from link_open_internal_tickets_to_run - Preserved debug logging code in backupchecks-system.md for future use - Updated changelog to document removal The debug code is available in the technical documentation if troubleshooting is needed again in the future. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
0d9159ef6f
commit
d467c060dc
@ -193,39 +193,6 @@ def link_open_internal_tickets_to_run(*, run: JobRun, job: Job) -> None:
|
|||||||
except Exception:
|
except Exception:
|
||||||
rows = []
|
rows = []
|
||||||
|
|
||||||
# Debug logging to audit log (visible in UI) - ALWAYS log, even if no tickets
|
|
||||||
try:
|
|
||||||
from .models import AuditLog
|
|
||||||
details = []
|
|
||||||
if rows:
|
|
||||||
for tid, code, t_resolved, ts_resolved in rows:
|
|
||||||
details.append(f"ticket_id={tid}, code={code}, t.resolved_at={t_resolved}, ts.resolved_at={ts_resolved}")
|
|
||||||
else:
|
|
||||||
details.append("No open tickets found for this job")
|
|
||||||
|
|
||||||
audit = AuditLog(
|
|
||||||
user="system",
|
|
||||||
event_type="ticket_link_debug",
|
|
||||||
message=f"link_open_internal_tickets_to_run called: run_id={run.id}, job_id={job.id}, found={len(rows)} ticket(s)",
|
|
||||||
details="\n".join(details)
|
|
||||||
)
|
|
||||||
db.session.add(audit)
|
|
||||||
# Use commit instead of flush to ensure it's persisted
|
|
||||||
db.session.commit()
|
|
||||||
except Exception as e:
|
|
||||||
# Log the exception so we know if something goes wrong
|
|
||||||
try:
|
|
||||||
audit_err = AuditLog(
|
|
||||||
user="system",
|
|
||||||
event_type="ticket_link_error",
|
|
||||||
message=f"Error in ticket link debug logging",
|
|
||||||
details=str(e)
|
|
||||||
)
|
|
||||||
db.session.add(audit_err)
|
|
||||||
db.session.commit()
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if not rows:
|
if not rows:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@ -12,9 +12,11 @@ This file documents all changes made to this project via Claude Code.
|
|||||||
- Fixed Run Checks popup showing resolved tickets for runs where they were never linked by replacing date-based ticket/remark queries in `/api/job-runs/<run_id>/alerts` endpoint with explicit link-based queries (now only shows tickets/remarks that were actually linked to the specific run via ticket_job_runs/remark_job_runs tables, completing the transition from date-based to explicit-link ticket system)
|
- Fixed Run Checks popup showing resolved tickets for runs where they were never linked by replacing date-based ticket/remark queries in `/api/job-runs/<run_id>/alerts` endpoint with explicit link-based queries (now only shows tickets/remarks that were actually linked to the specific run via ticket_job_runs/remark_job_runs tables, completing the transition from date-based to explicit-link ticket system)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Added debug logging to ticket linking function to troubleshoot resolved ticket propagation issues (writes to AuditLog table with event_type "ticket_link_debug", visible on Logging page, logs EVERY run import to show whether tickets were found and their resolved_at status, uses commit instead of flush to ensure persistence)
|
|
||||||
- Reduced test email generation from 3 emails per status to 1 email per status for simpler testing (each button now creates exactly 1 test mail instead of 3)
|
- Reduced test email generation from 3 emails per status to 1 email per status for simpler testing (each button now creates exactly 1 test mail instead of 3)
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
- Removed debug logging from ticket linking function as ticket propagation issues are now resolved (debug logging code preserved in backupchecks-system.md for future troubleshooting if needed)
|
||||||
|
|
||||||
## [2026-02-09]
|
## [2026-02-09]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user