Skip to content

Studio: make the drag preferences test compile, and ask the stricter question - #11503

Merged
danielhanchen merged 1 commit into
mainfrom
ci/sidebar-drag-test-typechecks
Sep 22, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/sidebar-drag-test-typechecks

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What

Frontend build + bundle sanity is red on main, and on every PR that inherits it (11501, 11500, 11489, 11486, 11485):

tests/sidebar-row-drag.test.ts(906,17): error TS2352: Conversion of type
'SidebarOrganizationState' to type 'Record<string, unknown>' may be a mistake
because neither type sufficiently overlaps with the other.
  Index signature for type 'string' is missing in type 'SidebarOrganizationState'.

Where it came from

git blame puts the line in #11441 (432b4db69), which added both this test and the store change it guards. That PR's own Frontend build + bundle sanity lane failed, so main inherited the break rather than the test ever having worked.

Which side is wrong

The PR's intent is right and stays: dragHints, reorderSwitchesSort and dragOpensFolders are gone on purpose and must not come back.

What is wrong is only the test's cast. SidebarOrganizationState has no index signature, so as Record<string, unknown> is a conversion tsc refuses outright, and a test that does not compile guards nothing.

The change

Rather than widen the cast through unknown, the loop now asks key in state. That needs no cast at all, and it is the stricter question: the old indexed read also passed for a key that came back holding undefined, which is still the key being back in the store.

Test-only. No product file is touched.

Verification

  • tsc -p tsconfig.test.json and tsc -b are both clean, where the first failed before.
  • The file is 25 passed under node --experimental-strip-types --test.
  • Sabotage check: putting dragHints back on the interface and in the store's initial state fails this test with dragHints is back in the store.

Frontend build + bundle sanity is red on main and on every PR that inherits it:

  tests/sidebar-row-drag.test.ts(906,17): error TS2352: Conversion of type
  'SidebarOrganizationState' to type 'Record<string, unknown>' may be a mistake
  because neither type sufficiently overlaps with the other.
    Index signature for type 'string' is missing in type 'SidebarOrganizationState'.

Introduced by #11441 (432b4db), which added both the test and the store change
it guards. Its own Frontend build lane failed at the time, so main inherited it.

The PR's intent is right: the three drag preference keys are gone on purpose and
should not come back. What is wrong is only the test's cast. SidebarOrganizationState
has no index signature, so `as Record<string, unknown>` is a conversion tsc refuses,
and a test that does not compile guards nothing.

Rather than widen the cast through unknown, the loop now asks `key in state`. That
needs no cast at all, and it is the stricter question: the old indexed read also
passed for a key that came back holding undefined, which is still the key being
back in the store.

Verified: tsc -p tsconfig.test.json and tsc -b are both clean, where the first
failed before, and the file is 25 passed under node --test. Sabotage check:
putting dragHints back on the interface and in the initial state fails this test
with "dragHints is back in the store".
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-22T03:56:11.279224Z 7262575 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 22, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Sep 22, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 7262575008

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 5e04590 into main Sep 22, 2026
44 of 48 checks passed
@danielhanchen
danielhanchen deleted the ci/sidebar-drag-test-typechecks branch September 22, 2026 04:38
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…unslothai#11503)

Frontend build + bundle sanity is red on main and on every PR that inherits it:

  tests/sidebar-row-drag.test.ts(906,17): error TS2352: Conversion of type
  'SidebarOrganizationState' to type 'Record<string, unknown>' may be a mistake
  because neither type sufficiently overlaps with the other.
    Index signature for type 'string' is missing in type 'SidebarOrganizationState'.

Introduced by unslothai#11441 (432b4db), which added both the test and the store change
it guards. Its own Frontend build lane failed at the time, so main inherited it.

The PR's intent is right: the three drag preference keys are gone on purpose and
should not come back. What is wrong is only the test's cast. SidebarOrganizationState
has no index signature, so `as Record<string, unknown>` is a conversion tsc refuses,
and a test that does not compile guards nothing.

Rather than widen the cast through unknown, the loop now asks `key in state`. That
needs no cast at all, and it is the stricter question: the old indexed read also
passed for a key that came back holding undefined, which is still the key being
back in the store.

Verified: tsc -p tsconfig.test.json and tsc -b are both clean, where the first
failed before, and the file is 25 passed under node --test. Sabotage check:
putting dragHints back on the interface and in the initial state fails this test
with "dragHints is back in the store".
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.

1 participant