Skip to content

Commit 07f1ca6

Browse files
committed
[FSSDK-12813] Remove ticket references from code comments per cross-sdk guideline
1 parent 91abb36 commit 07f1ca6

6 files changed

Lines changed: 26 additions & 43 deletions

File tree

pkg/event/event_id_normalizer.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
// Package event //
1818
package event
1919

20-
// Decision event ID normalization (FSSDK-12813).
20+
// Decision event ID normalization.
2121
//
2222
// These helpers normalize the campaign_id, variation_id, and entity_id fields
2323
// of outgoing decision events so that every decision type (experiment, feature
2424
// test, rollout, holdout) produces uniform, valid wire output regardless of
2525
// what upstream code supplies.
2626
//
27-
// Contract (per relaxed FSSDK-12813 spec):
27+
// Contract:
2828
// - campaign_id / entity_id: must be a non-empty string. Any character
2929
// content is allowed (IDs may be opaque, e.g. "default-12345", "layer_abc").
3030
// When the value is empty (""), fall back to experiment_id.
@@ -68,10 +68,10 @@ func IsNonEmptyString(value string) bool {
6868
}
6969

7070
// NormalizeCampaignID returns campaignID if it is a non-empty string;
71-
// otherwise it returns experimentID. Per the relaxed FSSDK-12813 spec, any
72-
// non-empty character content is accepted for campaign_id / entity_id —
73-
// IDs may be opaque (e.g. "default-12345", "layer_abc"). Fallback to
74-
// experiment_id fires ONLY when campaignID is the empty string.
71+
// otherwise it returns experimentID. Any non-empty character content is
72+
// accepted for campaign_id / entity_id — IDs may be opaque (e.g.
73+
// "default-12345", "layer_abc"). Fallback to experiment_id fires ONLY when
74+
// campaignID is the empty string.
7575
//
7676
// This function is used for both decisions[].campaign_id and (for impression
7777
// events) events[].entity_id so both fields are normalized identically and

pkg/event/event_id_normalizer_test.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ import (
2828
"github.com/optimizely/go-sdk/v2/pkg/entities"
2929
)
3030

31-
// FSSDK-12813: Decision-event ID normalization tests.
31+
// Decision-event ID normalization tests.
3232
//
33-
// These tests verify the cross-SDK contract for outgoing decision events
34-
// (per the relaxed spec):
33+
// These tests verify the cross-SDK contract for outgoing decision events:
3534
// - campaign_id / entity_id: non-empty string (any character content;
3635
// opaque IDs allowed). Fallback to experiment_id ONLY when empty.
3736
// - variation_id: STRICT non-empty numeric string OR JSON null.
@@ -262,8 +261,8 @@ func numericVariation() entities.Variation {
262261
}
263262

264263
func holdoutExperiment() entities.Experiment {
265-
// FSSDK-12813: Holdouts ship with no LayerID. Normalizer must fall back
266-
// to ExperimentID for both campaign_id and entity_id.
264+
// Holdouts ship with no LayerID. Normalizer must fall back to
265+
// ExperimentID for both campaign_id and entity_id.
267266
return entities.Experiment{Key: "holdout_key", LayerID: "", ID: "9876543210"}
268267
}
269268

@@ -280,10 +279,10 @@ func TestImpressionEvent_NormalizesCampaignAndEntityIDsForHoldout(t *testing.T)
280279

281280
// FR-001/FR-002: empty LayerID is substituted with ExperimentID.
282281
assert.Equal(t, exp.ID, userEvent.Impression.CampaignID,
283-
"holdout campaign_id must fall back to experiment_id when LayerID is empty (FSSDK-12813)")
282+
"holdout campaign_id must fall back to experiment_id when LayerID is empty")
284283
// FR-009: entity_id mirrors campaign_id byte-for-byte.
285284
assert.Equal(t, exp.ID, userEvent.Impression.EntityID,
286-
"holdout entity_id must equal campaign_id byte-for-byte (FSSDK-12813)")
285+
"holdout entity_id must equal campaign_id byte-for-byte")
287286

288287
// Same invariant must hold in the wire visitor / decision payload.
289288
visitor := createVisitorFromUserEvent(userEvent)
@@ -313,7 +312,7 @@ func TestImpressionEvent_PassesThroughOpaqueLayerID(t *testing.T) {
313312
// Opaque LayerID passes through under the relaxed spec — NOT substituted
314313
// with experiment_id.
315314
assert.Equal(t, "default-12345", userEvent.Impression.CampaignID,
316-
"opaque LayerID must pass through (FSSDK-12813 relaxed)")
315+
"opaque LayerID must pass through (relaxed contract)")
317316
assert.Equal(t, "default-12345", userEvent.Impression.EntityID,
318317
"entity_id must mirror campaign_id (FR-009)")
319318

@@ -356,7 +355,7 @@ func TestImpressionEvent_NormalizesVariationIDToJSONNull(t *testing.T) {
356355

357356
visitor := createVisitorFromUserEvent(userEvent)
358357
assert.Nil(t, visitor.Snapshots[0].Decisions[0].VariationID,
359-
"non-numeric variation_id must be normalized to nil so it serializes as JSON null (FSSDK-12813)")
358+
"non-numeric variation_id must be normalized to nil so it serializes as JSON null")
360359

361360
// Verify on-the-wire JSON shape.
362361
b, err := json.Marshal(visitor.Snapshots[0].Decisions[0])

pkg/event/events.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ type Snapshot struct {
116116
//
117117
// VariationID is a pointer so that an empty / non-numeric upstream value
118118
// can be serialized as JSON null per the cross-SDK decision-event
119-
// normalization spec (FSSDK-12813). A nil VariationID marshals to
120-
// "variation_id": null on the wire.
119+
// normalization spec. A nil VariationID marshals to "variation_id": null
120+
// on the wire.
121121
type Decision struct {
122122
VariationID *string `json:"variation_id"`
123123
CampaignID string `json:"campaign_id"`

pkg/event/events_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
)
2525

2626
func TestSnapshotHasOptionalDecisions(t *testing.T) {
27-
// FSSDK-12813: Decision.VariationID is *string so that an empty / non-numeric
27+
// Decision.VariationID is *string so that an empty / non-numeric
2828
// upstream value can serialize as JSON null. Pass &v with a numeric ID.
2929
v := "1"
3030
snapshot := Snapshot{

pkg/event/factory.go

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,8 @@ func createImpressionEvent(
103103
variationID = variation.ID
104104
}
105105

106-
// FSSDK-12813: Normalize campaign_id, variation_id, and entity_id uniformly
107-
// for every decision type (experiment, feature test, rollout, holdout).
108-
// - campaign_id falls back to experiment.ID when LayerID is the empty
109-
// string (e.g. holdouts have no layer). Any non-empty value — numeric
110-
// or opaque (e.g. "layer_abc") — passes through per the relaxed spec.
111-
// - entity_id mirrors the normalized campaign_id so both fields are
112-
// byte-equivalent on the wire (FR-009).
113-
// - variation_id is normalized later when the Decision is built, since the
114-
// Decision struct uses *string to allow JSON null output (FR-003/FR-004).
115-
// variation_id retains the STRICT numeric-string contract.
106+
// entity_id mirrors the normalized campaign_id so both fields are
107+
// byte-equivalent on the wire.
116108
normalizedCampaignID := NormalizeCampaignID(experiment.LayerID, experiment.ID)
117109

118110
event := ImpressionEvent{
@@ -186,12 +178,9 @@ func CreateImpressionUserEvent(
186178

187179
// create an impression visitor
188180
func createImpressionVisitor(userEvent UserEvent) Visitor {
189-
// FSSDK-12813: Apply decision-event ID normalization at the visitor /
190-
// wire-payload boundary as a defense-in-depth pass. The ImpressionEvent
191-
// is already normalized when constructed (see createImpressionEvent), but
192-
// normalizing again here guarantees that any callers who mutate the
193-
// in-memory ImpressionEvent before dispatch still produce a valid wire
194-
// payload. This call is idempotent for already-normalized values.
181+
// Re-normalize at the wire-payload boundary as defense-in-depth so
182+
// callers that mutate the ImpressionEvent before dispatch still produce
183+
// a valid payload. Idempotent for already-normalized values.
195184
normalizedCampaignID := NormalizeCampaignID(userEvent.Impression.CampaignID, userEvent.Impression.ExperimentID)
196185

197186
decision := Decision{}

pkg/event/factory_test.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,8 @@ func TestCreateImpressionUserEventWithCmabUUID(t *testing.T) {
339339
func TestCreateImpressionUserEventForHoldout(t *testing.T) {
340340
tc := TestConfig{}
341341

342-
// FSSDK-12813: variation_id retains a strict numeric-string contract on
343-
// the wire (non-numeric values serialize as JSON null). campaign_id /
344-
// entity_id are relaxed to non-empty strings (opaque IDs allowed; the
345-
// only fallback to experiment_id is when LayerID is the empty string).
346-
// Use numeric IDs in fixtures so the happy-path assertions below exercise
347-
// both the variation_id pass-through and the empty-LayerID fallback for
342+
// Use numeric IDs in fixtures so the assertions below exercise the
343+
// variation_id pass-through and the empty-LayerID fallback for
348344
// campaign_id without entanglement.
349345
testHoldout := entities.Experiment{
350346
Key: "test_holdout",
@@ -447,9 +443,8 @@ func TestCreateImpressionUserEventForHoldout(t *testing.T) {
447443
// Verify IDs are set correctly
448444
assert.Equal(t, testHoldoutVariation.ID, impression.VariationID)
449445
assert.Equal(t, testHoldout.ID, impression.ExperimentID)
450-
// FSSDK-12813: Holdouts have no LayerID, so the impression's CampaignID
451-
// is normalized to ExperimentID (FR-001/FR-002). The same normalized
452-
// value is also reused as the impression's EntityID (FR-009).
446+
// Holdouts have no LayerID, so the impression's CampaignID is
447+
// normalized to ExperimentID. EntityID mirrors CampaignID.
453448
assert.Equal(t, testHoldout.ID, impression.CampaignID)
454449
assert.Equal(t, testHoldout.ID, impression.EntityID)
455450
})

0 commit comments

Comments
 (0)