Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/calm-sdk-refresh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@platforma-open/milaboratories.graph-maker": patch
"@platforma-open/milaboratories.graph-maker.model": patch
"@platforma-open/milaboratories.graph-maker.ui": patch
"@platforma-open/milaboratories.graph-maker.workflow": patch
---

update sdk dependencies
9 changes: 8 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"fixed": [
[
"@platforma-open/milaboratories.graph-maker",
"@platforma-open/milaboratories.graph-maker.model",
"@platforma-open/milaboratories.graph-maker.ui",
"@platforma-open/milaboratories.graph-maker.workflow"
]
],
"linked": [],
"access": "restricted",
"baseBranch": "main",
Expand Down
7 changes: 7 additions & 0 deletions .changeset/quiet-ranges-apply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@platforma-open/milaboratories.graph-maker": patch
"@platforma-open/milaboratories.graph-maker.kind": patch
"@platforma-open/milaboratories.graph-maker.model": patch
---

Accept range filters with only one bound, or none, in template params
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
with:
app-name: 'Block: Graph Maker'
app-name-slug: 'block-graph-maker'
node-version: '22.x'
node-version: '24.22.1'
gha-runner-label: hz-ubuntu-dind
build-script-name: 'build:dev-local'
build-before-publish-script-name: 'build:release'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mark-stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: milaboratory/github-ci/.github/workflows/block-mark-stable.yaml@v4
with:
app-name: 'Block: Graph Maker - Mark Stable'
node-version: '22.x'
node-version: '24.22.1'
npmrc-config: |
{
"registries": {
Expand Down
2 changes: 1 addition & 1 deletion .structure
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":2}
{"version":3}
38 changes: 27 additions & 11 deletions kind/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,17 @@ export type SeedAesMapping = {
/** One chart input's binding, as a seed carries it. */
export type SeedSimpleSelector = { selectedSource: SourceId };

/**
* A range filter's bounds. Either may be unset — the editor's range chip starts with
* both empty, and pf-plots applies only the bounds that are set — so a seed carries
* exactly the ones the reader filled in.
*/
export type SeedFilterRange = { min?: number; max?: number };

/** A filtering input's binding: the source plus the filter set on it. */
export type SeedFilterSelector = SeedSimpleSelector & {
type: LiveFilterSelector["type"];
selectedFilterRange?: { min: number; max: number };
selectedFilterRange?: SeedFilterRange;
selectedFilterValues?: string[];
};

Expand Down Expand Up @@ -237,6 +244,17 @@ type _FilterTypesExhaustive = AssertNever<
Exclude<LiveFilterSelector["type"], (typeof FILTER_TYPES)[number]>
>;

/** One bound of a range filter. `null` reads as unset: it is what an unset or NaN bound becomes in JSON. */
function parseRangeBound(value: unknown, at: string): number | undefined {
if (value === undefined || value === null) {
return undefined;
}
if (typeof value !== "number" || !Number.isFinite(value)) {
throw new Error(`'${at}' must be a number when set.`);
}
return value;
}

function parseFilterSelector(value: unknown, at: string): SeedFilterSelector {
const { selectedSource } = parseSimpleSelector(value, at);
const { type, selectedFilterRange, selectedFilterValues } = value as Record<string, unknown>;
Expand All @@ -248,18 +266,16 @@ function parseFilterSelector(value: unknown, at: string): SeedFilterSelector {
const parsed: SeedFilterSelector = { selectedSource, type };

if (selectedFilterRange !== undefined) {
if (
!isRecord(selectedFilterRange) ||
typeof selectedFilterRange.min !== "number" ||
typeof selectedFilterRange.max !== "number"
) {
throw new Error(
`'${at}.selectedFilterRange' must be an object with numeric 'min' and 'max'.`,
);
if (!isRecord(selectedFilterRange)) {
throw new Error(`'${at}.selectedFilterRange' must be an object.`);
}
const min = parseRangeBound(selectedFilterRange.min, `${at}.selectedFilterRange.min`);
const max = parseRangeBound(selectedFilterRange.max, `${at}.selectedFilterRange.max`);
// Kept even with neither bound set: without a range object the editor's chip
// shows 0..0, and editing one bound would then save the other as 0.
parsed.selectedFilterRange = {
min: selectedFilterRange.min,
max: selectedFilterRange.max,
...(min === undefined ? {} : { min }),
...(max === undefined ? {} : { max }),
Comment on lines +272 to +278

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 New range cases lack tests

The existing test only runs a block without template parameters. It cannot catch partial ranges being rejected again or empty ranges being dropped. Add tests through kind.parseInitializationParams for min-only, max-only, empty, and null bounds. Also check that zero survives and strings and non-finite numbers are rejected.

Prompt To Fix With AI
This is a comment left during a code review.
Path: kind/src/index.ts
Line: 272-278

Comment:
**New range cases lack tests**

The existing test only runs a block without template parameters. It cannot catch partial ranges being rejected again or empty ranges being dropped. Add tests through `kind.parseInitializationParams` for min-only, max-only, empty, and null bounds. Also check that zero survives and strings and non-finite numbers are rejected.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

};
}

Expand Down
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,12 @@
"oxfmt": "*",
"oxlint": "*"
},
"packageManager": "pnpm@9.12.0"
"devEngines": {
"runtime": {
"name": "node",
"version": "24.22.1",
"onFail": "download"
}
},
"packageManager": "pnpm@12.16.1+sha512.091d1dee7927575661b25dab3c2ae31cafc1c54d6b71ed6a6600cf0c1cb10434a447eae14015f1b23e2e6bedeed79df94a932e2164d2832280dce3fb32f656d1"
}
Loading
Loading