Skip to content

Reduce the public protocol surface to exercised extension points #10

Description

@sounkou-bioinfo

Evidence of premature protocol surface

At commit f3475cf000a379732d37cfb317754dec5ef2b4db, the 39,197 lines of package R source define approximately:

  • 639 S7 classes;
  • 240 S7 generics;
  • 757 S7 method definitions;
  • 989 exported symbols;
  • 538 exports and 376 classes in rho.ai alone.

Ninety generics have only one method across the monorepo. The repository defines more than twenty structural s7contract interfaces, but current capability admission materially checks only CredentialStore and SessionJournal; several other interfaces are documentation labels rather than exercised consumer contracts.

Private provider-wire machinery is also exported as public API. Examples include AnthropicWireEvent, AnthropicMessagesDecoder, rho_start_anthropic_block(), rho_apply_anthropic_delta(), and rho_finish_anthropic_block(). These have no consumer outside rho.ai, while the design explicitly says provider wire dialects remain private.

There are also future-only values such as ArtifactRefContent with codec and compaction support but no artifact-store producer. This increases the migration and documentation surface before the behavior in issue #3 exists.

Raw line counts do not prove bad design, and a one-method generic can be a justified extension point. The problem is that the current tree has no executable authority distinguishing justified extension points from speculative ones.

Required audit

Create a generated catalog from the authored R source containing, for each public class/generic/function:

  • owning package and documentation topic;
  • current constructor/producer;
  • current in-repository consumer;
  • external specialization contract, when intentionally open;
  • method count and implementing packages;
  • durable/wire schema relationship, if any;
  • retained-public or private decision with reason.

Then apply the repository's existing rules:

  1. A private wire parser type or helper is not exported.
  2. A structural interface is admitted and exercised by its consumer or removed.
  3. A generic has multiple current meanings, or has an executable external-extension fixture; otherwise use an ordinary function until a second implementation arrives.
  4. Future-only classes, fields, aliases, and codecs are removed until their producer lands.
  5. Pre-release cleanup changes all monorepo consumers together; do not add compatibility shims for rejected forms.
  6. Documentation is split by semantic contract instead of placing hundreds of aliases into omnibus reference pages.

This is semantic API reduction, not cosmetic source-file splitting. Do not move the same surface into more files or packages.

Acceptance evidence

  • the generated catalog is checked in CI for producer/consumer and export drift;
  • private provider-wire symbols above are no longer public unless an external fixture proves the extension contract;
  • every retained interface has an admission point and a fixture;
  • every retained single-method generic has an executable extension reason;
  • ArtifactRefContent is produced by issue Persist oversized tool results as typed artifacts #3 or removed until then;
  • package READMEs expose a small user path while protocol references remain discoverable separately.

Prepared in Pi using GPT Sol 5.6 High; counts were derived from the authored source and generated NAMESPACE files.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions