dump-things-server/dump_things_service
Yaroslav Halchenko 508197e6bf Resolve store and config paths to absolute and verify existence
While there is no technical restriction forbidding relative paths to be
specified for the store root or config file arguments, using relative
paths causes user pain when the backend store initialization fails deep
in the call stack with a cryptic ValueError about paths not being
absolute (record_dir.py:88).

This change improves the user experience by:

1. Resolving relative paths to absolute paths early using Path.resolve()
   - Converts relative paths like './data' to full absolute paths
   - Resolves symbolic links to canonical paths
   - Normalizes path components (removes '..' and '.')

2. Checking path existence immediately after resolution
   - Provides clear, early error messages if paths don't exist
   - Fails fast at startup rather than during backend initialization
   - Helps users quickly identify path specification errors

The backend stores (particularly RecordDirStore) require absolute paths
and will raise ValueError if given relative paths. By resolving paths
at the entry point, we ensure all downstream code receives absolute
paths and provide better error messages when paths are invalid.

This addresses the crash at:
  File "dump_things_service/backends/record_dir.py", line 88
    if not root.is_absolute():
        raise ValueError(f'Store root is not absolute: {root}')
2026-02-03 10:01:54 +01:00
..
auth cache more forgejo-authentication source queries 2025-11-26 16:30:54 +01:00
backends refactor code, improve generated docs 2025-10-28 14:32:54 +01:00
commands refactor code, improve generated docs 2025-10-28 14:32:54 +01:00
export format according to hatch fmt 2025-07-15 12:11:36 +02:00
patches add patch for type reference generation 2025-12-17 21:47:38 +01:00
store refactor code, improve generated docs 2025-10-28 14:32:54 +01:00
tests convert maintenance to POST, add maintenance test 2026-02-02 09:06:25 +01:00
__about__.py update CHANGELOG.md, bump version to 5.4.0 2026-02-02 09:06:29 +01:00
__init__.py add maintenance mode endpoint and logic 2026-02-02 08:32:28 +01:00
api_key.py refactor code 2025-09-25 04:17:48 +02:00
config.py add maintenance mode endpoint and logic 2026-02-02 08:32:28 +01:00
conftest.py format code according to hatch fmt 2025-02-11 10:51:39 +01:00
converter.py validate input records 2025-10-16 15:22:06 +02:00
curated.py fix the curator output 2025-12-18 09:10:30 +01:00
dynamic_endpoints.py add use_classes key to collection configuration 2025-10-29 14:15:28 +01:00
exceptions.py throw an exception if a prefix in a pid is undefined 2025-09-29 15:10:50 +02:00
incoming.py fix the curator output 2025-12-18 09:10:30 +01:00
lazy_list.py format according to hatch fmt 2025-07-15 12:11:36 +02:00
main.py Resolve store and config paths to absolute and verify existence 2026-02-03 10:01:54 +01:00
model.py refactor code, improve generated docs 2025-10-28 14:32:54 +01:00
resolve_curie.py catch excptions in delete 2025-10-29 09:26:08 +01:00
token.py refactor code, improve generated docs 2025-10-28 14:32:54 +01:00
utils.py add maintenance mode endpoint and logic 2026-02-02 08:32:28 +01:00