🚥 fix: Preserve Insights With Guarded ACL Role Updates (#16170)

* fix: preserve Insights with guarded ACL role updates

* test: settle ACL index builds before opening the transaction

* fix: replace ACL mask partitions with single-operator bit writes

* style: drop the now-unused RoleBits import

* fix: make ACL role replacement one atomic guarded write

* fix: export the permission write retry ceiling

* fix: retry ACL mutations per document and preserve atomic permissions

---------

Co-authored-by: Lia <lia@librechat.ai>
This commit is contained in:
lia-by-librechat[bot] 2026-09-21 23:40:52 -04:00 • committed by GitHub
parent cae9afd807
commit 1e2142e52a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 897 additions and 39 deletions

View file

@ -173,6 +173,7 @@ const updateResourcePermissions = async (req, res) => {
const results = await bulkUpdateResourcePermissions({
resourceType,
resourceId,
maxWriteAttempts: req.config?.config?.permissions?.maxWriteAttempts,
updatedPrincipals: validatedPrincipals,
revokedPrincipals,
grantedBy: userId,

View file

@ -339,8 +339,12 @@ describe('PermissionsController', () => {
});
const res = createMockRes();
req.config = { config: { permissions: { maxWriteAttempts: 7 } } };
await updateResourcePermissions(req, res);
expect(mockBulkUpdateResourcePermissions).toHaveBeenCalledWith(
expect.objectContaining({ maxWriteAttempts: 7 }),
);
expect(mockRecordAuditEntry).toHaveBeenCalledWith(
expect.objectContaining({
action: 'permission.insights_assigned',