Repository navigation
feat(organisations): report measured usage, null for what cannot be measured - #4676
Merged
Merged
Conversation
…easured
The organisation usage block reported storage, bandwidth and requests as a
fixed 0. GET /api/organisations/{uuid} now measures storage (the file cache
size of the folders of the organisation's live objects) and requests (this
hour's quota-middleware counter, only when one is kept); users and groups
stay member counts. Anything not measured, including bandwidth and every
figure in lists, is null instead of 0.
Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
…elpers Assisted-by: ClaudeCode:claude-opus-5-5
…n collaborators Assisted-by: ClaudeCode:claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
An organisation's
usageblock reportedstorage,bandwidthandrequestsas a fixed0, which reads as "nothing used". It now reports only what OpenRegister measures, andnullfor anything it cannot measure.GET /api/organisations/{uuid}(after the existinghasAccessToOrganisationcheck) returns usage from the newOrganisationUsageService:users,groupsstorage_organisation= uuid,_deletednull).nullif the read fails.requestsTenantQuotaMiddleware. That counter only exists for an organisation with a request quota and with APCu, so otherwisenull. It is0only when counted and none were made.bandwidthnull. The middleware sums JSON response bodies only, which is not the organisation's bandwidth.Everywhere else the entity is serialised (index, search, active),
storage,bandwidthandrequestsare nownullinstead of0, because the entity cannot measure them.New helpers:
MagicMapper::findFolderIdsByOrganisation()andFileMapper::sumSizesByFileIds()(chunked; unscanned entries with negative size are skipped).OrganisationControllergains a tenth constructor collaborator. It carries aPHPMD.ExcessiveParameterListsuppression with a reason, the same pattern as 129 others inlib/.Openspec change:
organisation-usage-measured.Verified
hydra/scripts/diff-check.sh --base origin/development: GREEN (0 NEW findings). The only findings are 1331 inherited phpcs findings in the existing test files whose constructor calls gained an argument.OrganisationUsageServiceTest: 8 tests.OrganisationControllerTest: show returns the measured usage, and a refused show measures nothing.OrganisationTest: usage is null.testJsonSerializeUsageStructureandtestShowReturnsMeasuredUsagefail, and the service tests error because the class is missing.COMPOSER_PROCESS_TIMEOUT=0 composer check:strict:tests/Support/MigratedSqliteDatabase.php("OC\DB\Schema\Table is not loadable") in audit-trail tests, which need an installed Nextcloud root. They fail identically on plaindevelopment.Note for consumers
A client that shows
usage.storage/requestsshould treatnullas "not measured" (no bar), not as 0.This PR was prepared with AI assistance (Claude Code) and reviewed by a human before merge.
🤖 Generated with Claude Code