Skip to content

type signature lock #47

Description

@cuzfrog

What it is

A new module gate named signature-gate. It locks the captured signature of named types declared in a module's MODULE.md. A locked declaration can still have its body edited; only the captured head (parameter list, return type, generics, class extends/implements, interface body, or type-alias RHS) must remain unchanged.

Module descriptor syntax

signature-lock:
  - my-type.ts$MyFunction
  - sub/foo.ts$Bar

Each entry is file$Name. The $ separates the file path from the symbol name. The file path is resolved relative to the directory containing the MODULE.md. Multi-level subdirectories are not supported in v1.

What counts as a signature change

A signature change is any edit that alters the captured head of a locked name in the target file. For a function, adding a parameter or changing the return type breaks the lock. Changing only the body is allowed.

Behavior

  • Cascade order in run-gates.ts: readonly -> sealed -> signature -> export -> module-interface-import.
  • The lock applies regardless of which file is editing the locked name.
  • Bodies remain editable for locked declarations.
  • Dangling entries (a lock that points at a name or file that no longer exists) produce a warning at index time and do not block writes.

v1 limitations

  • Signatures are extracted via regex, not AST. Multi-line parameter lists with inline comments inside parens may produce false positives.
  • Interfaces are locked in their entirety; the interface body is part of the captured signature.
  • Class inner methods are not individually lockable; only the class header is captured.
  • Only TypeScript/JavaScript ships a complete checker. Rust, Java, Go, Kotlin, Scala stubs return empty maps, so signature-lock entries for those languages are silently ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions