qdb Platform Docs Download

Repository source: docs/plans/layered_interface/layered_interface_step4_implementation_summary.md

Feature plan: Step 1 · Step 2 · Step 3 · Step 4

Layered interface: Step 4 implementation summary

Planning commits verified on plans/layered-interface: Step 1 (314490a), Step 2 (994a7e4), Step 3 (a01f140). The branch is not pushed yet: repository access for this session is pending.

Stage 1 - settings, flag and /layer.css

  • Changes:

    • New src/ForumRewrite/View/LayerSetting.php. It holds the cookie format (<beginner>.<advanced>.<set-at ms>), the defaults (beginner on, advanced off), the hiding rules, and the comment explaining why the setting lives in a cookie and in localStorage.

    • New site profile setting layeredInterface, validated as a boolean, read through SiteProfileRegistry::layeredInterface(), and on only for mitrapclub.

    • New flag FORUM_LAYERED_INTERFACE_ENABLED in the Experience group. It is on by default but only acts where the profile offers it, following the Music slides pattern.

    • New storage key layerStorageKey (forum-<namespace>-layer) in BrowserRuntimeProfile.php.

    • New /layer.css route in Application.php, sent as text/css, Cache-Control: private, no-store and Vary: Cookie. It sits next to /llms.txt, before content routing.

    • templates/layout.php links /layer.css right after the theme stylesheet when the feature is on.

  • Deviation from Step 3: the class names carry a layer- prefix (layer-beginner, layer-advanced, layer-advanced-beginner) so they cannot collide with existing names such as account-key-advanced. No elements use them yet, so nothing visible changes.

  • Verification:

    • Passed: new LayerSettingTest (5 tests). It covers the cookie round trip and bad values, the hiding rules for all four switch combinations, mitrapclub as the only offering profile, the per-site storage key, and the route and page link on mitrapclub with the flag on and off and on ZenMemes.

    • Passed: smoke set plus SiteProfileRegistryTest, FeatureFlagEvaluatorTest, FeatureFlagsBehaviorTest, FeatureFlagChangePageTest, FastNavigationLayoutTest and LocalAppSmokeTest. FeatureFlagEvaluatorTest::testRegistryListsCurrentPublicFlags needed the new flag added to its expected list.

    • Checked by reading public/.htaccess: no static or high-traffic rule matches /layer.css, so it always reaches PHP.

    • Not run: the full suite, which is left to Ilya.

    • Not testable in CLI: response headers. They were checked by reading the route.

  • Notes: the page HTML is the same for every cookie. The test asserts this on /about/.

— Claude · 2026-12-04 UTC

Stage 1 revision (Ilya, by voice)

  • The flag is now available to every site and off by default, instead of being tied to the mitrapclub profile. The layeredInterface profile setting was removed. mitrapclub turns the flag on through its Feature Flags page.

  • The layer assignments in layered_interface_base_inventory.md are the default for every site. Per-site assignments come later. Copy changes such as Users → "Crew" stay mitrapclub only.

  • Verification: LayerSettingTest now checks mitrapclub and ZenMemes the same way: off by default, on with the flag, and page HTML identical across cookies. It passes together with FeatureFlagEvaluatorTest and SiteProfileRegistryTest (44 tests).

— Revised by Claude · 2026-12-04 UTC

Stage 2 - content groups and the default base view

  • Changes:

    • Layer classes follow layered_interface_base_inventory.md. Templates add them through LayerSetting::cls() only while the flag is on, so sites without it render exactly as before.

    • Advanced: the new-version banner (its Reload button), Board and Recent in the nav, the theme widget (menu and palette colours), the board controls (board-controls-nav and ZenMemes' board-toolbar), the View query footer, the per-post Reply link and menu item, the thread Activity drawer, the item page's top section, and the Records drawer.

    • Beginner: About in the nav.

    • New on the item page, base and only while the flag is on: a plain "Back to thread" link above the advanced top section.

    • LayerSetting::NAV_LAYERS holds the default nav layers by section. Per-site overrides come later.

  • Deferred, waiting on Ilya's wording: the beginner shortcuts that replace the board controls (inventory 16a) and the mitrapclub-only rename of Users to "Crew".

  • Note: the inventory's "Reload button" (item 1) is the new-version banner's Reload. It is marked as one unit with its banner.

  • Verification:

    • Passed: LayerSettingTest on mitrapclub and ZenMemes. It checks the board controls, Board and About nav classes, the theme widget, the item page back link and top section, and no back link with the flag off.

    • Passed: smoke set plus AppNavigationPlacementTest, BacklogPageTest, BoardListTest, CalendarPageTest, FeatureFlagChangePageTest, GalleryPageTest, LocalAppSmokeTest, PostSignalsTemplateTest, PreferencesPageTest, PresentationProfileMatrixTest, PrivateMessageReleaseIsolationTest, QuoteCardDisplayNumberTest, UsersDirectorySortTest, VersionCheckBehaviorTest, FeatureFlagEvaluatorTest and SiteProfileRegistryTest: 616 tests. An earlier draft that added the classes unconditionally broke six exact-markup tests; the conditional classes fixed all six without editing them.

    • Not run: the full suite, and the screenshots from Step 3. Those wait for a browser pass after Stage 3, when the π exists.

— Claude · 2026-12-04 UTC

Stage 3 - the π without JavaScript

  • Changes:

    • The π is a plain link in the bottom-right corner of every page while the flag is on (templates/layout.php). It has aria-label="Switch advanced view" and nothing visible besides the glyph, per Ilya. It sits outside the status bar, which screen readers skip.

    • New route /layer (Application.php). ?toggle=advanced flips advanced and leaves beginner as it is. ?beginner=0|1 sets beginner, ready for "I already know this stuff". The route writes the layer-hint cookie (two years, SameSite=Lax, Secure over HTTPS, readable by scripts for Stage 4) and redirects 303 to ?return=.

    • LayerSetting::safeReturnPath() keeps the return on this site. It rejects absolute URLs, //host, backslashes and control characters.

    • The π's look lives in /layer.css, so pages stay the same for every visitor. It is dim (opacity 0.25) with a 44px tap target, and lit (full opacity, theme link colour, bold) while advanced is on, hover and focus included.

  • Verification:

    • Passed: LayerSettingTest (7 tests). It covers the switch logic, cookie header, return path checks, π styles, the π link on the item page, the route answering on and off, and no π and no route with the flag off.

    • Passed: new tests/browser/layer_switch.mjs in Chromium at 375×667, with scripts off and on. The item page starts basic (top section hidden, Back to thread shown) and the π measures at least 44px and is dim. A click turns advanced on, shows the top section and lights the π. Tab reaches the π, and Enter turns advanced off again.

    • Passed: smoke set plus AppNavigationPlacementTest, BoardListTest, GalleryPageTest, LocalAppSmokeTest, PostSignalsTemplateTest, PresentationProfileMatrixTest, VersionCheckBehaviorTest and FeatureFlagEvaluatorTest (537 tests).

    • Not run: the full suite.

  • Found and fixed while testing: the hover rule dimmed the lit π right after a click. The lit rule now covers hover and focus too.

— Claude · 2026-12-04 UTC

Stage 4 - instant switching and tabs in step

  • Changes:

    • New public/assets/layer_switch.js (loaded only while the flag is on). The π switches without a page load. It writes the cookie and localStorage with the same time, then loads the new /layer.css before dropping the old one, so nothing flashes. A storage listener refreshes other open tabs, the same approach as member_approval.js. It also handles data-layer-beginner links, ready for "I already know this stuff" in Stage 5. Modified clicks (new tab and so on) keep the plain link.

    • A head script in layout.php, right after the layer stylesheet, reconciles the two copies before paint. If localStorage is newer, it rewrites the cookie and reloads /layer.css if the setting differs. If the cookie is newer or localStorage is empty (as after iPhone Safari clears it), it rewrites localStorage. Blocked storage leaves the cookie alone.

    • Both files carry the "why both copies" comment.

  • Verification:

    • Passed: tests/browser/layer_switch.mjs, now with Stage 4 checks. With scripts, the π switches in the same document. A second tab followed in 22 ms. A newer localStorage value with no cookie restores advanced and rewrites the cookie. A newer cookie with localStorage cleared applies the cookie and rewrites localStorage. The no-script and scripted π checks from Stage 3 still pass.

    • Passed: LayerSettingTest (7) and the smoke set plus related tests (533).

    • Not run: the full suite.

— Claude · 2026-12-04 UTC

Stage 5 - beginner shortcuts, the ✕ and the π line

Approved by Ilya by voice ("I approve stage five"). Per the inventory, no beginner tips for now, so this stage is the shortcuts, their ✕ and the About line.

  • Changes:

    • New templates/partials/layer_shortcuts.php (inventory 16a), beginner layer, on the card board and the list board while the flag is on: "What's new" (/threads/?view=all&sort=newest) and "Most liked" (sort=top), wording as Ilya chose.

    • An "I already know this stuff" ✕ on the shortcuts: /layer?beginner=0&return=<this page>, with data-layer-beginner="0" so layer_switch.js makes it instant. It turns beginner off and leaves advanced alone. The route now answers "Beginner shortcuts off." for it.

    • mitrapclub's About adds "Where is everything? Did you click the π?" (layerHelpParagraph in ProfilePresentationContent), shown only while the flag is on.

    • Fix found in screenshots: the board controls left an empty card in the basic view. The card itself is now marked advanced too.

  • Verification:

    • Passed: LayerSettingTest (shortcut links and ✕ href, the route message, the π line on mitrapclub only, nothing with the flag off).

    • Passed: tests/browser/layer_switch.mjs, new checks with and without scripts: shortcuts show by default, ✕ has a 44px target, hides them, the cookie becomes 0.1.* and the advanced controls stay.

    • Passed: smoke set plus related tests. Screenshots at 375px on mitrapclub: board with beginner on and off, About.

    • Fixed a pre-existing failure, PlainSiteTest: /docs/ lists the plan folder calendar_test_zenmemes_zone, which the branding scan read as ZenMemes branding. The scan now skips plan folder links.

    • Not run: the full suite.

— Claude · 2026-12-04 UTC

Stage 6 - the iPhone replay, unchanged sites and the concept page

Approved by Ilya by voice ("Yes, please start stage six").

  • Changes:

    • tests/browser/layer_switch.mjs replays Ilya's iPhone case: the cookie says advanced and was set eight days ago, localStorage is empty. The page opens in advanced with the π lit before any click, rewrites localStorage from the cookie, and stays advanced after a reload.

    • New concept page docs/concepts/layer_setting.md: purpose, scenario, sources, the four groups, why the setting lives in two places, and what stays cacheable.

  • Verification:

    • Passed: the full browser script in Chromium (no scripts, scripts, tab sync in 16 ms, newer copy wins, iPhone replay, ✕ both ways).

    • Unchanged sites: rendered ten pages (board, thread, item, About, Recent, Users, Tools, QDB's Top and Latest) for ZenMemes, QDB and mitrapclub with the flag off, on this branch and on its base 62928f6. The only differences are the app version and one new entry in the page's runtime settings (layerStorageKey), which nothing reads while the flag is off. Markup is otherwise identical.

    • Concept page links checked against the tree.

    • Not run: the full suite, and a real Safari engine (Playwright here has Chromium only).

  • Pending, after deploy (Ilya's iPhone check):

    1. On mitrapclub, turn on the Layered interface flag in Tools → Feature Flags.

    2. On the iPhone, open the board. Expect "What's new" and "Most liked", no board controls, and a faint π in the bottom-right corner.

    3. Tap the π. The controls appear right away and the π lights up.

    4. Close Safari and come back later, or wait past a week. The board should open with the controls still showing.

    5. Tap the ✕ beside the shortcuts. They go away and the controls stay.

    6. Open About and check the "Did you click the π?" line.

— Claude · 2026-12-04 UTC