[214] Stop serving the README and repository docs tree from the app server - #215
Draft
CarsonDavis wants to merge 3 commits into
Draft
[214] Stop serving the README and repository docs tree from the app server#215CarsonDavis wants to merge 3 commits into
CarsonDavis wants to merge 3 commits into
Conversation
Removes the unauthenticated /README.md static mount, which has had no consumer since it was added in 2019.
5 tasks
🤖 Version Auto-BumpedThe version has been automatically incremented to This commit was added to your PR branch. When you merge this PR, the new version will be included. If you want a different version, update |
5 tasks
… spec Removes the /docs static mount so repository documentation - architecture decision records, drafts, planning notes - is no longer browsable from a running deployment. Two files genuinely depended on being under docs/, so they move to homes that are still served or still shipped: - docs/swagger/ -> public/swagger/, with swaggerOptions updated. The URLs stay absolute and continue to omit ROOT_PATH, exactly as before. - docs/mmgis-openapi.json -> API/mmgis-openapi.json, required at module load by scripts/server.js. With nothing left reading from docs/ at build or run time, docs is added to .dockerignore so the tree stops shipping in the image.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #214
The app server served two things out of the repository that have nothing to do with the running app: the repo's
README.mdat its own URL, and the entiredocs/tree as a browsable static file directory. Both were auth-exempt in practice —ensureUser()short-circuits whenever there is noauthorizationheader andAUTH != "local", which is the lean/dashboard configuration and what the e2e workflow sets — so every deployment published its architecture decision records, drafts, planning notes, and research scratch to anyone who asked. Neither mount was a deliberate product decision; both are inherited.This PR removes both, relocates the two files that genuinely depended on the
docsmount, and stops the tree from shipping in the container image.What changed
scripts/server.js/README.mdstatic mount. It dates to the original 2019server.js(MMGIS 1.1) and was kept through a 2023 file-casing rename; a repo-wide grep acrosssrc/essence,configure/src, anddocsfound no consumers./docsstatic mount.swaggerOptionsnow points at/public/swagger/swaggerCSS.cssand/public/swagger/swaggerJS.js. These URLs remain absolute and still omitROOT_PATH— that is the pre-existing behaviour, preserved deliberately rather than changed in passing. (It is arguably wrong under a non-empty root path, but that is a separate issue.)require("../docs/mmgis-openapi.json")is nowrequire("../API/mmgis-openapi.json").Relocations (via
git mv, so history follows)docs/swagger/swaggerCSS.css→public/swagger/swaggerCSS.cssdocs/swagger/swaggerJS.js→public/swagger/swaggerJS.jsdocs/mmgis-openapi.json→API/mmgis-openapi.jsonThe swagger assets had to move somewhere still served — removing the mount does not error, the API reference page just silently loses its styling and script. The openapi spec is required at module load, so it had to move out of
docs/before the directory could be ignored, or the container would fail to boot..dockerignoredocs. The tree reached the image through the Dockerfile'sCOPY . .; it is roughly 8 MB of repo files with no runtime purpose.Verification
Booted from a worktree on this branch with
AUTH=none(i.e.ensureUser()short-circuiting, the unauthenticated configuration the issue asks about) and curled it. Files confirmed present on disk, so the 404s reflect the removed mount rather than missing content:/docs/MISSION_CONFIG_REFERENCE.md/docs/adr/02102026-layout-handling.md/docs/favicon.ico/docs/404.html/docs/mmgis-openapi.json/docs/swagger/swaggerCSS.css/README.md/api/docs/public/swagger/swaggerCSS.css/public/swagger/swaggerJS.js/configure/public/docs/MMGIS_URL_sample.pngThe served
/api/docsHTML still injects both custom assets, now at their new paths:Container image contents verified empirically rather than reasoned about — built a throwaway image over this build context and listed it: root
docs/is absent, whilepublic/docs/,public/swagger/, andAPI/mmgis-openapi.jsonare all present. (.dockerignorepatterns without a slash match only at the context root, sopublic/docsis unaffected.)Tests:
vitest run— 52 files, 786 tests, all passing.playwright test tests/e2e— 32 passed, 1 failed; the failure issmoke.spec.jsasserting the page title matches/MMGIS/iagainst a local fixture database whose mission title is "Disasters Program - Demo Dashboard". Pre-existing and environmental, unrelated to this change.Not in scope
Changing where or how documentation is published for readers, reorganising the documentation content, and auditing the other static mounts for the same auth weakness — each worth doing, each its own issue.