Skip to content

fix(activity): Reduce stored data size for activity entries#7334

Merged
luka-nextcloud merged 3 commits intomainfrom
bugfix/noid/reduce-stored-data-size-for-activity
Oct 27, 2025
Merged

fix(activity): Reduce stored data size for activity entries#7334
luka-nextcloud merged 3 commits intomainfrom
bugfix/noid/reduce-stored-data-size-for-activity

Conversation

@nickvergessen
Copy link
Copy Markdown
Member

@nickvergessen nickvergessen commented Oct 27, 2025

Before After
Full Board info is stored (including all ACLs, Users, Labels, …) Only id and title which are actually used in activity rendering are stored
subjectparams 3241 characters subjectparams 464 characters
Before
{
  "card": {
    "id": 1,
    "title": "1. Open to learn more about boards and cards",
    "archived": false
  },
  "stack": {
    "id": 3,
    "title": "In Progress",
    "boardId": 1,
    "deletedAt": 0,
    "lastModified": 1761561163,
    "order": 2,
    "ETag": "6c598d76a0c931e676ed41f58ad13df8"
  },
  "board": {
    "id": 1,
    "title": "Welcome to Nextcloud Deck!",
    "owner": {
      "primaryKey": "42",
      "uid": "42",
      "displayname": "June J. Anderson",
      "type": 0
    },
    "color": "bf678b",
    "archived": false,
    "labels": [
      {
        "id": 1,
        "title": "Finished",
        "color": "31CC7C",
        "boardId": 1,
        "cardId": null,
        "lastModified": 0,
        "ETag": "cfcd208495d565ef66e7dff9f98764da"
      },
      {
        "id": 2,
        "title": "To review",
        "color": "317CCC",
        "boardId": 1,
        "cardId": null,
        "lastModified": 0,
        "ETag": "cfcd208495d565ef66e7dff9f98764da"
      },
      {
        "id": 3,
        "title": "Action needed",
        "color": "FF7A66",
        "boardId": 1,
        "cardId": null,
        "lastModified": 0,
        "ETag": "cfcd208495d565ef66e7dff9f98764da"
      },
      {
        "id": 4,
        "title": "Later",
        "color": "F1DB50",
        "boardId": 1,
        "cardId": null,
        "lastModified": 0,
        "ETag": "cfcd208495d565ef66e7dff9f98764da"
      },
      {
        "id": 5,
        "title": "Read more inside",
        "color": "CC317C",
        "boardId": 1,
        "cardId": null,
        "lastModified": 0,
        "ETag": "cfcd208495d565ef66e7dff9f98764da"
      }
    ],
    "acl": [
      {
        "id": 1,
        "participant": {
          "primaryKey": "group-e839-41bb-a2f7-dd40a9713c8a",
          "uid": "group-e839-41bb-a2f7-dd40a9713c8a",
          "displayname": "Team",
          "type": 1
        },
        "type": 1,
        "boardId": 1,
        "permissionEdit": false,
        "permissionShare": false,
        "permissionManage": false,
        "owner": false
      }
    ],
    "permissions": {
      "PERMISSION_READ": true,
      "PERMISSION_EDIT": true,
      "PERMISSION_MANAGE": true,
      "PERMISSION_SHARE": true
    },
    "users": [
      {
        "primaryKey": "42",
        "uid": "42",
        "displayname": "June J. Anderson",
        "type": 0
      },
      {
        "primaryKey": "4ab6ec05-2dac-4ef5-89f4-682555aeb066",
        "uid": "4ab6ec05-2dac-4ef5-89f4-682555aeb066",
        "displayname": "Felix Fuchs",
        "type": 0
      },
      {
        "primaryKey": "4e50351f-1773-4145-a325-38223bb3fa0f",
        "uid": "4e50351f-1773-4145-a325-38223bb3fa0f",
        "displayname": "Ahri Fox",
        "type": 0
      },
      {
        "primaryKey": "61606790-6cba-4357-820a-cdfcb7720532",
        "uid": "61606790-6cba-4357-820a-cdfcb7720532",
        "displayname": "Bennet Bernetto",
        "type": 0
      },
      {
        "primaryKey": "9be45899 da78 4a89 a3d3 c096ccc4795b",
        "uid": "9be45899 da78 4a89 a3d3 c096ccc4795b",
        "displayname": "Emily Evans",
        "type": 0
      },
      {
        "primaryKey": "d0b40f7d-e518-4175-92dc-1e7c5d60ee7d",
        "uid": "d0b40f7d-e518-4175-92dc-1e7c5d60ee7d",
        "displayname": "Carmèn Máría Cruz",
        "type": 0
      },
      {
        "primaryKey": "ff5413b3-58d6-4062-a754-bff12b065806",
        "uid": "ff5413b3-58d6-4062-a754-bff12b065806",
        "displayname": "David Densemore",
        "type": 0
      }
    ],
    "stacks": [
      {
        "id": 1,
        "title": "Custom lists - click to rename!",
        "boardId": 1,
        "deletedAt": 0,
        "lastModified": 1761562948,
        "order": 0,
        "ETag": "26c359271947221418bf2966dcb9aaf2"
      },
      {
        "id": 2,
        "title": "To Do",
        "boardId": 1,
        "deletedAt": 0,
        "lastModified": 1761563112,
        "order": 1,
        "ETag": "af035160275f865bb652afe2186df98e"
      },
      {
        "id": 3,
        "title": "In Progress",
        "boardId": 1,
        "deletedAt": 0,
        "lastModified": 1761561163,
        "order": 2,
        "ETag": "6c598d76a0c931e676ed41f58ad13df8"
      },
      {
        "id": 4,
        "title": "Done",
        "boardId": 1,
        "deletedAt": 0,
        "lastModified": 1761561164,
        "order": 3,
        "ETag": "06ff389fb7e920cb0b354d7689d6c131"
      }
    ],
    "activeSessions": [],
    "deletedAt": 0,
    "lastModified": 1761563112,
    "settings": {
      "notify-due": "assigned",
      "calendar": true
    },
    "ETag": "af035160275f865bb652afe2186df98e"
  },
  "stackBefore": {
    "id": 2,
    "title": "To Do",
    "boardId": 1,
    "deletedAt": 0,
    "lastModified": 1761563112,
    "order": 1,
    "ETag": "af035160275f865bb652afe2186df98e"
  },
  "author": "42"
}
After
{
  "card": {
    "id": 1,
    "title": "1. Open to learn more about boards and cards",
    "archived": false
  },
  "stack": {
    "id": 2,
    "title": "To Do",
    "boardId": 1,
    "deletedAt": 0,
    "lastModified": 1761562939,
    "order": 1,
    "ETag": "6586d155a1e509ac53fa111a43c9b830"
  },
  "board": {
    "id": 1,
    "title": "Welcome to Nextcloud Deck!"
  },
  "stackBefore": {
    "id": 1,
    "title": "Custom lists - click to rename!",
    "boardId": 1,
    "deletedAt": 0,
    "lastModified": 1761562948,
    "order": 0,
    "ETag": "26c359271947221418bf2966dcb9aaf2"
  },
  "author": "42"
}

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests (unit, integration, api and/or acceptance) are included
  • Documentation (manuals or wiki) has been updated or is not required

@nickvergessen
Copy link
Copy Markdown
Member Author

I fixed integration test CI in #7310

@nickvergessen
Copy link
Copy Markdown
Member Author

nickvergessen commented Oct 27, 2025

It seems there is more to gain. While we truncate the description actual, before and after (

if (mb_strlen($json) > self::SUBJECT_PARAMS_MAX_LENGTH) {
$params = json_decode(json_encode($subjectParams), true);
if ($subject === self::SUBJECT_CARD_UPDATE_DESCRIPTION && isset($params['after'])) {
$newContent = $params['after'];
unset($params['before'], $params['after'], $params['card']['description']);
$params['after'] = mb_substr($newContent, 0, self::SHORTENED_DESCRIPTION_MAX_LENGTH);
if (mb_strlen($newContent) > self::SHORTENED_DESCRIPTION_MAX_LENGTH) {
$params['after'] .= '...';
}
$subjectParams = $params;
} else {
throw new \Exception('Subject parameters too long');
}
}
) , on our prod db a lot of activities also have a full size descriptionPrev stored.

@github-actions
Copy link
Copy Markdown
Contributor

🐢 Performance warning.
It looks like the query count of the integration tests increased with this PR.
Database query count is now 83001 was 82774 (+0.27%)
Please check your code again. If you added a new test this can be expected and the base value in tests/integration/base-query-count.txt can be increased.

Signed-off-by: Joas Schilling <[email protected]>
@github-actions
Copy link
Copy Markdown
Contributor

🐢 Performance warning.
It looks like the query count of the integration tests increased with this PR.
Database query count is now 83039 was 82774 (+0.32%)
Please check your code again. If you added a new test this can be expected and the base value in tests/integration/base-query-count.txt can be increased.

@nickvergessen
Copy link
Copy Markdown
Member Author

/backport to stable32

@luka-nextcloud luka-nextcloud merged commit 14a7c83 into main Oct 27, 2025
35 of 36 checks passed
@luka-nextcloud luka-nextcloud deleted the bugfix/noid/reduce-stored-data-size-for-activity branch October 27, 2025 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants