Correctness- and interoperability-oriented Tangled CLI
camlet docs protocol issue-list-contract.md
11 kB · 222 lines
Markdown
at main

Issue list protocol contract #

This document defines the implemented and verified protocol boundary for the repository-scoped camlet issue list command. The result is a bounded observation of Bobbin's aggregated index. It is not an authoritative inventory of every issue record that may exist.

Evidence scope #

The contract was researched and observed on 2026-07-29 against:

  • Tangled core commit 0dc54771380cd1bfec25d775fedfb66db7869b74;
  • the sh.tangled.repo.listIssues and sh.tangled.repo.issue lexicons at that commit;
  • the Bobbin implementation and documentation at that commit;
  • the managed Bobbin at api.tangled.org.

The managed service did not expose a deployed component version. The pinned source tree establishes the current lexicon and implementation intent, but does not prove which revision the managed endpoint runs.

Sanitized observations under test/contract/fixtures/issue_list/v1 preserve a managed continuation cursor, terminal null cursor, duplicate embedded $type, open and closed derived states, comment counts, and two coverage observations. Live behavior proves only the deployment state at the observation time.

Query boundary #

The initial command contract is repository-scoped:

camlet issue list [REPOSITORY_DID]
camlet issue list --repo PATH
camlet issue list --state open|closed|all
camlet issue list --bobbin ORIGIN

An explicit repository identity must be a did:plc. With no explicit identity, Camlet discovers one unique Tangled repository DID from local Git remotes. --repo selects the local repository used for discovery. An explicit repository DID and --repo are mutually exclusive.

The default Bobbin is https://api.tangled.org. --bobbin accepts an explicit HTTPS origin and takes precedence over that default. Persisted configuration and repository-controlled Bobbin selection are outside this contract. The explicit override provides a testable path for alternate deployments without claiming compatibility with an unobserved self-hosted Bobbin.

--state is an optional server-side filter. all is the default and omits the XRPC state parameter. The command does not expose Bobbin cursors, page limits, author filters, or ordering as options. It requests descending creation-time order and consumes every page within its supported bounds.

Aggregated read chain #

repository DID
  -> select Bobbin origin
  -> Bobbin sh.tangled.bobbin.getCoverage
  -> Bobbin sh.tangled.repo.listIssues(subject=repository DID), all pages
  -> Bobbin sh.tangled.bobbin.getCoverage
  -> validate coverage progression and every returned issue observation

Bobbin is the preferred service for cross-author issue aggregation. Issue records are stored in their authors' AT repositories, so one repository owner's PDS cannot authoritatively enumerate every issue about that repository. Bobbin indexes the relationship and hydrates the record values through Slingshot and PDS reads.

This makes Bobbin a necessary aggregation source, not an authority for absence. A successful result proves that Camlet consumed the complete cursor traversal Bobbin exposed during the operation. It does not prove that Bobbin has observed every relevant AT repository event.

Issue item validation #

For every sh.tangled.repo.listIssues item Camlet requires:

  1. a unique, valid AT URI in the sh.tangled.repo.issue collection with a record key;
  2. an optional valid CID;
  3. an embedded object whose $type is exactly sh.tangled.repo.issue under the narrow duplicate-field compatibility rule below;
  4. a value.repo that exactly matches the requested repository DID;
  5. a non-empty UTF-8 title no larger than 16 KiB;
  6. an optional UTF-8 body no larger than 1 MiB;
  7. a valid createdAt timestamp;
  8. a non-negative comment count supported by the local integer profile;
  9. a valid optional state-update timestamp;
  10. a state string no larger than 128 bytes and safe to preserve in machine output.

The currently known derived states are open and closed. Tangled declares these as known string values rather than a closed enum, so Camlet preserves a syntactically safe unknown value instead of coercing it to a known state. Human output escapes all remote-controlled text before writing it to a terminal.

The list response does not identify the state record that produced state and stateUpdatedAt. Bobbin's current implementation accepts state records authored by either the issue author or the repository owner and ignores other sources. Camlet records the returned state and comment count as Bobbin-derived observations; it does not claim to have independently verified those derived values against every source PDS.

Any invalid or inconsistent item fails the command. Camlet does not silently skip an item or emit a partial page traversal.

When --state open or --state closed is selected, every returned derived state must match that filter. A different or unknown state is a consistency error rather than a silently accepted server-side filter failure.

The managed deployment currently serializes $type twice inside each embedded issue value: once before and once after the record fields. This violates the ordinary duplicate-field invariant, but both observed values were the same required type. Camlet accepts one $type occurrence, or exactly two occurrences when both are the literal sh.tangled.repo.issue. Missing, conflicting, non-string, or more than two occurrences remain protocol errors. No other trust-critical field receives this exception.

Pagination and mutation contract #

Camlet calls sh.tangled.repo.listIssues with limit=100, order=desc, the repository DID as subject, and an optional state filter. The cursor is opaque. Camlet continues whenever a non-null cursor string is present, including after a short or empty page.

The current lexicon declares cursor as an optional string. The managed deployment returned "cursor": null on terminal pages. The supported decoder therefore treats an absent field and explicit null as terminal, while rejecting every other JSON type.

The supported profile applies these local bounds:

  • at most 100 items per response;
  • at most 10,000 items and 100 page requests for the complete operation;
  • at most 4 KiB for a cursor and 8 MiB for one list response;
  • one operation-wide deadline, including coverage and every list page.

A repeated cursor, duplicate issue URI, oversized cursor or page, or exceeded page or item limit is an error. The limits define Camlet's supported profile; exceeding them does not prove that the remote data is invalid.

Bobbin pagination is not a transactional snapshot. New records, deletions, state records, comments, and Hydrant events can appear while Camlet traverses pages. Duplicate observations are rejected, but concurrent mutation can still make an indexed record absent from the non-atomic traversal.

Coverage semantics #

sh.tangled.bobbin.getCoverage reports ready, eventsProcessed, and lastCursor for Bobbin's Hydrant stream. Camlet observes coverage immediately before and after pagination. Both observations are required and must decode successfully. Counters may advance, and ready may change from false to true. Counter regression or a change from ready to warming means the operation crossed an incoherent index lifecycle and fails with a consistency error.

ready: false is a valid successful observation and explicitly indicates a warming index. ready: true means that Bobbin considers itself caught up with its configured Hydrant stream. Neither state proves that Hydrant has discovered every PDS event or that the result is authoritative for one repository.

An empty successful list is therefore rendered as "No indexed issues observed." It is never rendered as "No issues."

Machine output contract #

camlet issue list --json emits org.camlet.issue-list.v1:

{
  "schema": "org.camlet.issue-list.v1",
  "result": {
    "repository": {
      "did": "did:plc:aaaaaaaaaaaaaaaaaaaaaaaa"
    },
    "filter": {
      "state": "all"
    },
    "issues": [
      {
        "id": "3example",
        "record": {
          "uri": "at://did:plc:bbbbbbbbbbbbbbbbbbbbbbbb/sh.tangled.repo.issue/3example",
          "cid": "bafyreigfkphxytbcofvk7bjh622rep55av3l3anzp2isioecbidkgzjzkm",
          "created_at": "2026-01-02T03:04:05Z"
        },
        "content": {
          "title": "Example issue",
          "body": "Example body"
        },
        "derived": {
          "state": "open",
          "state_updated_at": null,
          "comment_count": 1,
          "source": "bobbin"
        }
      }
    ],
    "observation": {
      "observed_at": "2026-01-02T03:05:00Z",
      "source": {
        "kind": "bobbin",
        "endpoint": "https://api.tangled.org"
      },
      "enumeration": "bobbin_complete_pagination",
      "snapshot": "non_atomic",
      "completeness": "indexed_observation_only",
      "coverage": {
        "before": {
          "ready": true,
          "events_processed": 100000,
          "last_cursor": 110000
        },
        "after": {
          "ready": true,
          "events_processed": 100010,
          "last_cursor": 110010
        }
      }
    }
  }
}

Issue order is the order returned by complete descending Bobbin pagination. The record key is a displayable ID, but the AT URI is the unique machine identity. Camlet does not invent sequential issue numbers. Optional cid, body, and state-update timestamps are JSON null when absent.

bobbin_complete_pagination means every cursor exposed during this request was followed. The stable indexed_observation_only limitation means that neither an empty array nor a ready coverage state establishes authoritative absence.

Error and network boundaries #

The shared HTTP adapter enforces HTTPS origins, public DNS peers, disabled redirects and ambient credentials, identity content encoding, bounded headers and bodies, TLS hostname verification, and the operation deadline. Both list and coverage reads are unauthenticated.

400 InvalidRequest, rate limits, upstream hydration failures, service failures, wrong content types, and valid XRPC envelopes are classified using the operation and error name rather than status alone. Raw response bodies, query strings, endpoint-controlled titles, resolved IP addresses, and infrastructure headers remain out of errors. The explicit Bobbin origin may appear in successful source attribution but is never interpolated into a transport or protocol error.