Filip Aleksic activity https://gitlab.com/faleksic 2026-03-17T11:15:04Z tag:gitlab.com,2026-03-17:5212299141 Filip Aleksic commented on merge request !227597 at GitLab.org / GitLab 2026-03-17T11:15:04Z faleksic Filip Aleksic

This isn't high priority. I went through all of my created issues and started closing them (if the issue is resolved) or started creating merge requests (if I thought I can contribute to a fix).

tag:gitlab.com,2026-03-17:5212098169 Filip Aleksic commented on merge request !227597 at GitLab.org / GitLab 2026-03-17T10:32:23Z faleksic Filip Aleksic

Hey @gitlab.mschoenlaub I've tested that.

Using

{
  "created_at": "{{object_attributes.created_at}}",
  "updated_at": "{{object_attributes.updated_at}}"
}

Testing it via the UI we get:

Hook execution failed: Error while parsing rendered custom webhook template: expected comma (after created_at) at line 2, column 23 [parse.c:762] in '{ "created_at": ""2026-03-16T12:58:34.400Z"", "updated_at": ""2026-03-16T17:00:22.858Z"" }

When commenting on an issue for the webhook to trigger we get:

{
  "created_at": "2026-03-17 10:31:37 UTC",
  "updated_at": "2026-03-17 10:31:37 UTC"
}

as the payload.

tag:gitlab.com,2026-03-17:5211977265 Filip Aleksic commented on issue #593827 at GitLab.org / GitLab 2026-03-17T10:07:08Z faleksic Filip Aleksic

GitLab Ultimate customer reported this issue. Zendesk (internal only)

tag:gitlab.com,2026-03-17:5211970050 Filip Aleksic commented on issue #593827 at GitLab.org / GitLab 2026-03-17T10:05:35Z faleksic Filip Aleksic

Adding severity2 as a precaution.

tag:gitlab.com,2026-03-17:5211175673 Filip Aleksic commented on merge request !227597 at GitLab.org / GitLab 2026-03-17T06:44:09Z faleksic Filip Aleksic

@gitlab.mschoenlaub I am at a loss on how to fix the tests, I wanted to add the following:

  describe '#render_custom_template' do
    let(:service) { described_class.new(hook, data, :issues_events) }
    let(:hook) { create(:project_hook) }
    let(:data) { { 'object_attributes' => { 'created_at' => '2026-03-16T17:57:17.223Z', 'title' => 'Test' } } }

    context 'with date string values' do
      it 'preserves quotes around date strings' do
        template = '{"created_at": {{object_attributes.created_at}}}'
        result = service.send(:render_custom_template, template, data.deep_stringify_keys)

        expect(result).to eq('{"created_at": "2026-03-16T17:57:17.223Z"}')
      end
    end


    context 'with string values' do
      it 'preserves quotes around string values' do
        template = '{"title": {{object_attributes.title}}}'
        result = service.send(:render_custom_template, template, data.deep_stringify_keys)

        expect(result).to eq('{"title": "Test"}')
      end
    end


    context 'with numeric values' do
      let(:data) { { 'object_attributes': { 'id': 42 } } }

      it 'renders numeric values without quotes' do
        template = '{"id": {{object_attributes.id}}}'
        result = service.send(:render_custom_template, template, data.deep_stringify_keys)

        expect(result).to eq('{"id": 42}')
      end
    end


    context 'with boolean values' do
      let(:data) { { 'object_attributes': { 'active': true } } }

      it 'renders boolean values without quotes' do
        template = '{"active": {{object_attributes.active}}}'
        result = service.send(:render_custom_template, template, data.deep_stringify_keys)

        expect(result).to eq('{"active": true}')
      end
    end
  end

but I see that the change I made broke some tests. Not sure how to proceed?

tag:gitlab.com,2026-03-17:5211127357 Filip Aleksic commented on merge request !227597 at GitLab.org / GitLab 2026-03-17T06:24:45Z faleksic Filip Aleksic

Hey @gitlab.mschoenlaub 👋 can you please review this change? 😄

tag:gitlab.com,2026-03-17:5211122000 Filip Aleksic commented on merge request !227597 at GitLab.org / GitLab 2026-03-17T06:22:21Z faleksic Filip Aleksic

@GitLabDuo re-evaluate the merge request again using best practices and standards as well as ensuring the custom instructions are met. No emojis. Shorter answers.

tag:gitlab.com,2026-03-17:5211113368 Filip Aleksic commented on merge request !227597 at GitLab.org / GitLab 2026-03-17T06:18:31Z faleksic Filip Aleksic

@GitLabDuo with the change applied, using:

{
  "created_at": {{object_attributes.created_at}},
  "updated_at": {{object_attributes.updated_at}},
  "title": {{object_attributes.title}}
}

Template, testing the webhook manually produces the expected payload:

{
  "created_at": "2026-03-15T08:39:33.244Z",
  "updated_at": "2026-03-16T18:00:15.147Z",
  "title": "Deserunt repudiandae officiis qui praesentium ipsum placeat doloribus unde."
}

The webhook is setup to listen for issue events. When commenting on an issue to trigger that issue event the payload is:

{
  "created_at": "2026-03-17 06:10:18 UTC",
  "updated_at": "2026-03-17 06:10:18 UTC",
  "title": null
}

I believe there's a difference when testing the webhook and actually triggering it normally. Double-check the code and suggest changes if required.

tag:gitlab.com,2026-03-17:5211111801 Filip Aleksic pushed to project branch faleksic-webhook-date-quotes at GitLab.org / GitLab 2026-03-17T06:17:49Z faleksic Filip Aleksic

Filip Aleksic (bc214dc0) at 17 Mar 06:17

always convert to json

tag:gitlab.com,2026-03-17:5211111030 Filip Aleksic commented on merge request !227597 at GitLab.org / GitLab 2026-03-17T06:17:30Z faleksic Filip Aleksic

Adding the change manually so it would actually see the change...

tag:gitlab.com,2026-03-17:5211106434 Filip Aleksic commented on merge request !227597 at GitLab.org / GitLab 2026-03-17T06:15:40Z faleksic Filip Aleksic

@GitLabDuo The change was applied locally and tested. It does not work as expected. The above-mentioned output is the output when the function is defined as:

   def render_custom_template(template, params)
     template.gsub(CUSTOM_TEMPLATE_INTERPOLATION_REGEX) do
       value = params.dig(*Regexp.last_match(1).split('.'))
       value.to_json
     end
   end
tag:gitlab.com,2026-03-17:5211099745 Filip Aleksic commented on merge request !227597 at GitLab.org / GitLab 2026-03-17T06:13:32Z faleksic Filip Aleksic

@GitLabDuo with the change applied, using:

{
  "created_at": {{object_attributes.created_at}},
  "updated_at": {{object_attributes.updated_at}},
  "title": {{object_attributes.title}}
}

Template, testing the webhook manually produces the expected payload:

{
  "created_at": "2026-03-15T08:39:33.244Z",
  "updated_at": "2026-03-16T18:00:15.147Z",
  "title": "Deserunt repudiandae officiis qui praesentium ipsum placeat doloribus unde."
}

The webhook is setup to listen for issue events. When commenting on an issue to trigger that issue event the payload is:

{
  "created_at": "2026-03-17 06:10:18 UTC",
  "updated_at": "2026-03-17 06:10:18 UTC",
  "title": null
}

I believe there's a difference when testing the webhook and actually triggering it normally. Double-check the code and suggest changes if required.

tag:gitlab.com,2026-03-17:5211080633 Filip Aleksic commented on merge request !227597 at GitLab.org / GitLab 2026-03-17T06:04:57Z faleksic Filip Aleksic

@GitLabDuo the change I suggested has multiple lines, in your suggestion only one line needs to be removed. Evaluate the change again. Provide a diff, not a suggestion of the changes.

tag:gitlab.com,2026-03-17:5211074696 Filip Aleksic commented on merge request !227597 at GitLab.org / GitLab 2026-03-17T06:03:08Z faleksic Filip Aleksic

@GitLabDuo provide the whole diff for the change you have suggested. Use standard diff format.

tag:gitlab.com,2026-03-17:5211069555 Filip Aleksic commented on merge request !227597 at GitLab.org / GitLab 2026-03-17T06:01:18Z faleksic Filip Aleksic

@GitLabDuo sure. Test with all json-allowed properties (int, string, array, dates as strings, etc)

tag:gitlab.com,2026-03-17:5211065326 Filip Aleksic commented on merge request !227597 at GitLab.org / GitLab 2026-03-17T05:59:05Z faleksic Filip Aleksic

@GitLabDuo strings can contain spaces as well. Dates can have spaces as well, e.g. 2026-03-16 18:00:15 UTC.