The "After July 1" Condition: What I Learned Putting a Policy Effective Date in Code
Implementing the effective date of a points policy and per-server-environment conditions: a look at the reference time and policy version hiding behind a single date comparison.
Joohwan Yu · Founder, Full Stack Developer
Toris · Published
Contents
When I was tidying up the point award and deduction methods, there was a condition that performed the new handling only after July 1, 2025. There were also several action types, such as LOGIN, CNTNTS, GOOD, GET, and SUBSCRIBE. It started as a single date comparison, but looking back, it was the work of translating a policy into code.
I First Needed to Know Whose Date It Was
Having an effective date does not complete the rule. The time the user acted, the time the server received the request, and the creation date of the stored content are all different. For a reprocessed request, you also have to ask whether the execution time alone is enough to decide. Working through that condition, I felt that these criteria are not visible from the function name alone.
Today, I would state the reference time in the policy sentence. I would not use the same wording for “a request after the effective date” and “an event that occurred after the effective date.” Time zone and whether the boundary is inclusive must also be decided together. A date string looking familiar does not make the comparison basis clear.
Keeping Environment Branches from Hiding the Policy
There was also work that split conditions by serverType depending on the server environment. There are cases where environment differences are needed, but when business rules and deployment-environment rules get mixed in the same conditional, review becomes hard. “Does it not run because this is a test environment?” and “Is this not an award target under the policy?” have different causes even if the result is the same.
If I did it again, I would explain the award-target decision and whether it can actually be applied as separate things. For example, if the decision result records whether the user is a target and the reason for exclusion, an operator asking about a result no longer has to reread the whole conditional. This does not mean I had completed that structure at the time. It is a point I want to improve now, looking back.
What to Verify Is Not an Ordinary Day
You need to check the day before the effective date, the moment of taking effect, and just after, side by side. You also need to check that awards and deductions see the same policy at the same moment. If applicability differs per action type, a table combining date and type becomes the test list. A single ordinary-date case makes it hard to find boundary errors.
From this experience I learned that a policy change is not a patch that swaps a number or a date. You have to explain the point where the old rule and the new rule meet. Next time, before putting an effective date in code, I will first write in one sentence “which action, occurring when, does this apply to.”
Related record: Points and State Transitions
Advertisement