Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dependencies, III.1]: Types for R Values #1518

Merged

Conversation

gigalasr
Copy link
Collaborator

No description provided.

@gigalasr gigalasr linked an issue Mar 25, 2025 that may be closed by this pull request
@gigalasr gigalasr changed the title 1496 dependencies iii1 types for r values [Dependencies, III.1]: Types for R Values Mar 25, 2025
@gigalasr gigalasr changed the base branch from main to vector-support-staging March 28, 2025 19:06
@gigalasr gigalasr marked this pull request as ready for review March 28, 2025 19:08
@gigalasr gigalasr requested a review from EagleoutIce March 28, 2025 19:08
Copy link
Member

@EagleoutIce EagleoutIce left a comment

Choose a reason for hiding this comment

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

I mean we definitely need more tests for this later, but for now this is great :D

@EagleoutIce EagleoutIce requested a review from Copilot March 30, 2025 16:42
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the handling of R values by introducing a new typesystem based on wrapped value sets, replacing raw primitives with structured constructs (e.g. Top, setFrom, and intervalFrom). The changes affect both test assertions and the resolution logic in various query and dataflow functions.

  • Updated test cases to assert results using setFrom and structured R values.
  • Modified value resolution functions across queries and dataflow to return wrapped types (ResolveResult) instead of raw or undefined values.
  • Adjusted stringification and evaluation functions to integrate with the new R value types.

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/functionality/slicing/static-program-slices/alias-tracking.test.ts Updated test expectations to use setFrom wrappers.
test/functionality/dataflow/query/resolve-value-query.test.ts Changed expected values from raw primitives to structured intervals/Top.
test/functionality/dataflow/environments/resolve.test.ts Modified assertions to compare against wrapped values.
src/queries/catalog/resolve-value-query/*.ts Switched to stringifyValue for printing R values.
src/queries/catalog/dependencies-query/dependencies-query-executor.ts Updated resolution logic to use valueSetGuard and convert values to strings.
src/dataflow/**/*.ts Revised built-in functions and evaluation to integrate new value conversions and guards.
src/dataflow/environments/resolve-by-name.ts Changed return types from unknown[] to ResolveResult and updated fallback returns.
src/dataflow/eval/values/**/*.ts Introduced new helper functions for handling strings, scalars, intervals, and sets.
src/dataflow/eval/values/general.ts Added conversion from TypeScript values to structured R values.
Comments suppressed due to low confidence (3)

src/queries/catalog/dependencies-query/dependencies-query-executor.ts:237

  • Confirm that converting resolved R values into a string array properly handles cases where values might not conform to the expected types. If non-string values occur, consider adding fallback logic or logging for clarity.
function resolveBasedOnConfig(data: BasicQueryData, vertex: DataflowGraphVertexFunctionCall, argument: RNodeWithParent, environment: REnvironmentInformation | undefined, idMap: Map<NodeId, RNode> | undefined, resolveValue : boolean | 'library' | undefined): string[] | undefined {

src/dataflow/environments/resolve-by-name.ts:182

  • Changing the return value from undefined to Top may affect downstream consumers; ensure that all call sites properly handle Top values to avoid unintended behavior.
export function trackAliasInEnvironments(identifier: Identifier | undefined, use: REnvironmentInformation, idMap?: AstIdMap): ResolveResult {

src/queries/catalog/resolve-value-query/resolve-value-query-executor.ts:23

  • Removing the fallback (using the nullish coalescing operator) may introduce runtime errors if resolveIdToValue returns Top (or an unexpected value). Consider handling or filtering undefined/Top cases before flatMapping.
.flatMap(ident => resolveIdToValue(ident, { graph, full: true, idMap: ast.idMap }));

@gigalasr gigalasr merged commit 20430b4 into vector-support-staging Apr 1, 2025
7 checks passed
@gigalasr gigalasr deleted the 1496-dependencies-iii1-types-for-r-values branch April 1, 2025 07:40
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.

[Dependencies, III.1]: Types for R Values
2 participants