Tooling

Lock

Freeze the published revisions, so a forgotten since() fails the build instead of reaching clients.

The real risk when evolving an API is a forgotten since(): a new field leaking into revisions already published. Rather than requiring a bound on every field, the library freezes the published revisions.

Lock the published revisions

Terminal
php artisan revision:lock
   INFO  Locked genesis, winter-25.

It locks every revision but the head that has no lock yet. Each revision is one file, revisions.lock/<value>.json: the structure of the JSON Schema of every class and declaration kind, without documentation, and the revision before it in order().

revisions.lock/winter-25.json
{
    "previous": "genesis",
    "classes": {
        "App\\Http\\Requests\\StoreOrderRequest": {
            "request-body": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "properties": {
                    "name": { "type": "string" },
                    "state": {
                        "enum": ["pending", "paid", "cancelled"],
                        "type": "string"
                    },
                    "title": { "maxLength": 255, "type": "string" },
                    "total": { "type": "string" }
                },
                "required": ["title", "total", "name"],
                "type": "object"
            }
        }
    }
}

Commit the directory, and never edit it by hand.

When the lock fails

revision:check compares every locked revision with the declarations:

CodeClassFieldRevisionMessage
lock-mismatchOrderResourcenamewinter-25'name' (response) is new in the locked revision winter-25: declare its since(), or lock winter-25 again.
  • lock-mismatch: a locked revision changed. Almost always a forgotten since(N): fix the declaration.
  • lock-order-changed: a locked revision moved in order().

Descriptions, examples and deprecated() never break a lock.

Re-locking a published revision accepts its change for every client already on it: a deliberate decision, never a way to silence the check.

Terminal
php artisan revision:lock --revision=winter-25

The head stays free

The head is not locked by revision:lock: you change it until you publish the next revision. Lock it when you add the next revision, before changing any declaration. --revision=<head> locks it explicitly if you need to.