agentleFS
adobeadobe/S3Mock/server/AGENTS.md

S3Mock / server

AGENTS.md1.2k starsChanged 3 months agoApache-2.0View on GitHub

Inherits all conventions from the root AGENTS.md. Below are module-specific additions only. Core S3Mock server implementation. s3 and vectors are independent bounded contexts — neither may depend on the other (enforced by ArchitectureTest). Adding S3 operation: Follow DTO → Store → Service → Controller → IT: Each store uses a ConcurrentHashMap keyed by entity identity to hold one plain Any() lock object per entity. All reads and writes of metadata files must hold the corresponding lock. Pattern for adding a…

We split this AGENTS.md into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Adding S3 operation: Follow DTO → Store → Service → Controller → IT:

    line 40
  2. Very specific:

    Never skip the lock for reads — getBucketMetadata and getS3ObjectMetadata are also synchronized.

    line 71
  3. Distinctive:

    Never acquire more than one lock in a single call path — there is no established ordering, so taking two locks risks deadlock.

    line 72
  4. Very specific:

    Do not introduce ReentrantLock, ReadWriteLock, or other lock types — the existing synchronized/Any() pattern is intentional and consistent …

    line 73

≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Agent Context for S3Mock Server Module

Inherits all conventions from the root AGENTS.md. Below are module-specific additions only.

Core S3Mock server implementation.

Structure

server/src/main/kotlin/com/adobe/testing/s3mock/
├── S3MockApplication.kt       # Spring Boot entry
├── S3MockConfiguration.kt     # Top-level config
├── S3MockProperties.kt        # Properties binding
├── common/                    # Shared leaf package (s3 and vectors may both depend on it)
│   ├── StripedLocks.kt
│   └── AwsHttpHeaders.kt      # AWS-specific header constants
├── s3/                        # Core S3 API bounded context
│   ├── S3Exception.kt
│   ├── controller/
│   │   ├── *Controller.kt         # REST endpoints
│   │   ├── ControllerConfiguration.kt  # Controller beans + exception handlers
│   │   └── ControllerProperties.kt
│   ├── dto/                       # XML/JSON models (*Result, request/response)
│   ├── model/                     # Persisted metadata (BucketMetadata, S3ObjectMetadata, ...)
│   ├── service/
│   │   ├── *Service.kt            # Business logic
│   │   └── ServiceConfiguration.kt  # Service beans (used in @SpringBootTest)
│   └── store/
│       ├── *Store.kt              # Persistence
│       ├── StoreConfiguration.kt  # Store beans (used in @SpringBootTest)
│       └── StoreProperties.kt
└── vectors/                   # S3 Vectors API bounded context (separate ports, JSON wire format)
    ├── controller/ service/ store/ dto/

s3 and vectors are independent bounded contexts — neither may depend on the other (enforced by ArchitectureTest).

Implementation Flow

Adding S3 operation: Follow DTO → Store → Service → Controller → IT:

  1. DTO (s3/dto/): Data classes with Jackson annotations — see root AGENTS.md § XML Serialization for the correct tools.jackson annotations and namespace. Verify element names against AWS S3 API docs.
  2. Store (s3/store/): Filesystem path resolution, binary storage, metadata JSON. Key classes: BucketStore, ObjectStore, BucketMetadata, S3ObjectMetadata. Acquire the appropriate lock (see Locking section below).
  3. Service (s3/service/): Validation, store coordination. Throw S3Exception constants (e.g., S3Exception.NO_SUCH_BUCKET) — see docs/SPRING.md for exception handling rules.
  4. Controller (s3/controller/): HTTP mapping only — delegate all logic to services. Controllers never catch exceptions.
  5. Integration test (integration-tests/): Real AWS SDK v2 against the Docker container — see integration-tests/AGENTS.md. Run make integration-tests to verify XML serialization against the AWS S3 API.
  6. Update docs: CHANGELOG.md (user-facing entry) and root AGENTS.md Configuration table if new properties are added.

Locking

Each store uses a ConcurrentHashMap keyed by entity identity to hold one plain Any() lock object per entity. All reads and writes of metadata files must hold the corresponding lock.

StoreLock key typeLock map fieldWhere lock is registered
BucketStoreString (bucket name)lockStorecreateBucket / loadBuckets via lockStore.putIfAbsent(bucketName, Any())
ObjectStoreUUID (object ID)lockStoreBefore first write via lockStore.putIfAbsent(id, Any())
MultipartStoreUUID (upload ID)lockStoreOn upload creation via lockStore.putIfAbsent(uploadId, Any())

Pattern for adding a store method that reads or writes metadata:

// Register lock lazily (writes only — reads rely on the lock already existing)
lockStore.putIfAbsent(id, Any())
// Acquire lock
synchronized(lockStore[id]!!) {
    // read or write metadata here
}

Rules:

  • Never skip the lock for reads — getBucketMetadata and getS3ObjectMetadata are also synchronized.
  • Never acquire more than one lock in a single call path — there is no established ordering, so taking two locks risks deadlock.
  • Do not introduce ReentrantLock, ReadWriteLock, or other lock types — the existing synchronized/Any() pattern is intentional and consistent throughout all stores.

Storage Schema

Filesystem layout:

<root>/<bucket>/bucketMetadata.json
<root>/<bucket>/<uuid>/binaryData
<root>/<bucket>/<uuid>/objectMetadata.json
<root>/<bucket>/<uuid>/<version-id>-binaryData              # versioning
<root>/<bucket>/<uuid>/<version-id>-objectMetadata.json      # versioning
<root>/<bucket>/multiparts/<upload-id>/multipartMetadata.json
<root>/<bucket>/multiparts/<upload-id>/<part-number>.part
<root>/<bucket>/multiparts/<upload-id>/<part-number>.partmeta.json  # per-part checksum + size

bucketMetadata.json fields (BucketMetadata):

FieldTypeNotes
nameStringBucket name
creationDateStringISO-8601 timestamp
bucketRegionStringAWS region string
objectsMap<String, UUID>key → object UUID mapping
versioningConfigurationVersioningConfiguration?null until versioning is configured
objectLockConfigurationObjectLockConfiguration?null until object lock is enabled
bucketLifecycleConfigurationBucketLifecycleConfiguration?null until lifecycle rules are set
objectOwnershipObjectOwnership?null until ownership is set
bucketInfoBucketInfo?bucket type/data-redundancy info
locationInfoLocationInfo?bucket location info
pathPathfilesystem path to the bucket folder (serialized, but not portable across hosts or filesystem layouts)

objectMetadata.json fields (S3ObjectMetadata):

FieldTypeNotes
idUUIDobject identity (matches the folder name)
keyStringS3 object key
sizeStringcontent length as string
contentTypeString?MIME type
etagString?ETag value
modificationDateStringformatted date string
lastModifiedLongepoch millis
dataPathPathpath to the binaryData file
userMetadataMap<String, String>?x-amz-meta-* headers
storeHeadersMap<String, String>?headers persisted verbatim (e.g. Content-Encoding)
encryptionHeadersMap<String, String>?SSE headers
tagsList<Tag>?object tags
checksumAlgorithmChecksumAlgorithm?CRC32 / SHA-256 / etc.
checksumString?computed checksum value
checksumTypeChecksumType?FULL_OBJECT or COMPOSITE
storageClassStorageClass?STANDARD, GLACIER, etc.
ownerOwnerobject owner
legalHoldLegalHold?WORM legal hold status
retentionRetention?WORM retention mode + until-date
policyAccessControlPolicy?ACL policy
versionIdString?non-null when versioning is enabled
deleteMarkerBooleantrue for versioned delete markers
partsList<ObjectPart>?per-part metadata for multipart-completed objects; null for single-PUT objects; populated at CompleteMultipartUpload from .partmeta.json sidecar files

<part-number>.partmeta.json fields (PartMetadata) — written alongside each .part file during UploadPart; deleted after CompleteMultipartUpload:

FieldTypeNotes
partNumberIntS3 part number (1-based)
etagString?ETag of the part
sizeLongpart size in bytes
lastModifiedLongepoch millis when the part was uploaded
checksumString?base64-encoded checksum value, or null if not provided
checksumAlgorithmChecksumAlgorithm?algorithm used, or null

Testing

See docs/TESTING.md for the full strategy. Service and store tests use @SpringBootTest with @MockitoBean; controller tests use @WebMvcTest with @MockitoBean and BaseControllerTest. Always extend the appropriate base class (ServiceTestBase, StoreTestBase, BaseControllerTest).

Configuration

Three @ConfigurationProperties classes bind environment variables to typed properties:

  • StoreProperties (com.adobe.testing.s3mock.store.*) — storage root, buckets, KMS, region
  • ControllerProperties (com.adobe.testing.s3mock.controller.*) — context path
  • S3MockProperties (com.adobe.testing.s3mock.*) — top-level settings

When adding, renaming, or removing a property, you must also update the testsupport modules that expose it to users:

  • testsupport/testcontainers/ — add/update a withX() method and PROP_X env var constant in S3MockContainer (uppercase Spring key, replace . with _)
  • testsupport/common/ — add/update a withX() method and PROP_X constant in S3MockStarter (Spring key form)
  • AGENTS.md (root) — update the Configuration section env var table if the property is user-facing
  • README.md — update the configuration table if the property is user-facing

Download now (ZIP)

Trending

More talk lately.about the whole repository

Dec 2025: 1 mentionJan 2026: 2 mentionsFeb 2026: 2 mentionsMar 2026: 1 mentionApr 2026: 3 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 1 mentionSep 2026: 1 mentionOct 2026: 1 mentionNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the adobe/S3Mock repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about adobe/S3Mock

The biggest 5 of 50 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 50

Talked about on GitHub, Stack Overflow and Hacker News (50 times).

On GitHub · 46

41 more on GitHub

On Hacker News · 1

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository10 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.