Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 7, 2025

Investigation Summary

After thorough investigation, I've discovered that the $flagd.timestamp support is already fully implemented in the codebase:

What's Already Working:

  • Investigate repository structure and current implementation
  • Verify $flagd.timestamp is implemented in core/pkg/evaluator/json.go (line 360)
  • Verify $flagd.flagKey is implemented (line 359)
  • Confirm tests exist and pass for both properties (TestFlagdAmbientProperties)
  • Confirm documentation exists in multiple locations:
    • docs/reference/specifications/providers.md (line 225)
    • docs/reference/flag-definitions.md
    • docs/architecture-decisions/flag-configuration.md
    • docs/architecture-decisions/fractional.md
    • docs/reference/custom-operations/fractional-operation.md

Property Naming Verification:

The naming is correct per specification:

  • Properties are stored as $flagd: {flagKey: "...", timestamp: ...} in JSON
  • JsonLogic accesses them as $flagd.flagKey and $flagd.timestamp using dot notation
  • This matches the schema pattern in docs/schema/v0/targeting.json (line 54)

Remaining Tasks:

  • Run full test suite to ensure everything passes
  • Add additional documentation if needed (per requirement Update LICENSE #3)
  • Create demonstration of the feature working
  • Run code review and security checks
Original prompt

This section details on the original issue you should resolve

<issue_title>Support for $flagd.timestamp is missing based on provider specification</issue_title>
<issue_description>## Problem

According to the provider specification (docs/reference/specifications/providers.md), in-process flagd providers should inject $flagd.timestamp (a unix timestamp in seconds of the time of evaluation) into the JsonLogic evaluation context. However, it appears that support for this property is missing in current implementations.

Specification reference:

Property Description
$flagd.flagKey the identifier for the flag being evaluated
$flagd.timestamp a unix timestamp (in seconds) of the time of evaluation

Expected Behavior

  • $flagd. timestamp should be injected into the JsonLogic evaluation context, as described in the provider specification.

Observed Behavior

  • Providers do not currently inject $flagd.timestamp, which may cause targeting rules relying on this property to fail or behave incorrectly.

Steps to Reproduce

  1. Implement a custom targeting rule in JsonLogic that references $flagd.timestamp.
  2. Observe that the property is missing during flag evaluation.

Additional context

  • Provider specification file: [docs/reference/specifications/providers.md](https://github. com/open-feature/flagd/blob/main/docs/reference/specifications/providers.md)

Please add support for $flagd.timestamp in all relevant provider implementations.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@netlify
Copy link

netlify bot commented Dec 7, 2025

Deploy Preview for polite-licorice-3db33c canceled.

Name Link
🔨 Latest commit 4de1c26
🔍 Latest deploy log https://app.netlify.com/projects/polite-licorice-3db33c/deploys/6935de59051ba10008214818

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 7, 2025

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.

Support for $flagd.timestamp is missing based on provider specification

2 participants