Repository navigation
Make the document outline collapsible by subtree - #322
ThePumpingLemma wants to merge 5 commits into
Conversation
Long outlines (more than 12 entries) nest by heading level and fold each section behind a chevron, except where the reader is. Scrolling and #section links unfold; expand/collapse all, Left/Right keys, and per-plan sessionStorage persistence; state survives live updates and the editor. Folded sections total their sub-sections' discussion counts. Short outlines are unchanged. Adds the nested-outline demo.
|
🤖 @codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Signed-off-by: Hampton Lintorn-Catlin <hampton@squareup.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8f1b20895
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: Hampton Lintorn-Catlin <hampton@squareup.com>
|
🤖 Cleanup complete; local tryout ready for @HamptonMakes. Hampton requested independent correctness/product review, routine repairs, and an isolated local tryout; he has not approved or authorized merging this PR. Pushed two bounded corrections:
Verification: initial outline + development-seed run 46 examples, 0 failures; follow-up outline, selected inline-editor, and changed-section browser run 31 examples, 0 failures; RuboCop and diff checks pass. All 15 current-head checks are green on CI caveat preserved: attempt 1 failed The preview uses a dedicated checkout and development/test databases on port 3322. Sign in as hampton@example.com, no password; open Product judgment: useful navigation for long plans, engine-contained with no new dependency. Two separate acceptance choices: (1) the >12-entry threshold, which seems a reasonable starting point for reducing clutter; (2) automatic expansion after deliberate collapse, which can undermine the reader's organization. My recommendation is to respect explicit collapses during ordinary scrolling while allowing intentional section-link navigation to reveal its target. That policy change has not been applied without Hampton's decision. ID/text/position matching remains heuristic for wholesale heading replacement/reordering; avoid adding more matching machinery without a concrete need. #314 still requires integration: its pinned Summary must remain outside this tree and its separate markup must work with the new row-scoped badge/pulse selectors. Combined behavior has not been claimed as tested. Fresh local evidence (synthetic shared demo): |
|
🤖 Merged current main ( Focused integration: 65 examples, 0 failures across outline collapse, development seeding, math rendering, and math editing; diff checks pass. Resolution review found no new issues. The existing Codex review remains applicable to this bounded additive conflict resolution; no unresolved review findings were returned. All 15 current-head checks passed on The isolated port-3322 preview was restarted and exercised: Correctness's folded count of 3 becomes child counts 2 and 1. Its dedicated database still has revision 6, the original text, and four discussions. No product policy changed; the previously documented threshold/scroll-expansion choices remain for Hampton. No approval or merge was authorized or performed. |
|
🤖 Reconciled current main ( Focused checks: 60 examples, 0 failures across outline collapse, callouts, and development seeds, including re-seeding preservation. Diff checks and resolution review pass. This additive resolution does not rebuild behavior, so the existing automated review remains applicable; there are no new unresolved review findings. GitHub reports MERGEABLE / BLOCKED on the new head; all 15 current-head CI checks passed on The existing isolated preview on port 3322 is running with current code; availability was rechecked after CI completed (HTTP 200). Main's migrations were applied only to its dedicated development database; revision 6, original nested-outline content, and all four discussions remain intact. Browser specs ran headlessly in isolation; no normal Chrome session was used. PR attachment verified. Prior product choices remain unchanged. No approval or merge was authorized or performed. |


What changed and why
Long plans, such as an STPA report with ten numbered sections (
## 5. Correctness›### 5.1 …) and many sub-sections each, gave an outline far taller than the screen. The left-hand outline can now fold by subtree.aria-expandedandaria-controls. Only the chevron toggles; clicking the label still navigates.#sectionhash change unfolds the target.sessionStorageper plan id and keyed by heading id. Keys for headings that no longer exist are ignored. Scroll and link auto-expansion are not stored.Everything is in the engine. The behavior is in
content_nav_controller.js, with plain CSS indocument-outline.cssand a small server-rendered partial for the header controls; the same markup is used on the version page.Overlap with #314: that PR (
dgrochowski/summary-block) also touchescontent_nav_controller.js, to add a pinned "Summary" entry. This branch builds on main and keeps its change contained to the outline's build/assemble path. Whichever lands second will need a small rebase: the Summary entry should be placed outside the nested tree.Evidence
Screenshots to be attached. Files, at 1400×900, from the
nested-outlinedemo:/tmp/coplan-shots/outline/outline-light-collapsed.png: initial state; sections folded; 4. Correctness shows a total of 3, 7. Security shows 1./tmp/coplan-shots/outline/outline-light-partly-expanded.png: 4. Correctness opened by its chevron; 7. Security unfolded by scrolling to 7.2./tmp/coplan-shots/outline/outline-dark-collapsed.png/tmp/coplan-shots/outline/outline-dark-partly-expanded.pngoutline-{light,dark}-{collapsed,partly-expanded}-sidebar.pngHow to try it
bin/rails db:seed, thenbin/rails server -p 3107.nested-outline).What to check:
Testing
bundle exec rspec spec/system/outline_collapse_spec.rb(new, 11 browser examples):#sectionURL unfolds the target, for both h2 and h3 targets.spec/lib/development_seed_spec.rb: newnested-outlineexample covering initial state, re-seed idempotency, and preservation of local edits and resolved discussions.Touched specs:
outline_collapse,development_seed,human_editing,inline_editor,deck_ux,changed_sections_ux,demo_libraryandrequests/plans. 316 examples, 1 failure: the known Chrome "failed to close window in 20 seconds" teardown flake, which hits whichever example is running about 20s after launch. The failing example (outline_collapse_spec.rb:125) passes on its own.Full suite,
bundle exec rspec: 3412 examples, 1 failure: the known flakyspec/system/agent_connections_spec.rb:16, with the same teardown error. This run predates a final fix to the outline JS (no gutter on long flat outlines; rebuild defaults and position fallback); the touched specs above were rerun after it.Light and dark mode were checked in a real browser against the seeded demo (screenshots above).
Added or updated real JavaScript-enabled browser specs in
spec/system/for changed UI behavior, covering the user interaction and visible result; or explained why no browser UI is involved.Added model, service, or request specs where needed for domain behavior, authorization, or API cases.
Ran
bundle exec rspec, or explained why it could not run and listed the specs that did run.Tested affected UI behavior in both light and dark mode, or explained why mode testing does not apply.
Attached a video or images demonstrating the change, if this PR adds or changes a feature or fixes a UI bug. (Screenshots to be attached.)