Skip to content

refactor: take the file controllers from opensemantic.core - #214

Merged
LukasGold merged 9 commits into
stagefrom
feat/file-controllers-from-core
Nov 6, 2026
Merged

LukasGold merged 9 commits into
stagefrom
feat/file-controllers-from-core

Conversation

@simontaurus

@simontaurus simontaurus commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

The file controllers moved to opensemantic.core, which owns the file models.
This package keeps the import paths and the wiki implementation.

  • base, local, memory and remote wrap the implementations in core.
  • WikiFileController rebases on core's RemoteFileController and registers
    itself, so a file entity resolves to it through get_file_controller without
    being imported by name.
  • The session is optional and built on first use. A file that is about to be
    uploaded has no URL yet, so the wiki is found from the credential registered
    in oold.backend.auth when there is no URL to go by, and the error names the
    ambiguity when several are registered.
  • Sessions are cached per (host, credential): two credentials scoped to
    different paths of one wiki are two logins, and one credential matching
    several subdomains does not serve them all the same session. A replaced
    credential replaces the session instead of being ignored for the lifetime of
    the process.
  • from_other keeps a session the source already carries.
  • LocalFileController keeps path as a field in step with the model's
    local_path, so dict()["path"] and __fields__["path"] work as before.
    Core exposes the derived path as resolve_path(): a property named like a
    model field wins over that field in attribute lookup, which is exactly what
    FileResult.path runs into.

tests/test_wiki_file_session.py covers how the session is found and cached.

Needs the file controllers from opensemantic.core, released in 0.59.0, so the
dependency is opensemantic.core>=0.59.0.

- base, local, memory and remote now wrap the implementations that moved
  to core, which owns the file models
- LocalFileController keeps the path argument and filename-derived label
- WikiFileController rebases on core's RemoteFileController
- the session became optional and connects on first use from the
  credential registered for download_url or access_url
- the package imports its modules, so the controllers register and a file
  entity resolves to one without importing it by name
- _ensure_session falls back to the registered credential, so an upload
  (which has no URL yet) can use the lazy session at all
- from_other keeps a session the source carries instead of writing None
- sessions are cached per credential, not per host, and a replaced
  credential replaces the session
- LocalFileController without a file fails at construction, as the
  controller it replaces did
- pin opensemantic.core to the branch carrying the file controllers
- a credential registered as host/path no longer becomes the WtSite iri,
  which built an API endpoint that does not exist
- the cache is keyed by (host, credential), so one credential matching
  several subdomains does not serve them all the same session
- pin oold to the branch carrying registered_credentials()
- tests inspect the config the session is built from
Core renamed its path property to resolve_path(), because a property
named like a model field wins over the field and makes its value
unreadable - osw.express.FileResult declares exactly such a field. With
path declared here instead, dict()["path"] and __fields__["path"]
work again and the two names always name the same file.
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Release preview

Merging this PR would release v2.9.2 (current: v2.9.1).

Changelog preview (truncated)
## v2.9.2 (2026-11-06)

### Continuous Integration

- Run Main on pushes to stage and Integration on PRs into stage
  ([`1b55f02`](https://github.com/OpenSemanticLab/osw-python/commit/1b55f02c90cae646d690f83d6208c01f0e26e62b))

Preview via python-semantic-release and conventional commits.

Every characteristic branches off the Characteristic category, and the
schema marks the link required - which oold enforces since the
descriptor binding.
@LukasGold
LukasGold changed the base branch from main to stage November 6, 2026 10:26
@LukasGold
LukasGold merged commit 0573271 into stage Nov 6, 2026
12 checks passed
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.

2 participants