Patch notes — full code review, smoke suite green, doc-portal fixes (2026-06-14, session 2)
A maintenance + quality session across two repos. On Ethica.no it was a full
code-review pass (inline documentation + safe dead-code handling) followed by
turning the Docker smoke suite fully green. On the document portal
(dokument.ethica.no, the EthicaDocServer + EthicaDoc content) it fixed the
folder-box rendering, re-skinned the portal to the Ethica brand, and cleaned up a
few UI papercuts. Detailed bug-by-bug write-up lives alongside this note in
bugfix-report-2026-06-14.md.
1 — Ethica.no: full code review (documentation + unused code) ✅
A two-pass review of every tracked source file (server.py is ~6,300 lines).
- 110 concise documentation comments added above previously-undocumented
meaningful blocks across 11 files — DB/auth/CSRF helpers, the route handlers
(CRM, monitoring, service desk, assets, projects, the customer
/accountportal, login + OIDC SSO, settings), the collector, thedb.pyshim, and the schema. The codebase was already ~85–90% documented, so this filled the gaps without noise. - 3 confirmed-unused blocks were commented out (never deleted), each with an
UNUSED_CODE_REVIEW 2026-06-14marker stating the reason, the verification, and how to restore:server.py→Handler.require_role()— an access-gate helper added in the roles “foundation” commit but never wired up (gating is done inline).docs_reader/core/config.py→DocsConfig.is_single— a convenience property mirroring the usedis_multi; referenced nowhere.layouts/partials/ed-rail.html→ the legacy right-rail partial whose last callers were deliberately removed earlier (e237f5f); now disabled via an{{ if false }}guard.
- Uncertain/framework-convention code (a CV type-layout, the audio/gallery shortcodes, dynamically-named CSS classes) was left active and documented — not pruned.
- Verification:
py_compileclean, 27/27 unit tests, and the Docker smoke identical to baseline (no regressions). Full report:review/code-review-unused-code-report.md.
2 — Ethica.no: baseline smoke suite back to green (53/3 → 56/0) ✅
Three pre-existing smoke failures were fixed (one real regression, two stale test assertions — see the bug-fix report for root causes):
- Search restored. The Hugo home
JSONoutput had been dropped, sopublic/index.jsonwas never built and thepagesfull-text table stayed empty → search returned nothing. Re-enabledJSONin[outputs]and added alayouts/index.jsontemplate that emits the search index the server imports at startup. (Still refused + deleted after import in gated docs modes.) - CRM deal-move smoke. The smoke read the CSRF token from a
name=csrffield, but the kanban pipeline publishes it asdata-csrf; the empty token correctly got a 403. Smoke now readsdata-csrf. Access control unchanged — an empty/bad token still returns 403. - Projects list smoke. The active projects view is now a kanban
(
class="kanban"); the smoke still asserted the oldtk-listmarker. Updated.
Result: 56 passed / 0 failed. Report:
review/2026-06-14-baseline-smoke-bugfix-report.md.
3 — Document portal (dokument.ethica.no): folder boxes + brand + UI ✅
- Missing folder box fixed. A doc-type folder only renders a box if it is a
Hugo section, which (for a nested folder) requires an
_index.md. Folders of loose.mdpages without one rendered no box and their pages were orphaned from the grid — the symptom being one company showing a folder box another lacked. New build stepscripts/ensure_section_index.pycreates a titled_index.mdin any company sub-folder that holds markdown but has none, so every doc-type folder becomes a titled section → a box. Runs at image build on the cloned content; the upstream docs repo is never touched. Box titles also now fall back to the folder’s# H1/ name via the existingdoc-title.htmlpartial. - Re-skinned to the Ethica brand. The portal CSS (
assets/css/main.css) and the server-rendered chrome (server.pyrender_shell) still carried the old SecBitz palette (pink#f00b51/ olive#aa9903, the “Aldrich” font). Both now use the Ethica navy/blue palette mirroringethica.no(--brand-primary #79b0ee, accent#5b86c4, bg#090d16, text#e9eef6) and Comfortaa as the display font. The logo was already Ethica’s. - Login screen. Added the Ethica logo to the sign-in card (it had none).
- Duplicated page heading fixed. Doc and section pages showed their title
twice — once as the page header, once from the rendered body
# H1. The templates (list.html,single.html) now strip a leading body<h1>(which the header already derives the title from). - Spacing. Added clear separation (top border + margin) between a folder’s doc list and the “Recent Pages” block, which were cramped together.
Deployment status
- Ethica.no changes are committed on branch
bugfix/baseline-smoke-failures(built on the review branch); not pushed/merged. They deploy on the nextmainmerge (the prod trigger). - Document portal changes are in the working tree of
EthicaDocServer(server.py,assets/css/main.css,layouts/_default/{list,single,baseof}.html,Dockerfile, newscripts/ensure_section_index.py); they take effect on the next portal image rebuild/deploy. Thegit-filesdocs submodule was not touched.
Verification
- Ethica.no:
py_compileclean · unit tests 27/27 · Docker smoke 56/0. - Document portal: Hugo 0.161.1 build clean; a company sub-folder without
_index.mdnow renders a titled box; single doc pages render exactly one H1; rebuilt CSS contains the Ethica palette and zero SecBitz colours; Comfortaa loads in the head; the login page carries the logo + Ethica palette.