fix(monetize): drop available, use drainEndsAt as sole drain signal#548
Open
bussyjd wants to merge 1 commit into
Open
fix(monetize): drop available, use drainEndsAt as sole drain signal#548bussyjd wants to merge 1 commit into
bussyjd wants to merge 1 commit into
Conversation
…e drain signal (re-amend of #535) drain becomes purely additive — active offers serialize identically to pre-drain main. The only new wire field is `drainEndsAt`, set on draining offers only. Consumers detect drain with `if (entry.drainEndsAt) { /* draining */ }`. No schema-breaking change for any consumer that was reading the catalog before drain landed. This re-ships an amendment that was originally pushed as commit dd89750 on `feat/drain-replaces-pause` for PR #535. The amendment didn't survive the bundle PR #536's merge into main, so the controller is shipping the un-amended `Available bool` shape today. - ServiceCatalogEntry: remove `Available bool`; keep `DrainEndsAt string omitempty` - service-catalog.schema.json: drop `available` from `required` + `properties` - buildServiceCatalogJSON: stop setting Available; only set DrainEndsAt on drain - buildSkillCatalogMarkdown: rename `Available` table column to `Status` (active rows show `—`; draining rows show `draining · ends <RFC3339>`). Drop the per-service `- **Available**:` bullet entirely; draining services keep only the `- **Drain ends at**:` bullet. - serviceDefWithDrain: stop setting the (already-additive) `Available *bool` on erc8004.ServiceDef during drain; signal via DrainEndsAt only. - Tests: - TestBuildServiceCatalogJSON_ExcludesNonReady: replace `services[0].Available == true` with raw-JSON map walk asserting `available` and `drainEndsAt` keys are absent on active entries. - TestBuildServiceCatalogJSON_DrainLifecycle: rewrite to raw-map walk; assert active entries have neither `available` nor `drainEndsAt`, mid-drain entries have only `drainEndsAt` (no `available`). - TestBuildRegistration{,Identity}Services_IncludesDrainMetadata: replace `svc.Available == &false` checks with `svc.Available == nil` (DrainEndsAt is now the sole drain marker). - Add TestBuildSkillCatalogMarkdown_DrainAdditiveDetail: asserts no `- **Available**:` bullet appears for any offer, that draining offers keep their `- **Drain ends at**:` bullet, and that the table header uses `Status` not `Available`.
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
drain becomes purely additive — active offers serialize identically to pre-drain main. The only new wire field is
drainEndsAt, set on draining offers only. Consumers detect drain withif (entry.drainEndsAt) { /* draining */ }. No schema-breaking change for any consumer that was reading the catalog before drain landed.This re-ships an amendment that was originally pushed as commit dd89750 on
feat/drain-replaces-pausefor PR #535. The amendment didn't survive the bundle PR #536's merge into main, so the controller is shipping the un-amendedAvailable boolshape today.Diff summary
internal/schemas/service_catalog.go— removeAvailable boolfromServiceCatalogEntry; keepDrainEndsAt stringomitempty`` as the sole drain marker.internal/schemas/service-catalog.schema.json— dropavailablefromrequiredand fromproperties; tighten thedrainEndsAtdescription to "present iff draining".internal/serviceoffercontroller/render.gobuildServiceCatalogJSON: stop settingAvailable; only setDrainEndsAtwhenoffer.IsDraining().buildSkillCatalogMarkdown: rename theAvailabletable column toStatus(active rows show—; draining rows showdraining · ends `<RFC3339>`); drop the per-service- **Available**:bullet entirely (draining services keep only- **Drain ends at**:).serviceDefWithDrain: stop setting the (already-additive)Available *boolonerc8004.ServiceDefduring drain — signal drain viaDrainEndsAtonly.internal/serviceoffercontroller/render_test.goTestBuildServiceCatalogJSON_ExcludesNonReady: replaceservices[0].Available == trueassertion with a raw-JSON map walk assertingavailableanddrainEndsAtkeys are absent on active entries.TestBuildServiceCatalogJSON_DrainLifecycle: rewrite the lifecycle assertions to walk[]map[string]any. Active entries: neitheravailablenordrainEndsAt. Mid-drain: onlydrainEndsAt. Expired: filtered.TestBuildRegistrationServices_IncludesDrainMetadataandTestBuildIdentityRegistrationServices_IncludesDrainMetadata: replacesvc.Available == &falsechecks withsvc.Available == nil(the helper no longer sets it; presence-of-DrainEndsAtis the sole drain marker).TestBuildSkillCatalogMarkdown_DrainAdditiveDetail: asserts no- **Available**:bullet appears for any offer, draining offers keep their- **Drain ends at**:bullet, and the table header usesStatusnotAvailable.Test plan
go build ./...cleango test ./internal/schemas/... ./internal/serviceoffercontroller/... ./internal/monetizeapi/...greengo test ./...green (full suite, includinginternal/stack)TestBuildServiceCatalogJSON_ExcludesNonReadyconfirms active-offer JSON has noavailablekeyTestBuildServiceCatalogJSON_DrainLifecycleconfirms draining offer still emitsdrainEndsAt(and onlydrainEndsAt)TestBuildSkillCatalogMarkdown_DrainAdditiveDetailconfirms markdown surface is additive: no- **Available**:bullet,Statuscolumn header,- **Drain ends at**:retained on draining offers.