Shorten hwmonDaemon auto-comments (drop embedded ASCII description)
Security / PHP Security (semgrep) (push) Successful in 2m12s
Lint / Deploy (push) Successful in 4s
Lint / Notify on failure (push) Has been skipped
Lint / PHP (phpcs PSR-12) (push) Successful in 1m4s
Lint / JS (eslint) (push) Successful in 14s
Lint / PHP requirements (version + extensions) (push) Successful in 37s
Security / PHP Security (semgrep) (push) Successful in 2m12s
Lint / Deploy (push) Successful in 4s
Lint / Notify on failure (push) Has been skipped
Lint / PHP (phpcs PSR-12) (push) Successful in 1m4s
Lint / JS (eslint) (push) Successful in 14s
Lint / PHP requirements (version + extensions) (push) Successful in 37s
The priority-escalation and recurrence comments embedded the full ASCII
alert description in a code block, producing a wall-of-text comment every
time. Since the ticket DESCRIPTION is already refreshed with the current
sensor data on each update, the comment only needs to record the event:
- Escalation: short note with from/to priority labels + a brief reason
("more severe condition reported, needs faster attention; see description").
- Recurrence: short reopened note pointing at the refreshed description.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+12
-3
@@ -312,9 +312,18 @@ if ($existing) {
|
||||
$updStmt->close();
|
||||
|
||||
// Only post a comment on priority escalation — title and description updates
|
||||
// are silent (title changes like rising counters would spam a comment every run)
|
||||
// are silent (title changes like rising counters would spam a comment every run).
|
||||
// Keep it short: the full sensor data is refreshed in the ticket description,
|
||||
// so the comment just records the bump + a brief reason (no ASCII dump).
|
||||
if (isset($changes['priority'])) {
|
||||
$commentText = "**hwmonDaemon escalated this ticket from P{$changes['priority']['from']} to P{$changes['priority']['to']}.**\n\n```\n" . $description . "\n```";
|
||||
$pLabels = [1 => 'P1 (Critical)', 2 => 'P2 (High)', 3 => 'P3 (Medium)', 4 => 'P4 (Low)', 5 => 'P5 (Minimal)'];
|
||||
$fromP = (int)$changes['priority']['from'];
|
||||
$toP = (int)$changes['priority']['to'];
|
||||
$fromL = $pLabels[$fromP] ?? "P{$fromP}";
|
||||
$toL = $pLabels[$toP] ?? "P{$toP}";
|
||||
$commentText = "**hwmonDaemon raised priority {$fromL} → {$toL}.**\n\n"
|
||||
. "The latest monitoring scan reported a more severe condition for this issue, "
|
||||
. "so it now needs faster attention. Current sensor data is in the ticket description above.";
|
||||
$commentStmt = $conn->prepare(
|
||||
"INSERT INTO ticket_comments (ticket_id, user_id, user_name, comment_text, markdown_enabled) VALUES (?, ?, 'hwmonDaemon', ?, 1)"
|
||||
);
|
||||
@@ -362,7 +371,7 @@ if ($existing) {
|
||||
$reopenStmt->close();
|
||||
|
||||
$commentText = "**Issue recurred — ticket reopened automatically.**\n\n" .
|
||||
"New report received from hwmonDaemon:\n\n```\n" . $description . "\n```";
|
||||
"hwmonDaemon detected this condition again. Current sensor data is in the ticket description above.";
|
||||
$commentStmt = $conn->prepare(
|
||||
"INSERT INTO ticket_comments (ticket_id, user_id, user_name, comment_text, markdown_enabled) VALUES (?, ?, 'hwmonDaemon', ?, 1)"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user