Skip to content

Deprecate Connector.EnablePCIB - #262

Open
TomK wants to merge 1 commit into
masterfrom
deprecate-enablepcib
Open

TomK wants to merge 1 commit into
masterfrom
deprecate-enablepcib

Conversation

@TomK

@TomK TomK commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Why

The gate EnablePCIB controlled diverted connectors into the retired processing vault. chargehive-assemble#1715 removed every reader, so the field is now inert — but nothing in the type said so, leaving it easy for someone to reasonably reintroduce a gate on it.

It could not be honoured even in principle: it's a bool tagged omitempty, so "unset" and "explicitly false" serialise identically. There is no merchant opt-out to preserve, which is also why inverting it to disablePCIB was never an option.

Why deprecate rather than delete

utils.Validate decodes via object.FromJsonStrictDisallowUnknownFields, and both chive validate and chive apply (chargehive-cli/cmd/validate.go:68, cmd/apply.go:85) go through it. Deleting the declaration would fail every stored config that still carries the key:

json: unknown field "enablePCIB"

Dev alone has 147 connectors. The field can be deleted once stored configs are known clean — the doc comment says so explicitly.

Changes

  • // Deprecated: marker on the field recording that it is ignored, why it cannot be honoured, and why the declaration stays.
  • TestDeprecatedEnablePCIBStillValidates — asserts a Connector config carrying enablePCIB still validates cleanly.

Test plan

  • go build ./... — clean.
  • go test ./...entire suite passes, no failures.
  • New test passes, and verified it actually guards: retagging the field to simulate its removal makes it fail with map[json:json: unknown field "enablePCIB"] does not equal map[] — precisely the breakage this PR exists to prevent. Restored and re-run green.
  • go vet ./... reports two findings, both pre-existing in untouched files (v1/policy/method_verify.go:26 struct tag spacing, utils/generate.go:396 unkeyed fields).

Follow-up

Deleting the field needs a sweep of stored configs first — chargehive_object.active_objects where kind='Connector' and the spec still contains enablePCIB. Not attempted here.

🤖 Generated with Claude Code

The gate this flag controlled diverted connectors into the retired processing
vault. Every reader was removed in chargehive-assemble#1715, so the field is now
inert - but nothing said so, leaving it easy to reintroduce a gate on it.

It could not be honoured even in principle: the field is a bool tagged omitempty,
so "unset" and "explicitly false" serialise identically and there is no merchant
opt-out to preserve.

Deprecating rather than deleting, because utils.Validate decodes with
DisallowUnknownFields. Removing the declaration would fail `chive validate` and
`chive apply` with `json: unknown field "enablePCIB"` for every stored config
that still sets it - dev alone has 147 connectors. The field goes once those are
known clean.

Added a test asserting a Connector config carrying enablePCIB still validates.
Verified it fails with exactly that unknown-field error when the declaration is
taken away, so the reason for keeping it is enforced rather than just documented.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant