Skip to content

Conversation

@emsearcy
Copy link
Contributor

@emsearcy emsearcy commented Jan 6, 2026

Remove use of now_z macro, since Faker can provide the same (or sufficiently-similar) functionality.

Remove use of `now_z` macro, since Faker can provide the same (or
sufficiently-similar) functionality.

Signed-off-by: Eric Searcy <eric@linuxfoundation.org>
Copilot AI review requested due to automatic review settings January 6, 2026 19:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the custom now_z macro in favor of using Faker's built-in date/time generation capabilities for mock data.

  • Replaces the custom now_z lambda function with Faker's date_time_this_month method
  • Introduces tz_utc as a global variable to support timezone-aware datetime generation
  • Maintains the ISO 8601 format with "Z" suffix for UTC timestamps

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/lfx_v2_mockdata/__init__.py Removed the now_z lambda function from Jinja2 globals and added tz_utc (datetime.UTC) to support timezone-aware Faker date generation
playbooks/projects/recreate_root_project/root.yaml Updated the created_at timestamp generation to use fake.date_time_this_month() with timezone parameter instead of the removed now_z() macro

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

parent_uid: ""
stage: ""
{% set created_at = now_z() %}
{% set created_at = fake.date_time_this_month(False, False, tz_utc).isoformat().replace("+00:00", "Z") %}
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new fake.date_time_this_month() call includes a timezone parameter tz_utc, but other Faker date_time methods throughout the codebase (e.g., in board_meeting.yaml) do not pass a timezone parameter. This inconsistency could lead to timezone-related issues. Consider either: (1) adding timezone parameters to other Faker date_time calls, or (2) verifying that Faker's default behavior produces UTC timestamps that don't require explicit timezone handling.

Suggested change
{% set created_at = fake.date_time_this_month(False, False, tz_utc).isoformat().replace("+00:00", "Z") %}
{% set created_at = fake.date_time_this_month(False, False).isoformat().replace("+00:00", "Z") %}

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The others are technically zoneless objects for the current environment's time, which are treated as UTC without any actual conversion. So they do work OK for fake times, but there is a slight risk that past times might actually be later the same day, and vice versa. In #12 I've suggested that we add TZ=UTC to the setup-env so that the zoneless ones work better.

emsearcy and others added 2 commits January 6, 2026 11:29
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Eric Searcy <eric@linuxfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants