Repository navigation
feat(artifact): neutral twins for the S3-named artifact keys and keywords - #99
Merged
Merged
Conversation
…d keywords Artifact docs keep their S3-named keys (s3_url, tar_gz_s3_url, build_context_s3_url, bundle_s3_url, skill_s3_url, cli_s3_url) and now also carry the attribute's own name beside each (object_url, tar_gz_object_url, ...). A doc keyed either way loads, and every dump writes both, from the attribute, so readers of either spelling keep working; a field a dump excludes stays excluded. Readers on older versions ignore the extra key. The put helpers take neutral keywords: FileArtifactUniverse.put(bundle_object_url=), put_bundled(prefix_url=), put_existing(prefix_url=), DockerImageArtifact.put_tar(tar_gz_object_url=, build_context_object_url=) and SkillArtifact.validate(object_url=). The S3-named ones still work, through utils.deprecation's warn_deprecated, whose log line counts their callers; so do the sandbox's write_file_from_s3 / load_s3_file aliases now. Core's own callers move to the neutral spellings. FileArtifact.put_existing no longer splits <scheme>://<bucket>/<key>: it refuses a trailing slash and leaves the rest to the store. The explorer reads either key. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… key first, and size no S3 bucket - The twin-writing wrap serializers lose their `-> dict[str, Any]` return annotation: pydantic builds the serialization JSON schema from it, so every twinned model (and EnvironmentArtifact / EnvironmentUniverseArtifact, which already had it) served a bare object without its fields to anything rendering that schema, such as a FastAPI response model. - The explorer reads a universe file's s3_url before its object_url, as the model does: while both are written, a raw-doc writer that knows only s3_url would leave the twin stale. - S3ObjectStore treats a URL without a key as no object instead of sending S3 an empty-key HEAD, which botocore refuses as a malformed request; put_existing on a bucket URL is refused as "does not exist" again rather than with a ParamValidationError. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
renamed_keyword took an old keyword passed as None for one left out, so a caller passing an optional old keyword through (build_context_s3_url=None) was neither warned nor counted, and would break unseen when the keyword is removed; with the new spelling also set it skipped the both-spellings TypeError. The old keywords now default to deprecation.OMITTED instead of None. Two tests still passing put_bundled / put_existing the old s3_url= keyword move to prefix_url=. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Neutral twins for the S3-named artifact keys.
object_url,tar_gz_object_url,build_context_object_url,bundle_object_url,skill_object_urlandcli_object_url. Their documents only carry the S3-named aliases:s3_url,tar_gz_s3_url,build_context_s3_url,bundle_s3_url,skill_s3_urlandcli_s3_url.environment_*/service_*precedent: a wrapmodel_serializerper class, since theArtifactbase is plugin surface.-> dict[str, Any]turned each model's into a bare object without its fields.EnvironmentArtifactandEnvironmentUniverseArtifactalready had that problem and are fixed here too.extra='ignore'. Stored documents are not rewritten, and read compatibility for the legacy keys is permanent.Neutral keywords for the put helpers.
FileArtifactUniverse.put(bundle_object_url=),put_bundled(prefix_url=)andput_existing(prefix_url=);DockerImageArtifact.put_tar(tar_gz_object_url=, build_context_object_url=);SkillArtifact.validate(object_url=).The S3-named keywords keep working for now through
utils.deprecation.warn_deprecated, which warns and logs a countableagent_env_deprecated_symbolline. They default todeprecation.OMITTED, so an old keyword passed asNonestill counts. Passing both spellings is aTypeError. Core's own callers and the test fakes move to the neutral spellings.Also in this PR:
Sandbox.write_file_from_s3/VmSandbox.load_s3_file, from refactor(sandbox): object-store names for sandbox object copies; read handed-in urls from the store that holds them #97, now go throughwarn_deprecatedtoo, so their remaining callers can be counted before they're removed.FileArtifact.put_existing: drops its<scheme>://<bucket>/<key>split. It refuses a trailing/, and the store decides whether anything exists at the URL.S3ObjectStorenow treats a URL with no key as no object, instead of sending S3 an empty-key HEAD that botocore refuses as malformed, so a bucket-root URL is still refused as "does not exist".s3_url, elseobject_url, for a universe's files, the same order as the models.Testing
by_aliaseither way) carries both keys.agent_env_deprecated_symbol, even when passed asNone. Passing both spellings is aTypeError, including with the old oneNone, and a required keyword is still required.put_existingon one is refused as "does not exist"._AE3_TWINSgains the six pairs, so the both-or-neither invariant covers them.populate_by_name, the twin's exclude check, the keyword warning, its both-spellings check or itsOMITTEDsentinel each fails a test, as does reannotating a serializer (new or precedent). So do reverting theput_existingchange or S3's empty-key guard, flipping the explorer to neutral-first or dropping its fallback, and removing the sandbox alias's counted warning or making it a plainwarnings.warn.signed_posttests, which the earliersigned_postremoval already breaks.s3_url, loads with this branch.Labelled
bump-version.🤖 Generated with Claude Code
The PR appears safe to merge; the earlier old-keyword issue is fixed.
What we checked:
Nonekeyword goes unnoticed: No.renamed_keywordchecks whether the old keyword was omitted, then warns when it was passed, even asNone.Summary
Artifact URLs can now use store-neutral names while saved documents keep both the old and new keys. The PR also adds counted deprecation paths for old helper keywords and sandbox methods, updates Explorer reads, and changes how existing-file URLs are checked.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Old or neutral URL key] --> B[Artifact model] B --> C[Artifact URL attribute] C --> D[Stored document with both keys]Reviews (3) · Last reviewed commit: "fix(artifact): an S3-named keyword passe..." · Reviewed by Greptile