diff --git a/DEFINITION_OF_DONE.md b/DEFINITION_OF_DONE.md new file mode 100644 index 00000000..b8adde88 --- /dev/null +++ b/DEFINITION_OF_DONE.md @@ -0,0 +1,75 @@ +# Definition of Done + +This is the completion contract for every change in this repository. A change is done only when every applicable gate below passes. It is linked from the root `CLAUDE.md` and draws on all nested `CLAUDE.md` files; where a nested file states a stricter rule for its subsystem, the stricter rule wins. + +## 1. Universal gates (every change) + +1. **Exact, minimal diffs.** Edit existing files; create a new file only when the change genuinely needs a home. No unrelated edits, no drive-by refactors. +2. **DRY, one choke point.** If the behaviour already exists somewhere, reuse it through the existing choke point; never add a second implementation, second focus system, second removal path, second suspension check, second consent gate, second terms check, second proxy, second bulk mechanism, or second query on a different basis. A per-type copy of shared logic is a defect. +3. **A specification exists somewhere.** Literally everything has a declared spec: a `spec.py` single source of truth, a registry (`REPORTABLE_TARGETS`, `DOCS_PAGES`, `NOTIFICATION_TYPES`, `GATEWAY_APPS`, `CUSTOMIZATION_PREF_COLUMNS`), a table in a `CLAUDE.md`, or an explicit decision section. The new behaviour is declared in it, not just implemented. +4. **Zero tolerance for inconsistency.** New code matches existing implementation structurally and visually. Before modifying, find the relatable example; if none exists, explain and let the user decide how to continue. +5. **The four faces.** Every feature is one data source fanning out into HTML, JSON (`respond(..., model=XOut)`, and a context key not on the `*Out` schema is silently dropped from JSON), a Devii agent action, and documentation. State each face explicitly, including "no change" where that is the decision. +6. **Import gate and static checks.** `python -c "from devplacepy.main import app"` imports clean; `pyflakes`/`ruff` on every touched file is clean (module-level load order and missing function-level imports are invisible to the other checks). Check each touched language manually (Python compiles/imports, JS parses, CSS braces and HTML tags balance). +7. **Full suite green.** `make test` (unit + api + e2e, serial, one pass) passes with no tier skipped and no subset substituted. Triage cheapest-first: `make test-fast`, then `make test-failed` until empty. A failing existing test is a contract to satisfy, never to skip, narrow (`-k`, `--deselect`), or rewrite to fit the change. +8. **Verification through the real path.** Real filesystem, real concurrency, real failure injection: bursts, races, and full disks are test cases, not weather. Re-running your own probe is not verification; the oracle must be independent (the repo's own tests, a golden file, a second method). +9. **Commit, deploy, verify, in that order, same session.** A change that is not running is not done. After deploy, verify live; green locally means nothing until prod confirms it. +10. **Production database untouched without explicit confirmation.** `data/devplace.db` and everything under `data/` is never read or written by an agent-initiated command without the user's own written confirmation plus the `I-HAVE-CONFIRMED-PRODUCTION-DB-ACCESS` token. Disposable verification scripts use `DEVPLACE_DATABASE_URL`/`DEVPLACE_DATA_DIR` on scratch files. +11. **No comments, no docstrings.** Code is self-documenting. No em dashes anywhere. +12. **Forbidden patterns respected.** No `_new`/`_old`/`_temp`/`_v2`/`better_`/`my_`/`the_` names; `RedirectResponse(url=..., status_code=302)` with an integer literal; no `is_admin`-style context key colliding with a Jinja global (use `viewer_is_admin`-style names); dates shown DD/MM/YYYY via `local_dt`/`dt_ago`. + +## 2. Tests (committed, reusable, in the mirrored tree) + +- HTTP tests under `tests/api//`, browser tests under `tests/e2e//`, pure-function tests under `tests/unit//`. Reuse `alice`/`bob`, `app_server`, `seeded_db`, `local_db`. +- Browser rules: every `page.goto`/`wait_for_url` passes `wait_until="domcontentloaded"`; prefer `locator().wait_for(state="visible")`; scope ambiguous selectors; restore global `site_settings` flips in `try/finally`. +- A behavior change keeps one focused failing-first test with the change, in the existing layout, using the existing fixtures. No new test framework. Throwaway probes stay out of the repo (and a `/tmp` probe never substitutes for the committed test). +- Never weaken a failing test to obtain green; fix the product or justify the expectation change. Observe the authentic failure before the fix when safe and runnable; run the focused test after the final edit; run the broad suite once, at the end. + +## 3. Concurrency and state-machine rigor (the four layers) + +For any spendable resource (coins, credits, quotas), bounded state machine (levels, tiers, counters with a floor/ceiling), or read-then-write mutation reachable from more than one worker, the persisted suite is not enough. Run, in order, as disposable scripts against a temp DB (never pytest files unless also requested): + +1. **Property checks** on every pure function over the full input domain (monotonicity, bounds, non-negativity, idempotency), iterating the real range, not spot checks. +2. **Stateful fuzzing**: many entities, long randomized action sequences, invariants re-checked after every action (balances never negative, monotonic counters never decrease, bounds never exceeded). +3. **Real multi-process races**: separate OS processes, never threads; production-representative state, never pre-seeded columns (NULL is not 0 in SQL, use `COALESCE`). Prove exact right-wins counts and hand-computed final totals. Fix with one atomic conditional SQL statement (`UPDATE ... WHERE `, real driver `rowcount`), never a client-side lock. +4. **Static analysis** beyond `py_compile`: `pyflakes`/`ruff` on every touched file. + +Single-process races do not count. Threads do not count. Luck does not count. + +## 4. Data layer + +- Every insert into a soft-deletable table writes `deleted_at: None, deleted_by: None`; every read filters `deleted_at IS NULL`. Toggles revive, never duplicate; cascades share one stamp; delete authz is owner-or-admin on the endpoint; GC stays hard. New user-generated tables are classified in `REPORTABLE_TARGETS` with `resolve_object_url` and `_report_button.html`, or in `UNREPORTABLE_TABLES` with a reason (the suite enforces this). +- `init_db` ensures the full column set of any table code filters on before creating indexes; new columns go through the ensure idiom plus the born-live pair, never bare DDL that misses pre-existing tables. +- Bounded, indexed reads: window functions over full-table loads, batch helpers over N+1, live-partial indexes built to plan without table scans. Nullable legacy columns need `COALESCE` in every precondition. +- Migrations: `init_db` is idempotent, guarded by locks, skipped seeds stay skipped (consumers pass defaults to `get_setting`, never assume the seed ran). Consent backfills are forbidden (never fabricate consent); `terms_version` stays NULL for legacy accounts. +- Runtime paths come only from `config.DATA_DIR` constants, never computed from scratch; blobs shard on uuid tail or hash, never the head. + +## 5. Routing, templates, frontend + +- Routers mirror the URL path (`routers/.py`, packages aggregate with `include_router`); route guards mirror auth needs (`require_user`, `require_admin`, `require_user_api`); public pages use `get_current_user`. Mutations are POST with `data-confirm`; deletes additionally allow any admin; seniority gates (`is_senior_admin`) bind Devii too. +- One shared `templates` instance; `nav_active` for nav state; `static_url`/`assetUrl` for every asset, never a bare `/static/` href; `dp-*` web components (no duplicates, real-button triggers inside popovers so no-JS stays correct, Escape closes); new JS reuses `Http`/`Poller`/`JobPoller`/`OptimisticAction`/`FloatingWindow`/`ScrollMemory`. +- Server pipeline renders content for SEO (`render_content`/`render_title`, with `local_dt`/`dt_ago` for timestamps); the client pipeline is only for live content (`DOMPurify` fail-closed). Notifications use `render_title`. Emoji shortcodes come from the one map; YouTube embeds follow `embeds.py` only; emails are masked; em dashes become hyphens. +- CSS: tokens from `variables.css` only (file-scoped `--x-*` palette block per new file, then `--color-*`/`--space-*`); `--z-*` bands; closed breakpoints; `prefers-reduced-motion` disables animation; no literals, no `var()` fallbacks, one radius per element, matching dark theme on first paint. + +## 6. Services and jobs + +- Background services run only in the lock owner, supervised with health checks and lock files; a new `JobService` needs a server restart and registers its kind. The DB row is the queue; retention is built in; cleanup decisions are per-kind and deliberate (disposable archive vs permanent artifact). +- Services report state through the one live-view relay row, audit through `record`/`record_system` with catalogued `events.md` keys (never raising into the caller), and telegram/push delivery never invents new channels. New websockets get their own nginx upgrade `location` above `location /`. +- New dependencies are unpinned only by deliberate exception; outbound HTTP goes through stealth with `net_guard` where untrusted; feature code never blocks the event loop (gateway-adjacent sync calls run in `to_thread`). + +## 7. AI, Devii, and money + +- The gateway is the single point of truth for AI: every consumer points at it, keys fall back to the internal key, spend is attributed and metered, financial figures are admin-only everywhere. Consent (`ai_third_party`) gates user-content calls at exactly one place; structured internal callers may bypass the operator preamble, conversational ones never do. +- Devii: every gated tool declares a `confirm` boolean (`additionalProperties: false` makes a gateless confirm fatal); classifier recall beats precision; budget-bounded tools with fail-closed redaction; lessons carry provenance and are never auto-applied from third-party content; channels stay isolated; self-dial uses the real origin URL. +- Economy and scoring invariants hold exactly: one pure function per number, atomic transitions only, recomputation beats counters, races proven with real processes (see section 3). + +## 8. Done means + +- [ ] Minimal diff, no unrelated edits; new files only with a home. +- [ ] One choke point reused; spec/registry updated; four faces stated. +- [ ] Import gate + `pyflakes`/`ruff` clean; per-language manual checks done. +- [ ] Committed reusable tests added/updated in the mirrored tree; focused failure observed before, passing after. +- [ ] Section 3 layers run where applicable (spendable resource, bounded state machine, multi-worker mutation). +- [ ] `make test` fully green; no tier skipped, no test narrowed or rewritten to fit. +- [ ] No production data touched; scratch DBs only. +- [ ] Docs touched where the behaviour is user-visible (`/docs` prose + `DOCS_PAGES`, `docs_api` groups, `events.md`, nested `CLAUDE.md` notes). +- [ ] Committed, deployed, verified live, same session. diff --git a/README.md b/README.md index 7fa2ce94..d997e4c6 100644 --- a/README.md +++ b/README.md @@ -1133,8 +1133,8 @@ every page load. `PushManager.js` owns registration, subscription, and the opt-i `manifest.json` (192/512 and maskable icons) and `service-worker.js` make the app installable via the browser's native install affordance. The service worker uses a -network-first strategy for navigations and falls back to `static/offline.html` when -offline. Installation requires a secure origin (HTTPS, or `localhost` for development). +network-first strategy for navigations, retries a failed navigation once, and falls +back to `static/offline.html` when both attempts fail. Installation requires a secure origin (HTTPS, or `localhost` for development). | File | Role | |------|------| diff --git a/devplacepy/database/__init__.py b/devplacepy/database/__init__.py index 740d951c..4871ccfa 100644 --- a/devplacepy/database/__init__.py +++ b/devplacepy/database/__init__.py @@ -32,7 +32,8 @@ from .seo_meta import SEO_META_TYPES, get_seo_metadata, get_seo_metadata_batch, from .activity import record_activity, record_unique_activity, get_user_activity, _activity_cache, _ACTIVITY_TABLES, get_activity_calendar, _activity_level, get_first_activity_date, HEATMAP_WEEKS, get_activity_heatmap, get_activity_months, get_streaks from .customization import CUSTOMIZATION_GLOBAL_SCOPE, CUSTOMIZATION_LANGS, _customizations_cache, _customization_key, CUSTOMIZATION_PREF_COLUMNS, get_customization_prefs, set_customization_pref, get_custom_overrides, get_custom_override, list_custom_overrides, set_custom_override, delete_custom_override from .email import EMAIL_ACCOUNT_DEFAULTS, list_email_accounts, get_email_account, set_email_account, delete_email_account -from .notifications import NOTIFICATION_TYPES, NOTIFICATION_CHANNELS, _NOTIFICATION_CHANNEL_COLUMNS, _NOTIFICATION_CHANNEL_DEFAULTS, _NOTIFICATION_TYPE_KEYS, _notification_prefs_cache, _notification_default, get_notification_default, set_notification_default, _notification_overrides, notification_enabled, get_notification_prefs, set_notification_pref, reset_notification_prefs, mark_notifications_read_by_target +from .notifications import NOTIFICATION_TYPES, NOTIFICATION_CHANNELS, _NOTIFICATION_CHANNEL_COLUMNS, _NOTIFICATION_CHANNEL_DEFAULTS, _NOTIFICATION_TYPE_KEYS, _notification_prefs_cache, _notification_default, get_notification_default, set_notification_default, _notification_overrides, notification_enabled, get_notification_prefs, set_notification_pref, reset_notification_prefs, mark_notifications_read_by_target, NOTIFICATION_GROUP_KEYS, notification_group_key, notification_throttle_key, get_notification_grouping_enabled, set_notification_grouping_enabled, get_notification_throttle_enabled, set_notification_throttle_enabled, count_unread_groups +from .enter_submit import get_enter_to_submit, set_enter_to_submit from .forks import record_fork, get_fork_parent, count_forks, soft_delete_fork_relations, delete_fork_relations from .follows import get_follow_counts, get_follow_list, get_following_among from .deepsearch import _ds_now, create_deepsearch_session, update_deepsearch_session, get_deepsearch_session, list_deepsearch_sessions, add_deepsearch_message, get_deepsearch_messages, get_cached_deepsearch_url, upsert_deepsearch_url_cache @@ -251,6 +252,16 @@ __all__ = [ "set_notification_pref", "reset_notification_prefs", "mark_notifications_read_by_target", + "NOTIFICATION_GROUP_KEYS", + "notification_group_key", + "notification_throttle_key", + "get_notification_grouping_enabled", + "set_notification_grouping_enabled", + "get_notification_throttle_enabled", + "set_notification_throttle_enabled", + "count_unread_groups", + "get_enter_to_submit", + "set_enter_to_submit", "record_fork", "get_fork_parent", "count_forks", diff --git a/devplacepy/database/enter_submit.py b/devplacepy/database/enter_submit.py new file mode 100644 index 00000000..9338980d --- /dev/null +++ b/devplacepy/database/enter_submit.py @@ -0,0 +1,22 @@ +# retoor + +from .core import db, get_table + + +def get_enter_to_submit(owner_id: str) -> bool: + if "users" not in db.tables: + return True + user = db["users"].find_one(uid=owner_id) + if user is None: + return True + value = user.get("enter_to_submit") + return True if value is None else bool(value) + + +def set_enter_to_submit(owner_id: str, enabled: bool) -> None: + from devplacepy.utils import clear_user_cache + + get_table("users").update( + {"uid": owner_id, "enter_to_submit": 1 if enabled else 0}, ["uid"] + ) + clear_user_cache(owner_id) diff --git a/devplacepy/database/notifications.py b/devplacepy/database/notifications.py index 2639e540..241f25fb 100644 --- a/devplacepy/database/notifications.py +++ b/devplacepy/database/notifications.py @@ -204,3 +204,87 @@ def mark_notifications_read_by_target(user_uid: str, target_url: str) -> int: clear_unread_cache(user_uid) return len(ids) + + +NOTIFICATION_GROUP_KEYS = { + "comment": "actor", + "reply": "actor", + "thread": "actor", + "mention": "actor", + "message": "actor", + "harvest_stolen": "actor", + "award": "actor", + "quiz_attempt": "actor", + "vote": "target", + "follow": "target", + "badge": "single", + "level": "single", + "issue": "single", + "reminder": "single", + "battle": "single", + "workspace": "single", + "moderation": "single", + "system": "single", + "ai_quota_warning": "single", + "game_upkeep": "single", +} + + +def notification_group_key(row) -> tuple: + ntype = (row.get("type") or "") + shape = NOTIFICATION_GROUP_KEYS.get(ntype, "single") + if shape == "actor": + return (ntype, row.get("related_uid") or "", row.get("target_url") or "") + if shape == "target": + if ntype == "follow": + return (ntype,) + return (ntype, row.get("target_url") or "") + return (ntype, row.get("uid") or "") + + +def notification_throttle_key(user_uid: str, notification_type: str, related_uid: str, target_url) -> tuple: + row = {"type": notification_type, "related_uid": related_uid or "", "target_url": target_url or "", "uid": ""} + return (user_uid,) + notification_group_key(row) + + +def _user_bool_pref(user_uid: str, column: str) -> bool: + if "users" not in db.tables: + return True + user = db["users"].find_one(uid=user_uid) + if user is None: + return True + value = user.get(column) + return True if value is None else bool(value) + + +def get_notification_grouping_enabled(user_uid: str) -> bool: + return _user_bool_pref(user_uid, "notif_grouping_enabled") + + +def get_notification_throttle_enabled(user_uid: str) -> bool: + return _user_bool_pref(user_uid, "notif_throttle_enabled") + + +def _set_user_bool_pref(user_uid: str, column: str, enabled: bool) -> None: + from devplacepy.utils import clear_user_cache + + get_table("users").update({"uid": user_uid, column: 1 if enabled else 0}, ["uid"]) + clear_user_cache(user_uid) + bump_cache_version("notif_prefs") + + +def set_notification_grouping_enabled(user_uid: str, enabled: bool) -> None: + _set_user_bool_pref(user_uid, "notif_grouping_enabled", enabled) + + +def set_notification_throttle_enabled(user_uid: str, enabled: bool) -> None: + _set_user_bool_pref(user_uid, "notif_throttle_enabled", enabled) + + +def count_unread_groups(user_uid: str) -> int: + if "notifications" not in db.tables: + return 0 + rows = list(get_table("notifications").find(user_uid=user_uid, read=False)) + if not get_notification_grouping_enabled(user_uid): + return len(rows) + return len({notification_group_key(row) for row in rows}) diff --git a/devplacepy/database/schema.py b/devplacepy/database/schema.py index 9a49b57d..748607d8 100644 --- a/devplacepy/database/schema.py +++ b/devplacepy/database/schema.py @@ -2758,6 +2758,12 @@ def backfill_api_keys() -> int: users.create_column_by_example("cust_disable_global", 0) if not users.has_column("cust_disable_pagetype"): users.create_column_by_example("cust_disable_pagetype", 0) + if not users.has_column("enter_to_submit"): + users.create_column_by_example("enter_to_submit", 1) + if not users.has_column("notif_grouping_enabled"): + users.create_column_by_example("notif_grouping_enabled", 1) + if not users.has_column("notif_throttle_enabled"): + users.create_column_by_example("notif_throttle_enabled", 1) if not users.has_column("ai_correction_enabled"): users.create_column_by_example("ai_correction_enabled", 0) if not users.has_column("ai_correction_prompt"): diff --git a/devplacepy/docs_api/groups/notifications.py b/devplacepy/docs_api/groups/notifications.py index b83d9ca6..8e597711 100644 --- a/devplacepy/docs_api/groups/notifications.py +++ b/devplacepy/docs_api/groups/notifications.py @@ -8,8 +8,7 @@ GROUP = { "intro": """ # Notifications -Read your notification feed and mark items read. The unread counts endpoint backs the badges -in the navigation bar. Deliver these to the browser with [Web Push](/docs/push.html). +Read your notification feed and mark items read. With grouping on (the default, a profile setting), similar events share one entry in `event_entries` and the unread counts count groups; with it off, entries stay one per event. Repeat external alerts are throttled to one per similar event group per 5 minutes unless the user turned throttling off; in-app rows are never throttled. The unread counts endpoint backs the badges in the navigation bar. Deliver these to the browser with [Web Push](/docs/push.html). Every endpoint follows the shared [Conventions & Errors](/docs/conventions.html) (auth, content negotiation, pagination, status codes); see [Authentication](/docs/authentication.html) for the diff --git a/devplacepy/docs_api/groups/profiles.py b/devplacepy/docs_api/groups/profiles.py index 73e53345..0fdafc7d 100644 --- a/devplacepy/docs_api/groups/profiles.py +++ b/devplacepy/docs_api/groups/profiles.py @@ -504,6 +504,48 @@ four ways to sign requests. ), ], ), + endpoint( + id="profile-enter-to-submit", + method="POST", + path="/profile/{username}/enter-to-submit", + title="Toggle Enter to send", + summary="Enter posts comments and sends messages; Shift+Enter adds a new line. Admins may target any user.", + auth="user", + encoding="form", + destructive=True, + params=[ + field("username", "path", "string", True, "bob_test", "Profile owner. Must be yourself unless you are an admin."), + field("value", "form", "boolean", False, "1", "1 for Enter to send, 0 for Enter adds a new line."), + ], + ), + endpoint( + id="profile-notification-grouping", + method="POST", + path="/profile/{username}/notifications/grouping", + title="Toggle grouped notifications", + summary="Group similar notifications into one card; the badge counts groups. Admins may target any user.", + auth="user", + encoding="form", + destructive=True, + params=[ + field("username", "path", "string", True, "bob_test", "Profile owner. Must be yourself unless you are an admin."), + field("value", "form", "boolean", False, "1", "1 to group, 0 to show every event."), + ], + ), + endpoint( + id="profile-notification-throttling", + method="POST", + path="/profile/{username}/notifications/throttling", + title="Toggle throttled repeat alerts", + summary="At most one push, Telegram message and toast per similar event group per 5 minutes. In-app is never throttled. Admins may target any user.", + auth="user", + encoding="form", + destructive=True, + params=[ + field("username", "path", "string", True, "bob_test", "Profile owner. Must be yourself unless you are an admin."), + field("value", "form", "boolean", False, "1", "1 to throttle repeat alerts, 0 to alert on every event."), + ], + ), endpoint( id="profile-notification-toggle", method="POST", diff --git a/devplacepy/docs_live.py b/devplacepy/docs_live.py index 82cfcc47..21bd0084 100644 --- a/devplacepy/docs_live.py +++ b/devplacepy/docs_live.py @@ -1,6 +1,7 @@ # retoor from devplacepy.database import ( + count_unread_groups, db, get_table, get_setting, @@ -71,7 +72,7 @@ def _user_facts(user: dict) -> dict: "followers": _count("follows", following_uid=uid), "following": _count("follows", follower_uid=uid), "bookmarks": _count("bookmarks", user_uid=uid), - "unread_notifications": _count("notifications", user_uid=uid, read=False), + "unread_notifications": count_unread_groups(uid), "unread_messages": _count("messages", receiver_uid=uid, read=False, deleted_at=None), }, "recent_posts": [ diff --git a/devplacepy/models/__init__.py b/devplacepy/models/__init__.py index 51c08642..90bca18f 100644 --- a/devplacepy/models/__init__.py +++ b/devplacepy/models/__init__.py @@ -44,6 +44,7 @@ from devplacepy.models.projects import ( ) from devplacepy.models.profile import ( CustomizationToggleForm, + EnterToSubmitForm, AwardGiveForm, NotificationPrefForm, AiCorrectionForm, @@ -195,6 +196,7 @@ __all__ = [ "ProjectFileDeleteLinesForm", "ProjectFileAppendForm", "CustomizationToggleForm", + "EnterToSubmitForm", "AwardGiveForm", "NotificationPrefForm", "AiCorrectionForm", diff --git a/devplacepy/models/profile.py b/devplacepy/models/profile.py index 0b936d75..f4dfe368 100644 --- a/devplacepy/models/profile.py +++ b/devplacepy/models/profile.py @@ -12,6 +12,10 @@ class CustomizationToggleForm(BaseModel): value: bool = False +class EnterToSubmitForm(BaseModel): + value: bool = True + + class AwardGiveForm(BaseModel): description: str = Field(min_length=1, max_length=125) diff --git a/devplacepy/push/providers/webpush.py b/devplacepy/push/providers/webpush.py index 8c314f74..11f23bfb 100644 --- a/devplacepy/push/providers/webpush.py +++ b/devplacepy/push/providers/webpush.py @@ -100,6 +100,7 @@ def ensure_certificates() -> None: ): return lock_path = VAPID_PRIVATE_KEY_FILE.parent / ".vapid.lock" + lock_path.parent.mkdir(parents=True, exist_ok=True) with open(lock_path, "w") as lock: fcntl.flock(lock, fcntl.LOCK_EX) try: diff --git a/devplacepy/routers/CLAUDE.md b/devplacepy/routers/CLAUDE.md index d2024fbd..5f2146c7 100644 --- a/devplacepy/routers/CLAUDE.md +++ b/devplacepy/routers/CLAUDE.md @@ -294,10 +294,10 @@ All SEO features are implemented across the following locations: ### Post page layout (three columns, mirrors `/feed`) -`post.html` reuses `/feed`'s exact layout building blocks rather than inventing new ones, wrapped in `.post-page-layout` (`static/css/post.css`, `grid-template-columns: var(--sidebar-width) minmax(0, 1fr) 280px`, collapsing to one column at 1024px): +`post.html` reuses `/feed`'s exact layout building blocks rather than inventing new ones, wrapped in `.post-page-layout` (`static/css/post.css`). The grid is `var(--sidebar-width) minmax(0, 1fr) 280px` only when both asides are present. Each column is placed explicitly (sidebar column 1, `.post-page` column 2, `.feed-right` column 3), and a missing aside drops its track instead of shifting the article into the 240px sidebar column. It collapses to one column at 1024px: - **Left column** - `