Skip to content

pkg/api declares 12 HTTP routes and has no importer #367

Closed

Description

@scttfrdmn

pkg/api/server.go is 547 lines declaring 12 routes — mount lifecycle, mount
listing, object listing, metrics, health, config — and nothing in the
repository imports it
:

$ grep -rn 'objectfs/pkg/api' --include='*.go' . | grep -v '^./pkg/api/'
(no output)

cmd/objectfs/main.go does not construct it. No make target starts it. Its
only exercise is pkg/api/server_test.go, 905 lines testing handlers no
process ever serves — so the package has coverage and no reachability, which
is the combination that makes dead code look maintained.

Why this is worth a separate issue

It came up while resolving #336. docs-platform's ApiPlayground component
offered seven endpoints; six of them — /api/v1/metrics, /api/v1/mount,
/api/v1/mount/{mount_point}, /api/v1/mounts, /api/v1/storage/objects,
and a second health route — do not exist in any reachable form. They looked
plausible precisely because pkg/api declares routes with those shapes. A
package that declares an HTTP surface nobody serves is a source of
documentation that cannot be checked against behaviour, because there is no
behaviour.

The real HTTP surface of a running mount is two endpoints:

endpoint served by address from
/metrics internal/metrics/collector.go:171 monitoring.metrics.addr
/health internal/health/checker.go:532 monitoring.health_checks.addr

The decision this needs

Not "delete it" by default — unlike pkg/profiling (#245), this one is a
plausible future feature rather than a security liability, and it starts no
listener on its own. Three options:

  1. Wire it up behind an explicit config key, with the same loopback
    default and the same unauthenticated-listener warning /health and
    /metrics carry in SECURITY.md. Note that pkg/api/server.go:389 is one
    of the outstanding errcheck sites, so it does not currently pass the lint
    bar for shipped code.
  2. Delete it, as pkg/profiling has no importer and serves unauthenticated mutating endpoints: delete it, or make it safe to enable #245 did, on the argument that 1,452 lines with no
    importer are a liability and the two real endpoints cover the operational
    need.
  3. Mark it explicitly — a doc.go saying it is unreachable scaffolding
    and what wiring it up would require, in the style of
    internal/fuse/filesystem.go's EROFS stub or
    internal/distributed/gossip.go:823-828.

Filing rather than deciding, because option 1 is a real feature decision:
whether ObjectFS should offer a control-plane API at all is not a cleanup
question.

Activity

  1. added this to the Future Work milestone on Aug 5, 2026
  2. added
    type: technical-debt
    priority: low
    area: api
    on Aug 5, 2026
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

    area: apipriority: lowtype: technical-debt

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions