fix(hr): compute tenure_years / time_off.days via daysBetween (#3306)#94
Draft
os-zhuang wants to merge 1 commit into
Draft
fix(hr): compute tenure_years / time_off.days via daysBetween (#3306)#94os-zhuang wants to merge 1 commit into
os-zhuang wants to merge 1 commit into
Conversation
The last two shipped formula fields that silently evaluated to null on the pinned runtime — the date-math ones left for the framework fix in #92/#93: - hr_time_off_request.days: `(end_date - start_date) + 1` (Timestamp−Timestamp → Duration, no `Duration + int`) → `daysBetween(start_date, end_date) + 1`. - hr_employee.tenure_years: `floor((today() - hire_date) / 365)` (unregistered `floor` + Timestamp−Timestamp) → `daysBetween(hire_date, today()) / 365` (integer division floors for a non-negative tenure). Both use the catalog date helpers and the null-guard idiom. Verified against the fixed engine: days=5 (inclusive), tenure=6. BLOCKED on framework#3348 publishing: these rewrites need the null-guard fix (`cond ? <int> : null`) that lands in @objectstack 16.x — on 15.1.1 they still null. Unblock: bump @objectstack/* deps to the release with #3348, then CI's `objectstack build` step (which runs validateStackExpressions) goes green and becomes the standing regression gate. Refs #3306. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs objectstack-ai/objectstack#3306. Draft — blocked on framework #3348 publishing.
The last two shipped
hrformula fields that silently evaluate tonullon the pinned runtime — the date-math ones explicitly left for the framework fix (siblings fixed in #92/#93):hr_time_off_request.days(end_date - start_date) + 1daysBetween(start_date, end_date) + 1hr_employee.tenure_yearsfloor((today() - hire_date) / 365)daysBetween(hire_date, today()) / 365Both
Timestamp − Timestamp(→ aDuration, noDuration + intoverload) andfloor(unregistered) faulted → null. The rewrites use the catalog date helpers + the null-guard idiom. Verified against the fixed engine:days = 5(inclusive),tenure_years = 6.These rewrites need the null-guard fix (
cond ? <int> : null, framework #3348) that lands in@objectstack16.x. On the current pin (15.1.1) they still null (and CI'sobjectstack buildmay reject the ternary). So:@objectstack/*16.x publishes@objectstack/*deps inpackages/hr(and the workspace) to that releasebuild(runsvalidateStackExpressions) is greenOnce bumped, the existing
objectstack buildstep is the regression gate the issue asked for — no new CI step needed. Framework #3348 makes it catch thedate − datesilent hole (os buildnow exits 1 on date arithmetic in a formula), so a broken date formula can never ship green again.🤖 Generated with Claude Code