Skip to content

Commit 21bfab2

Browse files
committed
fix(suggestions): pass profile email directly for rollback; shared client applies context-specific updatedBy fallbacks
1 parent 657c35a commit 21bfab2

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/controllers/suggestions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2339,7 +2339,7 @@ function SuggestionsController(ctx, sqs, env) {
23392339
validSuggestions,
23402340
{
23412341
allSuggestions,
2342-
updatedBy: profile?.email || 'tokowaka-rollback',
2342+
updatedBy: profile?.email,
23432343
},
23442344
);
23452345

test/controllers/suggestions.test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9064,7 +9064,7 @@ describe('Suggestions Controller', () => {
90649064
expect(options.updatedBy).to.equal('test@test.com');
90659065
});
90669066

9067-
it('uses fallback updatedBy when profile email is missing', async () => {
9067+
it('passes undefined updatedBy when profile email is missing (shared client applies fallbacks)', async () => {
90689068
const rollbackStub = sandbox.stub().resolves({
90699069
succeededSuggestions: [tokowakaSuggestions[0]],
90709070
failedSuggestions: [],
@@ -9090,7 +9090,7 @@ describe('Suggestions Controller', () => {
90909090

90919091
expect(response.status).to.equal(207);
90929092
const [, , , options] = rollbackStub.firstCall.args;
9093-
expect(options.updatedBy).to.equal('tokowaka-rollback');
9093+
expect(options.updatedBy).to.be.undefined;
90949094
});
90959095

90969096
it('should return 400 for suggestions without edgeDeployed during rollback', async () => {
@@ -9480,7 +9480,7 @@ describe('Suggestions Controller', () => {
94809480
expect(options.updatedBy).to.equal('test@test.com');
94819481
});
94829482

9483-
it('uses fallback updatedBy when profile email is missing', async () => {
9483+
it('passes undefined updatedBy when profile email is missing (shared client applies fallbacks)', async () => {
94849484
const response = await suggestionsController.rollbackSuggestionFromEdge({
94859485
...context,
94869486
attributes: {
@@ -9500,7 +9500,7 @@ describe('Suggestions Controller', () => {
95009500

95019501
expect(response.status).to.equal(207);
95029502
const [, , , options] = tokowakaClientStub.rollbackSuggestions.firstCall.args;
9503-
expect(options.updatedBy).to.equal('tokowaka-rollback');
9503+
expect(options.updatedBy).to.be.undefined;
95049504
});
95059505

95069506
it('should handle rollback failure from tokowaka client', async () => {
@@ -9762,7 +9762,7 @@ describe('Suggestions Controller', () => {
97629762
expect(body.suggestions[0].message).to.include('Rollback failed: Internal server error');
97639763
});
97649764

9765-
it('uses fallback updatedBy for path suggestion and covered suggestions when profile email is missing', async () => {
9765+
it('passes undefined updatedBy when profile email is missing (shared client applies path-rollback fallback)', async () => {
97669766
const response = await suggestionsController.rollbackSuggestionFromEdge({
97679767
...context,
97689768
attributes: {
@@ -9776,9 +9776,9 @@ describe('Suggestions Controller', () => {
97769776
});
97779777

97789778
expect(response.status).to.equal(207);
9779-
// updatedBy fallback is passed to rollbackSuggestions which handles the cascade
9779+
// The api-service passes undefined; shared client applies 'path-rollback' fallback internally
97809780
const [, , , options] = tokowakaClientStub.rollbackSuggestions.firstCall.args;
9781-
expect(options.updatedBy).to.equal('tokowaka-rollback');
9781+
expect(options.updatedBy).to.be.undefined;
97829782
});
97839783
});
97849784

@@ -9931,7 +9931,7 @@ describe('Suggestions Controller', () => {
99319931
expect(options.allSuggestions).to.include(pathCoveredSuggestion);
99329932
});
99339933

9934-
it('uses fallback updatedBy for cascade path and its covered suggestions when profile email is missing', async () => {
9934+
it('passes undefined updatedBy when profile email is missing (shared client applies domain-wide-rollback-cascade fallback)', async () => {
99359935
const response = await suggestionsController.rollbackSuggestionFromEdge({
99369936
...context,
99379937
attributes: {
@@ -9945,9 +9945,9 @@ describe('Suggestions Controller', () => {
99459945
});
99469946

99479947
expect(response.status).to.equal(207);
9948-
// updatedBy fallback is propagated to rollbackSuggestions which handles cascade
9948+
// The api-service passes undefined; shared client applies 'domain-wide-rollback-cascade' internally
99499949
const [, , , options] = tokowakaClientStub.rollbackSuggestions.firstCall.args;
9950-
expect(options.updatedBy).to.equal('tokowaka-rollback');
9950+
expect(options.updatedBy).to.be.undefined;
99519951
});
99529952

99539953
it('is a no-op cascade when no path suggestions are deployed', async () => {

0 commit comments

Comments
 (0)