GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — coordination-protocol-contract-package/spec/repo-format.md at main · laquereric/coordination-protocol-contract-package

Expand file tree

/

repo-format.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
291 lines (232 loc) · 13 KB
/

repo-format.md

Copy path

File metadata and controls

291 lines (232 loc) · 13 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

Repo format

A CPCP package repo declares its interface in .cpcp/. Machine readers start at .cpcp/package.json; humans start at README.md.

.cpcp/package.json            index. Always present.
.cpcp/<scope>/package.json    one per scope the repo STANDS IN. Zero or more.

Scope directory names are the scope names exactly: dependency, pod_internal_dependencies, pod_internal_services, pod_internal_library, services (scopes).

.cpcp/<scope>/ says this repo stands in that relation. For pod_internal_services and services that means it serves the seams listed. For dependency and pod_internal_dependencies it means the opposite — it calls what is listed, and something else serves it.

A terse interface spec is the point. A CID and a caller that runs say what a paragraph cannot: what the methods are, what they accept, what comes back. Prose explains; it does not specify. Everything under Optional can be skipped by a conforming repo, and a repo that skips all of it is still a CPCP package.

Every requirement below names the test that decides it. The test is tooling/check-repo-format.py; run it before claiming conformance.

Required

Index — .cpcp/package.json

Field When Test
kind always one of six (kinds)
reference_instance language_implementation_template resolvable CID URL + operations + liveness — see rule 10
deploys deployment each entry pins the application it runs by repo and rev
version always equals 1
name, description always non-empty
contract every repo except the contract home {repo, rev}, both non-empty
registry when methods are served {repo, sha}
cids when CIDs are declared each entry resolves, and carries at least one example — see rule 7
scopes.manifests when scopes are served {scope: path}; each path is a file, each scope is a real scope name
unscoped_seams when any exists each entry has a because
role when the repo reifies one name is one of the four (roles); see rule 9

Scope manifest — .cpcp/<scope>/package.json

Field When Test
kind always equals cpcp-scope
scope always equals the directory name
of always non-empty
definition always non-empty
source always non-empty
seams pod_internal_services, services a list; may be empty, and then rule 2 applies
depends_on dependency, pod_internal_dependencies a list; may be empty, and then rule 2 applies — see rule 8
exposure when it can be measured carries evidence naming where it was read

seams and depends_on are not interchangeable. A repo does not serve what it depends on, and one field meaning both would make a manifest readable only by knowing which folder it sat in. A dependency manifest carrying seams, or a serving manifest carrying depends_on, fails.

Ten rules

  1. One seam, many scopes. A seam appears in every scope manifest it is reachable at. Identical method contract, different exposure — one seam under two rules, never two seams. Test: reported, not decided. Ids are free text; the checker prints seam ids per scope for a reader to judge.

  2. An empty scope still gets a manifest. seams: [] plus a because naming what serves that scope instead. An omitted scope cannot be told apart from an overlooked one. Test: empty seams without a because fails.

  3. A seam with no scope goes in the index, not a folder. Under unscoped_seams, with a because. Choosing a folder to tidy the tree invents contract. Test: an unscoped_seams entry without a because fails.

  4. Exposure is measured. Read published ports from the deployment files and record which file. Restating what the scope is supposed to mean is not evidence; only reading what the deployment does is. Test: an exposure block without evidence fails. Whether the citation is TRUE is not decidable here — a wrong line number is still a wrong line number.

  5. Pin by full SHA. Forty characters. An abbreviation is not an object a reader can verify, and stops being unique as a repo grows. Test: a hex rev/sha/self_rev shorter than forty characters fails.

  6. Reference by repo and revision, not by path. A manifest naming a vendored checkout path couples this repo to a consumer's directory layout. Test: reported, not decided.

  7. Every CID has at least one example caller. One working caller, in any language, per CID. A CID nobody can run is a claim; a CID with a caller is an interface. One is the requirement — a repo whose purpose is demonstration carries many, and that is a choice, not the bar. Test: each cids entry declares examples, and every path resolves.

"cids": [
  { "cid": "cid/pull-note.cid.json", "examples": ["examples/python/pull.py"] }
]

A bare string in cids declares no caller and fails rule 7.

  1. Every dependency names its producer, and says whether it is built. An entry carries producer, the operations this repo calls, and a status of published or unbuilt. Anything other than published needs a because. A dependency on an operation nobody serves yet is a real dependency and the one most worth writing down — recording it is how a caller states what it is waiting for, instead of discovering it as a refusal in production. Test: an entry missing producer, operations or status fails; a non-published status without a because fails. Whether the producer really publishes it is not decidable here — that is what the status claim is for, and a stale claim is still a claim someone can check.
"depends_on": [
  { "producer": "https://example.test/_cpcp",
    "cid": "https://example.test/_cpcp/cid.json",
    "operations": ["thing.list"],
    "status": "unbuilt",
    "because": "the CID publishes other.list and other.get; thing.list refuses unknown_operation" }
]

A live one is in note [1].

  1. A declared role names one of the four, and admits its co-locations. role.name is FRONT, BACK, BackJob or GRAPH (roles); so is every key of role.also_reified. A repo reifying both FRONT and BACK must say separate_containers — the reference implementation calls co-locating them non-conformant, and a manifest carrying both without stating the split reads as conformant while describing the arrangement the claim forbids. Test: an unknown role name fails; a role repeated between name and also_reified fails; FRONT-with-BACK and no separate_containers fails. Whether the containers are REALLY separate is not decidable here — that is what the claim is for, and a false claim is still one somebody can check.
"role": { "name": "BACK", "of": "example.test",
          "also_reified": { "FRONT": "a separate container" },
          "separate_containers": true }
  1. A template resolves to a running service. A language_implementation_template declares reference_instance with an absolute, fetchable cid URL, the operations it claims that instance publishes, and a liveness of required or advisory (advisory needs a because). An agent that finds a template must be able to reach what serves the endpoints it describes — a template describing a seam that exists nowhere is a shape with no referent, and the agent cannot tell a live contract from an aspirational one. Being a starting point is not an exemption from pointing at something that runs; it is the reason to. Test: a template with no reference_instance fails; a cid that is a path rather than a URL fails; missing operations fails; an unknown liveness fails; advisory without a because fails, so an outage cannot read as a passing check. Whether the instance really publishes those operations is not decidable here — the template's own validator fetches the CID and compares.
"reference_instance": {
  "repo": "https://github.com/owner/app", "rev": "<full sha>",
  "cid": "https://app.example/_cpcp/cid.json",
  "operations": ["thing.list"], "liveness": "required"
}

Optional

None of this is required, and a repo without it conforms.

not_a_seam surfaces a reader might mistake for seams, and why they are not
gates the checkers holding these claims
invariants in a scope manifest: what must hold at that scope
more than one example per CID one is the bar; more is demonstration
per-language or per-directory READMEs
elaborate documentation of any kind tutorials, rationale, worked examples, architecture notes

Elaborate documentation is optional because the CIDs are the specification. Prose that restates a CID is a second source of truth that will drift from the first. Write it if it helps a reader; do not write it to satisfy this format, and never let it stand in for a CID or a caller.

Two shapes

A repo that serves and calls nothing carries the serving scopes and no dependency:

.cpcp/package.json                index; registry by SHA; any unscoped
                                  seam with its because
.cpcp/pod_internal_services/...   the seams it serves on the pod network
.cpcp/services/package.json       the seams it serves beyond the pod,
                                  plus published surfaces that are not seams

A seam served at both reaches appears in both, by rule 1.

A repo that only calls carries the mirror image — one dependency manifest and no serving scopes:

.cpcp/package.json                index
.cpcp/dependency/package.json     the CIDs it calls, each with its producer
                                  and a built/unbuilt status (rule 8)

Neither shape is incomplete. A missing scope directory says this repo does not stand in that relation, which is why rule 2 makes an empty one say what fills the gap instead. Both shapes are filled in against real repos in note [1].

The test

python3 tooling/check-repo-format.py [REPO ...]

No argument checks the contract home; otherwise point it at any package repo, or several. It reads only .cpcp/ and the paths that manifest declares. It also resolves declared paths against the tree — not one of the ten rules, and it earns its place: a manifest naming a file that does not exist is how a manifest and its repo drift apart when files move.

tooling/plant-repo-format.py breaks each rule in a temporary repo and requires refusal. A checker nobody has watched fail is a guess about what it would do.

This repo

The contract home draws no route and answers no RPC, so it serves no seam. It carries one scope directory anyway — services — because it serves something every other repo depends on: the scope vocabulary itself.

.cpcp/package.json            index; points at the definitions of record
.cpcp/services/package.json   seams: [] with its because, and
                              scope_definitions: the three scopes, defined

Every scope manifest in every repo carries source: spec/scopes.md. That citation resolves to prose. scope_definitions is the same citation a machine can read, so a downstream reader gets the definition rather than a pointer to a document about it.

It lives in exactly one file. It was in the index as well until keeping both in step became the reader's problem rather than the format's — a second copy of a definition is a second thing to drift. The index points; the manifest defines.

The three other scopes have no directory here: this repo serves nothing on a pod network and calls nothing. A scope directory asserts a relation, and two empty ones would assert two false ones.

Publishing the vocabulary is all-or-nothing. A manifest carrying scope_definitions must define every scope and invent none — a partial vocabulary is one a downstream reader resolves and comes up empty on. Test: a missing or unknown scope key fails.


Notes

Repos named here are illustration, not specification. CPCP is not any one of them.

[1] Both shapes, filled in.

magentic-stack serves and calls nothing, so it carries pod_internal_services (its back, vault, bus, persist and mind seams), services (back again at host reach, plus published surfaces that are not seams), and no dependency. Its back in two manifests is rule 1.

express-meaning is the mirror: one dependency manifest naming an operation its producer has not built yet, and no serving scopes at all.

magentic-market-ai-site carries both serving scopes for a single seam reached two ways.

cpcp_demo serves one seam at services and carries an empty pod_internal_services whose because says it joins no pod network — rule 2 in use.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.