Skip to content

BE-522: HashQL: Expand stdlib type system with temporal types#8674

Open
indietyp wants to merge 4 commits into
bm/be-306-hashql-postgres-translationfrom
bm/be-522-hashql-expand-stdlib-type-definitions
Open

BE-522: HashQL: Expand stdlib type system with temporal types#8674
indietyp wants to merge 4 commits into
bm/be-306-hashql-postgres-translationfrom
bm/be-522-hashql-expand-stdlib-type-definitions

Conversation

@indietyp
Copy link
Copy Markdown
Member

🌟 What is the purpose of this PR?

This PR expands the HashQL standard library's temporal type system and refactors how standard library types are defined and exposed. The QueryTemporalAxes type, previously a stub in the graph module, is replaced with a fully-specified temporal module containing a rich set of temporal bound and interval types (Timestamp, TemporalBound, Interval, LeftClosedTemporalInterval, RightBoundedTemporalInterval, PinnedTransactionTimeTemporalAxes, PinnedDecisionTimeTemporalAxes, QueryTemporalAxes, etc.). Entity types in the knowledge graph are updated to use real temporal metadata (using LeftClosedTemporalInterval) instead of opaque Unknown wrappers.

Alongside this, type construction logic is extracted into public types submodules for each standard library module, enabling external consumers to construct monomorphized type instances without going through the full module registration machinery. Several modules are made pub to support this. The ScratchPool allocator is introduced for multi-threaded bump allocation, and FromIn<&str, A> for Rc<str, A> is implemented. The RuntimeRepr symbol representation is refactored to use extern "C" unsized types and raw pointer field access to avoid provenance issues.

🔗 Related links

🔍 What does this change?

  • Introduces graph::temporal as a new standard library module with a full set of temporal types: Timestamp, DecisionTime, TransactionTime, UnboundedTemporalBound, InclusiveTemporalBound, ExclusiveTemporalBound, TemporalBound, FiniteTemporalBound, OpenTemporalBound, Interval, LeftClosedTemporalInterval, RightBoundedTemporalInterval, PinnedTransactionTimeTemporalAxes, PinnedDecisionTimeTemporalAxes, and QueryTemporalAxes.
  • Removes the stub QueryTemporalAxes (previously an empty opaque struct) from graph::Graph and moves it to the new temporal module.
  • Updates entity knowledge types to depend on graph::temporal::Temporal and use LeftClosedTemporalInterval for TemporalMetadata instead of an opaque Unknown wrapper.
  • Extracts type construction into public types submodules for core::option, core::url, core::uuid, graph::temporal, graph::types::ontology, graph::types::principal::actor_group, graph::types::principal::actor_group::web, and graph::types::knowledge::entity, each accepting optional dependency structs for injection.
  • Makes std_lib, std_lib::core, std_lib::graph, graph::types, graph::types::knowledge, graph::types::ontology, graph::types::principal, graph::types::principal::actor_group, graph::types::principal::actor_group::web, graph::temporal, module::std_lib, and module::std_lib::core::option/url/uuid public.
  • Adds ScratchPool and ScratchPoolGuard to the heap module, providing a Sync-capable pool of bump allocators backed by bump_scope::BumpPool.
  • Implements FromIn<&str, A> for Rc<str, A> with tests covering unicode, empty strings, and clone sharing.
  • Refactors RuntimeRepr to use an extern "C" unsized Unsize type and raw pointer field access (&raw const/mut) to avoid provenance narrowing issues, replacing str_from_raw_parts with str::from_utf8_unchecked and get_mut_unchecked/extern_types nightly features.
  • Migrates string literals used as symbol names and type paths to sym:: constants throughout, eliminating most heap.intern_symbol("...") calls.
  • Adds many new entries to the sym symbol table, including type names, field names, and fully-qualified path symbols for all new and existing types.

🛡 What tests cover this?

  • New unit tests for FromIn<&str, A> for Rc<str, A>: basic conversion, unicode, empty string, and clone pointer equality.
  • Existing standard library module integration tests cover the updated type definitions.

❓ How to test this?

  1. Run cargo test -p hashql-core and confirm all tests pass.
  2. Verify that the temporal module types are accessible and correctly structured via the standard library manifest.

feat: make Int size aware

feat: postgres serialization

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: errors

feat: psql codec

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: move bridge -> orchestrator

feat: move bridge -> orchestrator

feat: organize the runtime a bit more

feat: organize the runtime a bit more

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: checkpoint

feat: organize the runtime a bit more

feat: finish orchestrator first version

feat: finish orchestrator first version

feat: feat: move out suspension requests to own module

chore: clippy

feat: split out into more manageable functions

feat: split out into more manageable functions

chore: orchestrator docs

feat: organize the runtime a bit more

feat: test orchestrator

feat: better symbol repr

feat: orchestrator test harness

feat: orchestrator test harness

feat: orchestrator test harness

feat: orchestrator test harness

feat: orchestrator test harness

feat: test orchestrator

feat: pipeline

feat: bless snapshots

chore: tests

chore: masking

chore: tests

fix: SSA repair

chiore: ssa repair snapshots

feat: orchestrator test harness

chore: remove spec

fix: library features

chore: update snapshots

chore: update docs
@vercel vercel Bot temporarily deployed to Preview – petrinaut April 29, 2026 14:05 Inactive
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment May 15, 2026 7:56am
petrinaut Ready Ready Preview May 15, 2026 7:56am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview May 15, 2026 7:56am

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 29, 2026

PR Summary

High Risk
High risk because it changes core stdlib type definitions (including QueryTemporalAxes and entity metadata shapes) and refactors unsafe symbol allocation/provenance handling, which can impact type-checking and runtime behavior broadly.

Overview
Introduces a fully-specified graph::temporal standard library module (bounds, intervals, pinned axes, and QueryTemporalAxes), removing the previous QueryTemporalAxes stub from graph and updating graph APIs/tests to use the new union type.

Refactors stdlib type definitions to expose reusable types constructor submodules (and makes several stdlib modules public), then rewires knowledge/ontology/principal/entity types to build from these constructors (including replacing entity EntityRecordId/opaque temporal wrappers with concrete RecordId + TemporalMetadata built from LeftClosedTemporalInterval).

Adds new heap capabilities (ScratchPool for multi-threaded bump allocation and FromIn<&str, A> for Rc<str, A> with tests), and reworks RuntimeRepr symbol representation/allocation to use an unsized extern marker plus raw-pointer field access to avoid provenance issues; various test snapshots are updated accordingly.

Reviewed by Cursor Bugbot for commit 9047680. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Member Author

indietyp commented Apr 29, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vercel vercel Bot temporarily deployed to Preview – petrinaut April 29, 2026 14:09 Inactive
@github-actions github-actions Bot added the area/tests New or updated tests label Apr 29, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 29, 2026

Merging this PR will degrade performance by 16.4%

❌ 2 (👁 2) regressed benchmarks
✅ 78 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
👁 pattern_match_constant 180 ns 209.2 ns -13.94%
👁 unique[100] 20 µs 24.6 µs -18.79%

Comparing bm/be-522-hashql-expand-stdlib-type-definitions (89ae7c2) with bm/be-306-hashql-postgres-translation (1faeb5c)

Open in CodSpeed

Comment thread libs/@local/hashql/core/src/symbol/sym.rs
@indietyp indietyp changed the title BE-435: HashQL: Expand stdlib type system with temporal types BE-522: HashQL: Expand stdlib type system with temporal types Apr 29, 2026
Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread libs/@local/hashql/core/src/module/std_lib/core/url.rs
@indietyp indietyp force-pushed the bm/be-306-hashql-postgres-translation branch from c484cc9 to b399240 Compare May 4, 2026 11:34
@indietyp indietyp force-pushed the bm/be-522-hashql-expand-stdlib-type-definitions branch from deb5f19 to 7d9f781 Compare May 4, 2026 11:34
@indietyp indietyp force-pushed the bm/be-306-hashql-postgres-translation branch from b399240 to 966d6c1 Compare May 8, 2026 08:33
@indietyp indietyp force-pushed the bm/be-522-hashql-expand-stdlib-type-definitions branch from 7d9f781 to 08c277c Compare May 8, 2026 08:33
@indietyp indietyp force-pushed the bm/be-306-hashql-postgres-translation branch from 966d6c1 to 80d2eaf Compare May 11, 2026 10:58
@indietyp indietyp force-pushed the bm/be-522-hashql-expand-stdlib-type-definitions branch from 08c277c to 3cb3bf5 Compare May 11, 2026 10:58
@indietyp indietyp force-pushed the bm/be-522-hashql-expand-stdlib-type-definitions branch from 3cb3bf5 to dd10bcf Compare May 12, 2026 13:58
@indietyp indietyp force-pushed the bm/be-306-hashql-postgres-translation branch from 80d2eaf to 6e468bc Compare May 12, 2026 13:58
@indietyp indietyp force-pushed the bm/be-522-hashql-expand-stdlib-type-definitions branch from dd10bcf to ffd9997 Compare May 13, 2026 09:38
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ffd9997. Configure here.

Comment thread libs/@local/hashql/core/src/module/std_lib/core/url.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/libs Relates to first-party libraries/crates/packages (area) area/tests New or updated tests type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

1 participant