nextcloud-files icon indicating copy to clipboard operation
nextcloud-files copied to clipboard

fix: Handle snowflake-ids

Open CarlSchwan opened this issue 1 month ago • 4 comments

With snowflake-ids, we get numbers represented as strings as ids.

Not tested, as I couldn't figure out how to use a patched version in server but this should fix the CI failure on https://github.com/nextcloud/server/pull/56183

CarlSchwan avatar Nov 24 '25 15:11 CarlSchwan

Codecov Report

:x: Patch coverage is 0% with 1 line in your changes missing coverage. Please review. :white_check_mark: Project coverage is 90.18%. Comparing base (550e782) to head (668f17a). :warning: Report is 34 commits behind head on main.

Files with missing lines Patch % Lines
lib/node/nodeData.ts 0.00% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1377      +/-   ##
==========================================
- Coverage   90.49%   90.18%   -0.31%     
==========================================
  Files          23       23              
  Lines         652      652              
  Branches      176      176              
==========================================
- Hits          590      588       -2     
- Misses         53       54       +1     
- Partials        9       10       +1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Nov 24 '25 15:11 codecov[bot]

I fear that supporting two types will not help developers to get their typing right. Not sure what's the best solution.

Going string all the way in a new major version might be the best. Or having two distinct fields? Or using a template <T>?

artonge avatar Nov 25 '25 10:11 artonge

I think this will break quite some typings in apps like files - but maybe also other apps using it.

A new major version does not solve this unless we explicitly break compatibility with Nextcloud 33 saying that only files v4 will be compatible with Nextcloud 33+. Then we can do that, but also have to adjust many places in the files app that expect a number to be returned by the Node interface.

susnux avatar Nov 25 '25 10:11 susnux

@CarlSchwan

Also currently we use oc:fileid which is not just the numeric fileid but its %08d of the fileid followed by the instance id like 00000012oc12abcd and we just use the fileid part of it. Because with snowflake ids the instance id is already encoded in the fileid, does it make sense to have a new DAV property nc:fileid which is just the snowflake id?

susnux avatar Nov 29 '25 16:11 susnux