Skip to content

Compare effective times with epochMicros in TS Contradictions.settle - #167

Merged
arrry-hydraDB merged 1 commit into
hydra-db:mainfrom
kruschdev:fix/ts-settle-epoch-micros
Nov 16, 2026
Merged

arrry-hydraDB merged 1 commit into
hydra-db:mainfrom
kruschdev:fix/ts-settle-epoch-micros

Conversation

@kruschdev

@kruschdev kruschdev commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Use epochMicros for the effective-time comparisons in Contradictions.settle (typescript/src/ops.ts), including choosing the earliest displacer across capped endpoints and checking epochMicros(at) !== epochMicros(ended[1]) and epochMicros(at) < epochMicros(ended[1]) when updating already-ended relations.
  • Add sub-millisecond supersede coverage across both capped ends in typescript/test/temporal.test.ts and cross-language conformance (typescript/test/conformance/py_side.py and typescript/test/conformance/ts_side.ts).

Linked issue

Closes #158

AI Assistance

Model Effort
Gemini 4 Carbon / Hydrogen High

Checklist

  • Implements an issue a maintainer has /approved.
  • Small and scoped to that issue.
  • Breaking changes described below, or none.

Breaking changes

None.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@github-actions

Copy link
Copy Markdown

This is PR 2 of 3 you may keep open at a time.

@arrry-hydraDB arrry-hydraDB left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

check this

]);
}
return { warnings, versions };
await graph.insert.facts({

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This conflicts with main now. The withdrawn source block added there also creates person:cid, so please rebase and rename the people in this case, in py_side.py too.

@kruschdev

Copy link
Copy Markdown
Contributor Author

Rebased onto main and renamed the sub-millisecond conformance people in py_side.py and ts_side.ts so they do not collide with person:cid.

@kruschdev
kruschdev force-pushed the fix/ts-settle-epoch-micros branch from 14abf0a to e54f3d4 Compare November 16, 2026 10:01

@arrry-hydraDB arrry-hydraDB left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

check this

Comment thread typescript/src/ops.ts
const at = this.times.get(by)!;
if (!retired.has(old)) slots.push(old);
if (!retired.has(old) || at.getTime() < retired.get(old)![1].getTime()) {
if (!retired.has(old) || epochMicros(at) < epochMicros(retired.get(old)![1])) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The fix looks good. #58 just merged and the conformance files conflict now, so please rebase and keep both cases.

@kruschdev

Copy link
Copy Markdown
Contributor Author

Rebased onto main keeping both conformance cases with disjoint entities.

@kruschdev
kruschdev force-pushed the fix/ts-settle-epoch-micros branch from e54f3d4 to 478db6f Compare November 16, 2026 14:43

@arrry-hydraDB arrry-hydraDB left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@arrry-hydraDB
arrry-hydraDB merged commit db2d828 into hydra-db:main Nov 16, 2026
17 checks passed
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.

TypeScript SDK: Contradictions.settle compares millisecond getTime() instead of epochMicros, misordering sub-millisecond displacements

2 participants