feat(docduty): skip duty_locked rows in heal and revoke

Keep instance-governed A/A/A (or separated) bindings immune to project
default heal and member-slot revocation.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
weichen
2026-09-17 09:59:38 +00:00
co-authored by Cursor
parent 89484177ee
commit 42a3b1e56c
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -153,13 +153,13 @@ func clearDutySlotSQL(duty string) (string, bool) {
return `
UPDATE document_records
SET reviewer_id = NULL, reviewer_name = '', updated_at = now()
WHERE project_id = $1 AND COALESCE(task_key, '') <> '' AND reviewer_id = $2
WHERE project_id = $1 AND COALESCE(task_key, '') <> '' AND reviewer_id = $2 AND NOT duty_locked
`, true
case DutyApprover:
return `
UPDATE document_records
SET approver_id = NULL, approver_name = '', updated_at = now()
WHERE project_id = $1 AND COALESCE(task_key, '') <> '' AND approver_id = $2
WHERE project_id = $1 AND COALESCE(task_key, '') <> '' AND approver_id = $2 AND NOT duty_locked
`, true
default:
return "", false
+1 -1
View File
@@ -108,7 +108,7 @@ func backfillMissingDocumentDuties(ctx context.Context, db dutyDB, projectID int
COALESCE(reviewer_id, 0), COALESCE(reviewer_name, ''),
COALESCE(approver_id, 0), COALESCE(approver_name, '')
FROM document_records
WHERE project_id = $1 AND COALESCE(task_key, '') <> ''
WHERE project_id = $1 AND COALESCE(task_key, '') <> '' AND NOT duty_locked
`, projectID)
if err != nil {
return 0, fmt.Errorf("docduty: list documents: %w", err)