Repository navigation
feat(explorer-api): write a contract class artifact at most once - #36
Merged
Merged
Conversation
This was referenced Nov 18, 2026
Merged
Artifact writes read the class from Postgres (readClassWithArtifact), never from the cache, and addArtifactData writes only while the class has no artifact (artifact_json IS NULL ... RETURNING), so of concurrent uploads exactly one is written. storeArtifactIfAbsent stores a verified artifact that way and returns the row as stored; only the request that wrote names the class's public calls and refreshes the with-artifact cache entry, from that re-read row. The class and standard routes answer 201 when they wrote and 200 with the stored row otherwise. Deployment verification checks an uploaded artifact first, verifies the address against the stored artifact when there is one (the upload otherwise), and stores a first artifact only after the address check passes; it never replaces a stored artifact. A missing class answers 404 through NotFoundError. Tests (integration, real Postgres and Redis): a stale cache entry and a stored artifact, concurrent uploads held after their first read, a deployment verification with and without an upload against a stored artifact, and, in their own block, a refused deployment verification, a first artifact stored by one, and another class's artifact refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alejoamiras
force-pushed
the
feat/artifact-write-once
branch
from
November 18, 2026 15:56
6a0ca36 to
f57a153
Compare
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.
Stacked on #35.
What
readClassWithArtifact), never from the cache.addArtifactDatawrites only while the class has no artifact (artifact_json IS NULL … RETURNING), so of concurrent uploads exactly one is written.storeArtifactIfAbsentstores a verified artifact that way and returns the row as stored. Only the request that wrote names the class's public calls and refreshes the with-artifact cache entry, from that re-read row.NotFoundError.Tests
services/explorer-api/tests/integration/contract-class-artifact.integration.test.ts(real Postgres and Redis):support/gate.ts)Verify
🤖 Generated with Claude Code