Skip to content

fix: Disabled Policy Rule P3b Still Active in Code#254

Open
Tomeshwari-02 wants to merge 1 commit into
beckn:mainfrom
Tomeshwari-02:fix/disable-p3b-delivery-slot-rule
Open

fix: Disabled Policy Rule P3b Still Active in Code#254
Tomeshwari-02 wants to merge 1 commit into
beckn:mainfrom
Tomeshwari-02:fix/disable-p3b-delivery-slot-rule

Conversation

@Tomeshwari-02
Copy link
Copy Markdown

Summary

This PR fixes the mismatch reported in #249, where delivery slot duration validation was marked as disabled in comments but still executed in policy code.

What changed

  • Added a configuration toggle in specification/policies/p2p-trading-interdiscom.rego:
    • data.config.validateDeliverySlotDuration
  • Set default behavior to disabled:
    • validateDeliverySlotDuration = false
  • Gated both duration rules behind this toggle:
    • Order-side duration check (O3 mirror)
    • Publish-side duration check (P3b mirror)

Tests added

Updated specification/policies/p2p-trading-interdiscom_test.rego with regression tests to verify:

  • non-1-hour order duration does not fail when config is unset/default
  • non-1-hour publish duration does not fail when config is unset/default
  • both checks do fail when validateDeliverySlotDuration: true

Why this change

The policy comments explicitly state P3b is disabled, but the previous implementation still enforced exact 1-hour duration. This PR aligns runtime behavior with documented intent while preserving a safe path to re-enable strict validation via config.

Backward compatibility

  • Default behavior changes: exact 1-hour slot validation is now off unless explicitly enabled.
  • To restore prior strict behavior, set:
config:
  validateDeliverySlotDuration: true

Align policy behavior with the disabled P3b documentation by disabling exact 1-hour
slot validation by default and adding tests for both disabled and enabled modes.

Made-with: Cursor
Copy link
Copy Markdown
Collaborator

@ameetdesh ameetdesh left a comment

Choose a reason for hiding this comment

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

Suggest closing this PR, because the issue it is based on is not a real issue, but a stale typo in comment. That has since been fixed.

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.

2 participants