[clsi] address zod violations (#36199)

* [editor-core] gracefully handle no-op TextOperation

* [web] avoid sending sync to pdf requests without a ?file

* [validation-tools] log deeper nested violations

* [editor-core] fix round trip of EditNoOperation

* [web] use custom error for sync to pdf w/o file, fix tests

* [validation-tools] include request params in log msg for violation

* Revert "[editor-core] gracefully handle no-op TextOperation"

This reverts commit c1d37261d5db72b37dbf39428c54edcfb5423f41.

* [web] gracefully handle rejected sync to pdf from context menu

GitOrigin-RevId: 21de7dc96b23575b0d67b6eb0c68ed9c2f86292b
This commit is contained in:
Jakob Ackermann
2026-09-17 11:48:12 +00:00
committed by Copybot
parent 761d4efc1f
commit 731ed50f78
14 changed files with 254 additions and 16 deletions
@@ -65,6 +65,34 @@ const MockFileTreeDataProvider: FC<React.PropsWithChildren> = ({
value={
{
selectedEntities: [{ type: 'doc', id: '_root_doc_id' } as any],
fileTreeData: {
_id: 'root-folder-id',
name: 'rootFolder',
docs: [{ _id: docId, name: 'test.tex' }],
folders: [],
fileRefs: [],
},
} as any
}
>
{children}
</FileTreeDataContext.Provider>
)
const MockEmptyFileTreeDataProvider: FC<React.PropsWithChildren> = ({
children,
}) => (
<FileTreeDataContext.Provider
value={
{
selectedEntities: [{ type: 'doc', id: '_root_doc_id' } as any],
fileTreeData: {
_id: 'root-folder-id',
name: 'rootFolder',
docs: [],
folders: [],
fileRefs: [],
},
} as any
}
>
@@ -1008,6 +1036,46 @@ describe('editor context menu', { scrollBehavior: false }, function () {
})
})
it('should close the menu and show an error toast when there is no resolvable file path', function () {
const scope = mockScope()
cy.intercept(
'GET',
'/project/*/sync/code*',
cy.spy().as('syncToPdfRequest')
)
cy.mount(
<TestContainer>
<EditorProviders
scope={scope}
providers={{
DetachCompileProvider: MockDetachCompileProvider,
FileTreeDataProvider: MockEmptyFileTreeDataProvider,
}}
>
<GlobalToasts />
<CodeMirrorEditor />
</EditorProviders>
</TestContainer>
)
cy.get('.cm-line').eq(10).rightclick()
cy.findByRole('menu').within(() => {
cy.findByRole('menuitem', { name: /jump to location in pdf/i }).click()
})
cy.findByRole('menu').should('not.exist')
cy.get('.global-toasts').should(
'contain.text',
'That didn’t work. Try switching files and try again.'
)
cy.get('@syncToPdfRequest').should('not.have.been.called')
})
it('should hide button when visual preview is enabled', function () {
window.metaAttributesCache.set('ol-splitTestVariants', {
'editor-context-menu': 'enabled',