openstreetmap-website icon indicating copy to clipboard operation
openstreetmap-website copied to clipboard

Allow `user/preferences` values up to 10_000

Open tordans opened this issue 4 months ago • 4 comments

Description

Fixes https://github.com/openstreetmap/openstreetmap-website/issues/6297

The goal is to increase the limit of the user/preferences API values. I picket 10k which is what we use for user blocks and should be enough to add more complex data.

Other limits

User descriptions can be up to 65,536 characters Diary comments can be up to 65,536 characters User block reasons can be up to 10,000 characters Note comments can be up to 2,000 characters

How has this been tested?

I tested it with the demo page from https://gist.github.com/tordans/94481e6336e8c34f258c677350fc2e77 which uses https://github.com/osmlab/osm-api-js to authenticate against localhost 3001 (hard coded) with a local oAuth App (hardcoded) and then runs two test cases against the preferences endpoint.

tordans avatar Sep 19 '25 12:09 tordans

@tordans this should definitely be accompanied by a change to the capabilities api call that reports the max value (and given that it is related, should probably report the standard 255 limit too, see https://github.com/openstreetmap/openstreetmap-website/issues/1593).

simonpoole avatar Oct 10 '25 10:10 simonpoole

this should definitely be accompanied by a change to the capabilities api call that reports the max value

Good point. I added changes that expose this limit like so… http://localhost:3001/api/0.6/capabilities.json

{
  "version": "0.6",
  "generator": "OpenStreetMap server",
  "copyright": "OpenStreetMap and contributors",
  "attribution": "http://www.openstreetmap.org/copyright",
  "license": "http://opendatacommons.org/licenses/odbl/1-0/",
  "api": {
    "version": {
      "minimum": "0.6",
      "maximum": "0.6"
    },
    "area": {
      "maximum": 0.25
    },
    "note_area": {
      "maximum": 25
    },
    "tracepoints": {
      "per_page": 5000
    },
    "waynodes": {
      "maximum": 2000
    },
    "relationmembers": {
      "maximum": 32000
    },
    "changesets": {
      "maximum_elements": 10000,
      "default_query_limit": 100,
      "maximum_query_limit": 100
    },
    "notes": {
      "default_query_limit": 100,
      "maximum_query_limit": 10000
    },
    "user_preferences": {
      "key_maximum_length": 255,
      "value_maximum_length": 10000
    },
    "timeout": {
      "seconds": 300
    },
    "status": {
      "database": "online",
      "api": "online",
      "gpx": "online"
    }
  },
  "policy": {
    "imagery": {
      "blacklist": []
    }
  }
}

(and given that it is related, should probably report the standard 255 limit too, see https://github.com/openstreetmap/openstreetmap-website/issues/1593).

Lets tackle this separate to keep this PR as small as possible. What would a good format be? Just defaults: { key_max…, value_max…}?

tordans avatar Oct 10 '25 12:10 tordans

What would a good format be? Just defaults: { key_max…, value_max…}?

Seems reasonable to me. Have we ever documented the 255-character limit as a hard limit? That could influence whether we need to expose the capabilities info now or if it can wait as tail work.

1ec5 avatar Dec 04 '25 17:12 1ec5

Have we ever documented

Have, we, ever and documented are doing some very heavy lifting there, it's yes as in the only official documentation is the code, or/and no as in it has never been exposed in the capabilities call, see the issue I linked above https://github.com/openstreetmap/openstreetmap-website/issues/1593

https://github.com/openstreetmap/openstreetmap-website/issues/2025 is likely at least related.

simonpoole avatar Dec 04 '25 17:12 simonpoole