Skip to content

refactor(backend): remove placeholders left by removed features - #242

Merged
HTExplicit merged 2 commits into
mainfrom
refactor/drop-placeholder-context
Oct 4, 2026
Merged

HTExplicit merged 2 commits into
mainfrom
refactor/drop-placeholder-context

Conversation

@HTExplicit

Copy link
Copy Markdown
Owner

Problem

Features that were removed from the fork (Cindy, the plugin host, quota overdraft) left placeholders in the backend: unused parameters, error returns that are nil on every path, conditions that are always false, fields that are only written or never assigned, and functions with no production caller. The owner's rule is that a retired feature leaves nothing behind.

Change

Each item was judged by the commit that introduced it. It is restored to the upstream v0.2.13 form where upstream has the same function, and to the fork's form from before the feature elsewhere.

Two placeholder-context functions (first commit)

  • resolveOpenAIForwardModelContext only returned resolveOpenAIForwardModel with a nil error. Its 14 callers lose an error branch that could never run. Nine now match upstream byte for byte; five are fork-only lines restored to their pre-Cindy form.
  • isOpenAIAccountRuntimeBlockedContext held the body of isOpenAIAccountRuntimeBlocked behind an unused context. One function remains.

The same kind, found by review (second commit)

  • Billing (openai_gateway_usage.go), back to upstream's shape:
    • no unused account / tokens parameters;
    • calculateOpenAIImageCost returns the cost only, since its error was nil on all five paths;
    • the duplicated channel-pricing branch is gone.
  • Result structs: fields that were never assigned (CacheCreation5mTokens, CacheCreation1hTokens, UsageInputTokensExcludeCache) or only written (ImageInputCount) are removed.
  • Runtime block:
    • a condition that was always false after normalisation is removed;
    • the persisted-cooldown zero guard and the stale-entry fallback, neither reachable in production, are removed.
  • Account tests: an unused context parameter on two stream processors and a duplicated service field are removed.
  • Account tools: the plugin-contract methods with no caller, the always-false capability check, and write-only invocation fields are removed.
  • Blank parameters whose reason is gone are dropped from their signatures across handler, repository and service. wire_gen.go is regenerated with wire v0.7.0.
  • Functions with no production caller are removed with their tests.

Kept on purpose

  • Blank parameters required by an interface, a callback or wire ordering.
  • Signatures kept identical to upstream.

No request changes what it sends, bills or fails on.

Verification

  • gofmt; go build ./... (default and GOOS=linux); go vet ./... with no tag and with -tags unit; go vet -tags integration on repository, service and handler; wire diff clean;
  • targeted tests for usage and image cost, identified pricing, runtime block and breaker, account tests, count-tokens failover, model context capacity, image tools and account tools, re-run after rebasing on feat(accounts): find accounts by upstream API key from the account search #239-fix(accounts): upstream billing rates resolve the page the account list shows #241;
  • three review lenses, each finding verified: billing equivalence line by line against upstream, behaviour, completeness with an AST scan against upstream. 11 findings confirmed; 10 fixed. The remaining one needs an owner decision: Image Studio has had no model source since the Cindy removal, so the subsystem cannot create jobs.

Not run locally: golangci-lint (the local binary cannot read Go 1.27 export data; CI runs it), full suites, real model calls.

🤖 Generated with Claude Code

@HTExplicit
HTExplicit force-pushed the refactor/drop-placeholder-context branch from 22564bb to 14769e5 Compare October 4, 2026 10:54
Codex and others added 2 commits October 4, 2026 19:38
resolveOpenAIForwardModelContext only returned resolveOpenAIForwardModel
with a nil error, so its 14 callers each carried an error branch that
could never run. isOpenAIAccountRuntimeBlockedContext held the body of
isOpenAIAccountRuntimeBlocked behind an unused context. Both came from
Cindy features that have since been removed.

Callers now use the upstream line where upstream has the same call, and
the fork's line from before the Cindy commits elsewhere. No behaviour
change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow-up to the two placeholder-context functions: the same Cindy,
plugin-host and overdraft commits left more of the same kind.

Billing (openai_gateway_usage.go) is back to upstream's shape: no unused
account/tokens parameters, no error return that was nil on every path,
no duplicated channel-pricing branch. Result structs lose fields that
were only written or never assigned. Runtime-block code loses a
condition that was always false and a fallback no caller could reach.
Functions with no production caller go with their tests. Blank
parameters whose reason is gone are dropped from their signatures;
wire_gen.go is regenerated.

Kept on purpose: blank parameters required by an interface, a callback
or wire ordering, and signatures kept identical to upstream.

No request changes what it sends, bills or fails on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HTExplicit
HTExplicit force-pushed the refactor/drop-placeholder-context branch from 14769e5 to b6f09a4 Compare October 4, 2026 11:39
@HTExplicit
HTExplicit enabled auto-merge (squash) October 4, 2026 11:39
@HTExplicit
HTExplicit merged commit cf6eb58 into main Oct 4, 2026
18 checks passed
@HTExplicit
HTExplicit deleted the refactor/drop-placeholder-context branch October 4, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant