@@ -51,6 +51,7 @@ import { I18nProvider } from '@object-ui/i18n';
5151import type { DataSource , DeclaredNode , ObjectGanttBlockNode } from '@object-ui/types' ;
5252import { safeValidateSchema } from '@object-ui/types/zod' ;
5353import { ObjectGantt } from './ObjectGantt' ;
54+ import { GANTT_FETCH_STEP } from './ganttRowWalk' ;
5455// Module scope, not a hook: this import IS the registration (AGENTS.md
5556// test-discipline section).
5657import './index' ;
@@ -322,14 +323,25 @@ describe('ObjectGantt.rowCeiling-7210', () => {
322323
323324 let calls : Array < Record < string , any > > = [ ] ;
324325
325- /** An adapter that HONOURS `$top`, the way a real one does. */
326- function makeDataSource ( storeSize : number ) {
326+ /**
327+ * An adapter that HONOURS `$top` and `$skip`, the way a real one does. With
328+ * `maxPageSize` it also refuses a `$top` over it, before reading anything,
329+ * the way a host with `OS_DATA_MAX_PAGE_SIZE` set does (hosted: 5,000).
330+ */
331+ function makeDataSource ( storeSize : number , maxPageSize ?: number ) {
327332 const store = makeRows ( storeSize ) ;
328333 return {
329334 find : vi . fn ( async ( _resource : string , params : any ) => {
330335 calls . push ( { ...( params ?? { } ) } ) ;
331336 const top = typeof params ?. $top === 'number' ? params . $top : store . length ;
332- return { data : store . slice ( 0 , top ) , total : store . length } ;
337+ if ( maxPageSize !== undefined && top > maxPageSize ) {
338+ throw new Error (
339+ `Query parameter 'top' asks for ${ top } rows; this deployment's maximum page size is ${ maxPageSize } . `
340+ + `The query was not run. Ask for at most ${ maxPageSize } rows and page with offset.` ,
341+ ) ;
342+ }
343+ const skip = typeof params ?. $skip === 'number' ? params . $skip : 0 ;
344+ return { data : store . slice ( skip , skip + top ) , total : store . length } ;
333345 } ) ,
334346 findOne : vi . fn ( ) ,
335347 create : vi . fn ( ) ,
@@ -374,12 +386,17 @@ describe('ObjectGantt.rowCeiling-7210', () => {
374386 ) ,
375387 ) ;
376388
377- // The fetch asked for one probe row past the ceiling — that is what makes
378- // the cut a fact about the rows in hand rather than a guess.
379- expect ( calls . length ) . toBeGreaterThan ( 0 ) ;
380- for ( const params of calls ) {
381- expect ( params . $top ) . toBe ( nonGridRowCeilingQuery ( GANTT_ROW_CEILING ) . $top ) ;
382- }
389+ // The walk read one probe row past the ceiling — that is what makes the
390+ // cut a fact about the rows in hand rather than a guess — and asked no
391+ // single read for more than one step (objectstack: a hosted maximum page
392+ // size refuses a `$top` of 10,001).
393+ const wanted = nonGridRowCeilingQuery ( GANTT_ROW_CEILING ) . $top ;
394+ const tops = calls . map ( ( params ) => params . $top ) ;
395+ expect ( tops . reduce ( ( sum , top ) => sum + top , 0 ) ) . toBe ( wanted ) ;
396+ for ( const top of tops ) expect ( top ) . toBeLessThanOrEqual ( GANTT_FETCH_STEP ) ;
397+ expect ( calls . map ( ( params ) => params . $skip ?? 0 ) ) . toEqual (
398+ tops . map ( ( _ , i ) => tops . slice ( 0 , i ) . reduce ( ( sum , top ) => sum + top , 0 ) ) ,
399+ ) ;
383400
384401 // ⭐ The half the ruling cares about: the truncation is NOT silent.
385402 const note = await screen . findByRole ( 'note' ) ;
@@ -410,11 +427,60 @@ describe('ObjectGantt.rowCeiling-7210', () => {
410427 ) ;
411428 expect ( calls . length ) . toBeGreaterThan ( 0 ) ;
412429 for ( const params of calls ) {
413- expect ( params . $top ) . toBe ( GANTT_ROW_CEILING + 1 ) ;
430+ expect ( params . $top ) . toBe ( GANTT_FETCH_STEP ) ;
414431 }
415432 expect ( screen . queryByRole ( 'note' ) ) . toBeNull ( ) ;
416433 } ) ;
417434
435+ /**
436+ * objectstack — the hosted refusal. A host with a maximum page size (the
437+ * hosted plane sets `OS_DATA_MAX_PAGE_SIZE` to 5,000) refuses a `$top`
438+ * over it before running the query, so a single read of the ceiling plus
439+ * its probe row (10,001) put the refusal in place of the chart, on an
440+ * EMPTY object as on a full one.
441+ *
442+ * REVERSE VERIFICATION: sending `...nonGridRowCeilingQuery(GANTT_ROW_CEILING)`
443+ * as one read again turns all three of these red at the drawn count, with
444+ * the refusal on screen.
445+ */
446+ describe ( 'a host with a maximum page size of 5,000' , ( ) => {
447+ const HOSTED_MAX_PAGE_SIZE = 5000 ;
448+
449+ it ( 'draws an empty object instead of the refusal' , async ( ) => {
450+ render ( < ObjectGantt schema = { schema } dataSource = { makeDataSource ( 0 , HOSTED_MAX_PAGE_SIZE ) } /> ) ;
451+
452+ await waitFor ( ( ) =>
453+ expect ( screen . getByTestId ( 'gantt-view' ) . getAttribute ( 'data-task-count' ) ) . toBe ( '0' ) ,
454+ ) ;
455+ expect ( screen . queryByText ( / m a x i m u m p a g e s i z e / ) ) . toBeNull ( ) ;
456+ expect ( calls ) . toHaveLength ( 1 ) ;
457+ } ) ;
458+
459+ it ( 'draws a set larger than one host page, every row' , async ( ) => {
460+ const rows = HOSTED_MAX_PAGE_SIZE + 1234 ;
461+ render ( < ObjectGantt schema = { schema } dataSource = { makeDataSource ( rows , HOSTED_MAX_PAGE_SIZE ) } /> ) ;
462+
463+ await waitFor ( ( ) =>
464+ expect ( screen . getByTestId ( 'gantt-view' ) . getAttribute ( 'data-task-count' ) ) . toBe ( String ( rows ) ) ,
465+ ) ;
466+ expect ( screen . queryByRole ( 'note' ) ) . toBeNull ( ) ;
467+ for ( const params of calls ) expect ( params . $top ) . toBeLessThanOrEqual ( HOSTED_MAX_PAGE_SIZE ) ;
468+ } ) ;
469+
470+ it ( 'past the gantt ceiling: draws the ceiling and still says so' , async ( ) => {
471+ render ( < ObjectGantt schema = { schema } dataSource = { makeDataSource ( TOTAL_ROWS , HOSTED_MAX_PAGE_SIZE ) } /> ) ;
472+
473+ await waitFor ( ( ) =>
474+ expect ( screen . getByTestId ( 'gantt-view' ) . getAttribute ( 'data-task-count' ) ) . toBe (
475+ String ( GANTT_ROW_CEILING ) ,
476+ ) ,
477+ ) ;
478+ const note = await screen . findByRole ( 'note' ) ;
479+ expect ( note . textContent ) . toContain ( String ( GANTT_ROW_CEILING ) ) ;
480+ expect ( note . textContent ) . toContain ( String ( TOTAL_ROWS ) ) ;
481+ } ) ;
482+ } ) ;
483+
418484 /**
419485 * Ruling B keeps ruling a′'s "not authorable": an authored
420486 * `pagination.pageSize` (or `limit`) does not reach the gantt's query in
@@ -432,7 +498,7 @@ describe('ObjectGantt.rowCeiling-7210', () => {
432498 expect ( screen . getByTestId ( 'gantt-view' ) . getAttribute ( 'data-task-count' ) ) . toBe ( '4999' ) ,
433499 ) ;
434500 for ( const params of calls ) {
435- expect ( params . $top ) . toBe ( GANTT_ROW_CEILING + 1 ) ;
501+ expect ( params . $top ) . toBe ( GANTT_FETCH_STEP ) ;
436502 }
437503 expect ( screen . queryByRole ( 'note' ) ) . toBeNull ( ) ;
438504 unmount ( ) ;
@@ -641,10 +707,11 @@ describe('ObjectGantt.hostDataProp-7210', () => {
641707 await waitFor ( ( ) => expect ( calls . length ) . toBeGreaterThan ( 0 ) ) ;
642708
643709 for ( const params of calls ) {
644- // Not `pagination.pageSize` (2), and not absent either: the platform
645- // ceiling, one probe row wide so the cut is detectable.
710+ // Not `pagination.pageSize` (2), and not absent either: the walk's
711+ // first step toward the platform ceiling. Five rows answer it short,
712+ // so it is the only read.
646713 expect ( params . $top ) . not . toBe ( 2 ) ;
647- expect ( params . $top ) . toBe ( nonGridRowCeilingQuery ( GANTT_ROW_CEILING ) . $top ) ;
714+ expect ( params . $top ) . toBe ( GANTT_FETCH_STEP ) ;
648715 expect ( params . $skip ) . toBeUndefined ( ) ;
649716 }
650717 } ) ;
0 commit comments