Repository navigation
Conversation
BaseArtifactService documents session_id=None as the user-scoped namespace, and FileArtifactService behaves that way: an artifact saved without a session is the one sessions reach through the "user:" prefix. InMemoryArtifactService and GcsArtifactService raised InputValidationError for any filename without the prefix instead, so the same call worked against local files and failed in memory and on GCS. Route a session-less filename to the user namespace in both services, as if it carried the "user:" prefix.
BichengWang
left a comment
There was a problem hiding this comment.
Reviewed commit e2b9b29. No blocking findings in the namespace routing change.
I independently ran the new parametrized test against base a6ed859: memory and GCS fail with InputValidationError, while file storage passes. At this head, all three cases pass, and pytest tests/unittests/artifacts -q -n 4 passes 1,125 tests on Python 3.13.16.
Additional offline probes checked a prefixed save followed by a session-less read and save, nested filenames, shared version metadata/canonical URIs, and app/user/session isolation across all three services. User-scoped artifact:// references with bare filenames also resolve in both changed backends. The normalization in the save paths keeps the existing user: storage keys and canonical URI format, while the path helpers make reads, deletion and version lookups reach those same keys.
Validation used the existing mocked GCS client; I did not exercise a live bucket or run the full multi-version tox matrix.
Link to Issue or Description of Change
2. Or, if no issue exists, describe the change:
Problem:
BaseArtifactServicedocumentssession_id=Noneas the user-scoped namespace ("IfNone, the artifact is user-scoped"), and so does the artifact service guide ("an optionalsession_id, whereNonemeans the user-scoped namespace").FileArtifactServicefollows that: an artifact saved withsession_id=Noneis the same one sessions reach asuser:<name>, with shared versions.InMemoryArtifactServiceandGcsArtifactServiceinstead raiseInputValidationError: Session ID must be provided for session-scoped artifacts.for any filename without theuser:prefix, on save, load, list_versions, delete and the version lookups. So the same call works against local files and fails in memory and on GCS:Solution:
When
session_idisNone, both services now route a bare filename to the user namespace, the same storage pathuser:<name>already uses, instead of raising. Calls that used to fail now behave likeFileArtifactService; nothing that worked before changes. app_name/user_id validation is unchanged, and session_id validation still runs whenever a session id is given.FileArtifactServicelists a session-less save under its bare name rather than with theuser:prefix. The interface docstring allows that, so I left it alone.Testing Plan
Unit Tests:
Added
test_no_session_id_addresses_user_namespace, parametrized over the in-memory, GCS and file services. It saves withsession_id=None, reads and re-saves throughuser:from a session, checks the shared versions and deletes throughsession_id=None.Manual End-to-End (E2E) Tests:
Not run against a real GCS bucket; the GCS case runs on the test suite's mocked client, like the existing GCS tests.
Checklist