feat(tiles): the grid holds at most 6 tiles (owner decision 7)

Six was tested smooth on the owner's desktop; nine missed the headless
frame bar and is untested on real hardware. TILE_GRID_MAX (constants.js)
is now 6 and stays the one cap every limit reads; the layout table gets
its own bound, TILE_LAYOUT_MAX = 9, so the 7 to 9 layouts keep working
(unreachable) and going back to nine is that one line.

Every way in stops at the cap: opening, addTile, a tile's +, a session
Run makes, Ctrl/Cmd+click, the picker, "Open group as tiles", and a stored
grid with more ids (it comes back as its first six, focus kept only if it
survives, a dropped zoom cleared, row fractions that no longer match the
3x2 reset). The limits now go through one helper, _tileGridLimit(), whose
texts say which limit binds: "Up to 6 tiles" / "The grid holds at most 6
tiles" when it is the cap, "This window fits N" when it is the window.

Docs: decision 7 and an as-built entry in the spec, CLAUDE.md, the
invariants, the wiki's Tile Grid and Dashboard pages.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer
2026-10-06 23:18:29 +02:00
parent 21beacf700
commit d2e72143e8
10 changed files with 217 additions and 32 deletions
+14
View File
@@ -152,6 +152,20 @@ describe('page load with a stored open grid', () => {
expect(app.activeSessionId).toBe('s-b');
});
it('a stored 3x3 (before the cap of 6) comes back as its first six, focus kept, a dropped zoom cleared', () => {
const nine = Array.from({ length: 9 }, (_, i) => `n-${i + 1}`);
storeGrid({ ids: nine, focused: 'n-5', zoomed: 'n-8', colFr: [2, 1, 1], rowFr: [1, 1, 1] });
const app = pageLoad(nine);
expect(app._tileGrid.ids).toEqual(nine.slice(0, 6));
expect(FakeTile.all.filter((t) => !t._destroyed)).toHaveLength(6);
expect(app.activeSessionId).toBe('n-5');
expect(app._tileGrid.zoomedId).toBeNull();
// 3x2 now: the columns still match, the three stored rows do not.
expect(app._tileGrid.colFr).toEqual([2, 1, 1]);
expect(app._tileGrid.rowFr).toEqual([1, 1]);
expect(stored().ids).toEqual(nine.slice(0, 6));
});
it('a stored closed grid leaves the single view, and the Tiles toggle brings it back', () => {
localStore.set(KEY, JSON.stringify({ v: 1, open: false, ids: ['s-b', 's-c'], focused: 's-c' }));
const app = pageLoad(IDS, (a) => localStore.set('codeman-active-session', 's-a'));