diff --git a/.forgejo/workflows/web-deploy.yml b/.forgejo/workflows/web-deploy.yml index cd75e390..c736800d 100644 --- a/.forgejo/workflows/web-deploy.yml +++ b/.forgejo/workflows/web-deploy.yml @@ -1,93 +1,84 @@ -name: DuneRealms Web CI - -on: - push: - branches: - - main - paths: - - 'website/**' - - '.forgejo/workflows/web-deploy.yml' - - '.forgejo/tests/web-deploy.test.mjs' - workflow_dispatch: - -jobs: - web: - if: github.repository == 'unimatrix/web' || (github.repository == 'dev/MC' && github.event_name == 'workflow_dispatch') - runs-on: dune-ci - steps: - - name: Check out exact revision - shell: bash - env: - REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - set -euo pipefail - git init . - git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 "https://www.dunerealms.com/git/${GITHUB_REPOSITORY}.git" "$GITHUB_SHA" - git checkout --detach FETCH_HEAD - test "$(git rev-parse HEAD)" = "$GITHUB_SHA" - - - name: Install Node 22 - uses: actions/setup-node@v4 - with: - node-version: '22' - - - name: Prepare publication comparison - if: github.repository == 'unimatrix/web' && github.ref == 'refs/heads/main' - shell: bash - env: - REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - BEFORE=$(node -e 'const fs=require("fs");const p=process.env.GITHUB_EVENT_PATH;const e=p&&fs.existsSync(p)?JSON.parse(fs.readFileSync(p)):{};process.stdout.write(e.before||"");') - if [[ ! "$BEFORE" =~ ^[0-9a-f]{40}$ || "$BEFORE" =~ ^0+$ ]]; then - git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --deepen=1 https://www.dunerealms.com/git/unimatrix/web.git "$GITHUB_SHA" - BEFORE=$(git rev-parse HEAD^) - else - git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/web.git "$BEFORE" - fi - node website/scripts/publication-changes.mjs "$BEFORE" "$GITHUB_SHA" - - - name: Verify deployment policy - run: | - node --test .forgejo/tests/web-deploy.test.mjs - python3 -m unittest discover -s website/ops -p 'test_*.py' - bash -n website/ops/dunerealms-ci-trigger website/ops/dunerealms-build-release - - - name: Build and test website - working-directory: website - run: | - corepack enable - corepack pnpm install --frozen-lockfile - corepack pnpm build - corepack pnpm test - - - name: Upload tested deployment scripts - uses: actions/upload-artifact@v3 - with: - name: DuneRealms-Website-Operations - path: website/dist/deployment/ - if-no-files-found: error - retention-days: 7 - - - name: Upload website build - if: github.repository == 'unimatrix/web' && github.ref == 'refs/heads/main' - uses: actions/upload-artifact@v3 - with: - name: DuneRealms-Website - path: website/dist/ - if-no-files-found: error - retention-days: 1 - - - name: Trigger deployment after successful CI - if: github.repository == 'unimatrix/web' && github.ref == 'refs/heads/main' - shell: bash - env: - DEPLOY_KEY: ${{ secrets.DUNEREALMS_DEPLOY_KEY }} - run: | - install -m 700 -d ~/.ssh - printf '%s\n' "$DEPLOY_KEY" > ~/.ssh/deploy_key - chmod 600 ~/.ssh/deploy_key - trap 'rm -f ~/.ssh/deploy_key' EXIT - printf '%s\n' '91.107.196.242 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC8x/XocsIz41fWHGty0DbZhSvafSQFt9jaHHgzdr55W root@ubuntu-4gb-fsn1-1' >> ~/.ssh/known_hosts - ssh -p 22 -i ~/.ssh/deploy_key -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=yes dunedeploy@91.107.196.242 "$GITHUB_SHA" - rm -f ~/.ssh/deploy_key - +name: DuneRealms Web CI + +on: + push: + branches: + - main + paths: + - 'website/**' + - '.forgejo/workflows/web-deploy.yml' + - '.forgejo/tests/web-deploy.test.mjs' + workflow_dispatch: + +jobs: + web: + if: github.repository == 'unimatrix/web' || (github.repository == 'dev/MC' && github.event_name == 'workflow_dispatch') + runs-on: dune-ci + steps: + - name: Check out exact revision + shell: bash + env: + REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + git init . + git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 "https://www.dunerealms.com/git/${GITHUB_REPOSITORY}.git" "$GITHUB_SHA" + git checkout --detach FETCH_HEAD + test "$(git rev-parse HEAD)" = "$GITHUB_SHA" + + - name: Install Node 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Prepare publication comparison + if: github.repository == 'unimatrix/web' && github.ref == 'refs/heads/main' + shell: bash + env: + REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + BEFORE=$(node -e 'const fs=require("fs");const p=process.env.GITHUB_EVENT_PATH;const e=p&&fs.existsSync(p)?JSON.parse(fs.readFileSync(p)):{};process.stdout.write(e.before||"");') + if [[ ! "$BEFORE" =~ ^[0-9a-f]{40}$ || "$BEFORE" =~ ^0+$ ]]; then + git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --deepen=1 https://www.dunerealms.com/git/unimatrix/web.git "$GITHUB_SHA" + BEFORE=$(git rev-parse HEAD^) + else + git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/web.git "$BEFORE" + fi + node website/scripts/publication-changes.mjs "$BEFORE" "$GITHUB_SHA" + + - name: Verify deployment policy + run: | + node --test .forgejo/tests/web-deploy.test.mjs + python3 -m unittest discover -s website/ops -p 'test_*.py' + + - name: Build and test website + working-directory: website + run: | + corepack enable + corepack pnpm install --frozen-lockfile + corepack pnpm build + corepack pnpm test + + - name: Upload website build + if: github.repository == 'unimatrix/web' && github.ref == 'refs/heads/main' + uses: actions/upload-artifact@v3 + with: + name: DuneRealms-Website + path: website/dist/ + if-no-files-found: error + retention-days: 1 + + - name: Trigger deployment after successful CI + if: github.repository == 'unimatrix/web' && github.ref == 'refs/heads/main' + shell: bash + env: + DEPLOY_KEY: ${{ secrets.DUNEREALMS_DEPLOY_KEY }} + run: | + install -m 700 -d ~/.ssh + printf '%s\n' "$DEPLOY_KEY" > ~/.ssh/deploy_key + chmod 600 ~/.ssh/deploy_key + trap 'rm -f ~/.ssh/deploy_key' EXIT + printf '%s\n' '91.107.196.242 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC8x/XocsIz41fWHGty0DbZhSvafSQFt9jaHHgzdr55W root@ubuntu-4gb-fsn1-1' >> ~/.ssh/known_hosts + ssh -p 22 -i ~/.ssh/deploy_key -o IdentitiesOnly=yes -o BatchMode=yes -o StrictHostKeyChecking=yes dunedeploy@91.107.196.242 "$GITHUB_SHA" + rm -f ~/.ssh/deploy_key + diff --git a/.gitattributes b/.gitattributes index cb3ec7e1..b26e6b46 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,3 @@ *.pdf binary *.png binary *.zip binary -.forgejo/workflows/web-deploy.yml text eol=lf -website/ops/dunerealms-ci-trigger text eol=lf -website/ops/dunerealms-build-release text eol=lf -website/ops/README.md text eol=lf diff --git a/AGENTS.md b/AGENTS.md index daf3f0e5..0863f6e0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,7 +23,6 @@ - Run `.forgejo/tests/web-deploy.test.mjs` with Node and `website/ops/test_*.py` with Python on Linux. The Linux deployment checks require `fcntl` and cannot pass natively on Windows. - Tests that create local HTTP servers need permission for loopback connections. Report environmental failures accurately and rerun with the needed permission; do not weaken production code to hide them. - Required release evidence includes the commit, actual checks, CI run, generated artifact and live serving revision. A build or artifact upload is not proof of deployment. -- Owner's mandatory release rule, 29 November 2026: EVERY plugin, page, asset and configuration alteration goes through the committed build pipeline. Do not publish independently created plugin JARs/pages, copy local edits live, or leave direct live patches outside the build. SSH may resolve a blocker, but its persistent correction must be committed and included in the next verified build. ## Access and server changes @@ -39,4 +38,3 @@ - Item cards display authoritative metadata from native Bukkit items or a verified signed HQ design. Do not invent quality, marks, lore, enchantments or stats from material names. - Preserve real voting, banking and item-issuance boundaries. Public presentation must not expose serialized items, signatures or service credentials. - Describe what is coded, tested, merged and deployed separately. Mark unavailable features honestly. -- The owner requires one shared header and footer across portal, CP and other website surfaces. Use one canonical source and publication path; aligning labels on separate implementations is insufficient. Verify signed-in rendering as well as emitted HTML. diff --git a/website/control-panel/public/cp-v2/v2.js b/website/control-panel/public/cp-v2/v2.js index 5726c076..434e7873 100644 --- a/website/control-panel/public/cp-v2/v2.js +++ b/website/control-panel/public/cp-v2/v2.js @@ -253,5 +253,5 @@ document.querySelector('#mobile-menu').onclick=()=>{const opened=sidebar.classLi // Finish the shared page pattern for retained adapters as they mount. const headingObserver=new MutationObserver(()=>{const hero=content.querySelector(':scope > .hero');if(!hero)return;for(const host of content.querySelectorAll('.citizen-live-host')){for(const heading of host.querySelectorAll(':scope > .cp-v2-template-page > .cp-v2-template-heading')){const title=heading.querySelector('h3')?.textContent,copy=heading.querySelector('p')?.textContent,icon=heading.querySelector('img');if(title)hero.querySelector('h1').textContent=title;if(copy)hero.querySelector('p').textContent=copy;if(icon)hero.querySelector('img').src=icon.src;heading.remove();}for(const duplicate of host.closest('article.card')?.querySelectorAll(':scope > h2, :scope > .hint')||[])duplicate.remove();}});headingObserver.observe(content,{childList:true,subtree:true}); -function renderComfortNavigation(active){let bar=document.querySelector(".comfort-workspaces");if(!bar){bar=el("nav","comfort-workspaces");bar.setAttribute("aria-label","Account workspaces");(document.querySelector(".command-banner")||document.querySelector("#portals")).after(bar);}bar.replaceChildren();const select=el("select");select.setAttribute("aria-label","Personal service");const personal=menu.workspaces.filter(w=>!["clan","bureau","forge"].includes(w.id));if(!personal.some(w=>w.id===active)){const placeholder=el("option","","Choose a personal service");placeholder.value="";placeholder.disabled=true;placeholder.selected=true;select.append(placeholder);}for(const w of personal){const o=el("option","",w.label);o.value=w.id;o.selected=active===w.id;select.append(o);}const label=el("label","comfort-service","Personal");label.append(select);select.onchange=()=>go(select.value);bar.append(label);const organisation=el("a","comfort-org","Organisations");organisation.href="https://www.dunerealms.com/realm-hub.html";bar.append(organisation);for(const w of menu.workspaces.filter(w=>["bureau","forge"].includes(w.id))){const b=el("button","comfort-staff",w.id==="bureau"?"Staff":w.label);b.type="button";b.setAttribute("aria-current",active===w.id?"page":"false");b.onclick=()=>go(w.id);bar.append(b);}} +function renderComfortNavigation(active){let bar=document.querySelector(".comfort-workspaces");if(!bar){bar=el("nav","comfort-workspaces");bar.setAttribute("aria-label","Account workspaces");(document.querySelector(".command-banner")||document.querySelector("#portals")).after(bar);}bar.replaceChildren();const select=el("select");select.setAttribute("aria-label","Personal service");const personal=menu.workspaces.filter(w=>!["clan","bureau","forge"].includes(w.id));if(!personal.some(w=>w.id===active)){const placeholder=el("option","","Choose a personal service");placeholder.value="";placeholder.disabled=true;placeholder.selected=true;select.append(placeholder);}for(const w of personal){const o=el("option","",w.label);o.value=w.id;o.selected=active===w.id;select.append(o);}const label=el("label","comfort-service","Personal");label.append(select);select.onchange=()=>go(select.value);bar.append(label);const organisation=el("a","comfort-org","Organisations");organisation.href="https://www.dunerealms.com/realm-hub.html";bar.append(organisation);for(const w of menu.workspaces.filter(w=>["bureau","forge"].includes(w.id))){const b=el("button","comfort-staff",w.id==="bureau"?"Staff":"Development");b.type="button";b.setAttribute("aria-current",active===w.id?"page":"false");b.onclick=()=>go(w.id);bar.append(b);}} if(parent!==window)document.documentElement.classList.add('dune-embedded'); diff --git a/website/docs/OWNER-DIRECTIONS-AND-HANDOVER-20261129.md b/website/docs/OWNER-DIRECTIONS-AND-HANDOVER-20261129.md deleted file mode 100644 index cd509387..00000000 --- a/website/docs/OWNER-DIRECTIONS-AND-HANDOVER-20261129.md +++ /dev/null @@ -1,224 +0,0 @@ -# Current owner decisions and release handover — 29 November 2026 - -This file records the current task, verified evidence and remaining work for -web PR619. It supersedes conflicting historical combined-repository plans. -Do not infer completion from a plan, artifact upload or a message saying -"done". Report local, pushed, merged and live states separately. - -## Repository ownership - -- `unimatrix/fallback` was renamed to `unimatrix/plugins` (repository ID12). - It owns Minecraft plugins, GUI code, resource packs and server rollout. -- `unimatrix/MC` was renamed to `unimatrix/web` (repository ID1). - It owns website pages, control panels, APIs and website deployment. -- `dev/MC` remains a development reference. Its `main` was the older - `0a11a18274cb29af45f30377fd396df4e771d2c2` production baseline when checked. -- The latest dev website subtree, from `work/dunemenus-cutover-parity`, was - `331b838f51fe54380b0ce1f56d6351bbc28bf372`, exactly matching the website - already in the new web repository. The new item-card artwork and cookbook - were already there. An older dev/main import would be a regression. -- `https://github.com/unimatrixgit/mcdune-backup` is a recovery backup only. - The owner expressly said to keep it in case something breaks; it is not - authority to reset or replace current source. -- The earlier proposal to delete the combined upstream repository is - superseded by the rename/split. Do not delete `unimatrix/web`. - -## Mandatory build and access rules - -The owner's latest instruction is: "no custom plugins, no custom pages, -EVERYTHING goes through a build from hence forth." - -- Every plugin, page, asset and configuration alteration must be committed - and pass through the build before publication. No ad hoc replacement JAR, - hand-copied page or undocumented production patch. -- Code locally, test, commit to a review branch and push a PR. Keep web and - plugin changes separate. Never treat uploaded artifacts as installed ones. -- Local PC access and HTTPS Git work are authorised. Do not repeatedly ask - for task approval for already authorised routine work. -- Only the designated web/scope coordinating chat may use SSH, and only to - resolve blockers. The plugin chat and other agents do not inherit SSH access. -- Any necessary SSH alteration must be reflected in committed source or - deployment configuration, with verification, so the next build retains it. -- Credentials belong only in existing private stores. Do not put keys, - tokens, passwords, signatures or credential-bearing URLs in this handover, - source, PR text, build output or ordinary artifacts. -- The owner delegates routine implementation decisions on blockers to the - coordinator. An automatic approval rejection must still be honoured; - do not retry the same rejected merge through another transport. - -## Web PR619: code and evidence - -PR: `https://www.dunerealms.com/git/unimatrix/web/pulls/619` - -Branch: `work/web-only-source-and-forge-link-20261129` - -Code commit: `207002b48ae0820d0d20ed7ab4f6650054c00409` - -- Removes plugin modules, game-server source/configuration, world archives, - resource-pack sources, old plugin workflows and unrelated root materials - from the current website tree. This is pushed in PR619, not yet on web/main. -- Retains only the cookbook's necessary web inputs in `website/data/cookbook`. - All 32 recipe records and 16 emitted icon byte hashes match the previous - published catalogue. Provenance is in `source-manifest.json`. -- Moves website editor export utilities into `website/scripts`. The remaining - `tools/README.md` is a compatibility input for the previously installed - staging command (`git archive COMMIT website tools`); it contains no plugin - tooling. The committed staging script now archives only `website`. -- Adds signed `HQ1` item-design metadata support to both private and public - Exchange listings. It checks HMAC, registered template and material before - showing the saved name, quality, MK, lore and enchantments. It does not - issue items, modify listings or invent item stats. -- Restores a shared-menu DuneForge link and points the footer's DuneGit link - at the root repository register instead of the retired combined repo URL. - -Verification for that code commit: - -- Local production build passed: 2,534 embedded assets. -- Targeted checks: 28 passed. -- Complete local suite with loopback access: 1,846 total, 1,840 passed, - 6 skipped, zero failed. The earlier restricted run had environmental - loopback failures; do not report it as a production regression. -- Linux CI: run909 / API970 / job983 passed. - `https://www.dunerealms.com/git/unimatrix/web/actions/runs/909` -- No SSH alteration or live website deployment is claimed for PR619. -- PR618 previously integrated the workflow-only separation at - `af8c0e463f7204392a478834e2005ff69a5ff819` and is closed. It did not remove - the physical plugin source directories; that is PR619's job. - -## Item-card investigation - -The owner observed that cobblestone showed quality/MK while a custom item did -not. The live public response confirmed: - -- Listing9: Paul's Chopper, seller J.A.R.V.I.S. HQ, origin `jarvis-hq`, no - quality, MK or native metadata in the response before this fix. -- Cobblestone listings4/5: Common, MK1, native metadata present. -- Memorial bone listing3: Legendary, MK14, S1, native metadata present. - -The retained connector supports compressed Bukkit NBT and signed HQ1 designs; -the website only decoded the former. A real Bukkit memorial-bone fixture -already validates its stored grade. Do not erase existing metadata or assign -grades merely from the material name. The new tests cover valid HQ designs, -invalid signatures, missing credentials, template/material mismatches and -public-field redaction. Live verification of Paul's Chopper remains required -after the code and matching server configuration are published. - -## One shared header and footer: requirement and open verification - -The owner has repeatedly required ONE shared header and footer across the -portal, CP and all website surfaces. Do not solve this by maintaining two -similar-looking implementations. - -- Canonical header sources: `website/scripts/main-menu.mjs`, - `homepage-header.mjs`, `portal-navigation.mjs` and `site-chrome.mjs`. -- DuneForge workspace route: `https://cp.dunerealms.com/#forge/git-workspace`. - PR619 adds it to the shared My Account menu. -- The CP workspace switch labelled the Forge workspace "Development" - in `renderComfortNavigation` even though its registry label is DuneForge. - The follow-up navigation fix uses the registered workspace label and retains - the existing route and access-filtered workspace list. Its regression check - verifies the DuneForge button, destination and absence without Forge access. -- The public live portal and CP were compared directly: their returned - header HTML, footer HTML and header runtime bytes were identical at the - check. Both runtimes were 26,971 characters and contained the shared mount. - This does not prove the signed-in rendered views or cached browser state - match. The owner's reported visual difference still needs rendered, - signed-in verification; do not claim it is fixed from source equality alone. -- An in-app browser check reached the live CP sign-in shell and confirmed - the shared public navigation, but no signed-in session was available there. - No account was signed in or altered for this check. -- Pending: verify the signed-in rendering, remove the actual cause of any - visual divergence, keep workspace navigation distinct from global chrome, - and publish through the build. Do not replace the canonical shared header - with a second CP-specific header. - -## Plugin coordination and corrected GUI acceptance - -Coordinated chat: `01a224a7-103d-7b31-9afd-392a75dc0fd9` (plugins). - -The owner requires the actual GUI interface from the supplied DuneMenus ZIP, -with the existing working JARVIS backend and actions connected. Restyling -the old renderer was explicitly rejected as insufficient. Do not roll out -that restyle as fulfilment of the replacement requirement. - -- Plugin PR1 at `b11145bfbbf2f43c72fa186094d82e5739dd1bff` passed all seven - module builds/tests and resource-pack checks in plugin CI9/API969/job982. -- The owner directly approved that exact merge after automatic review - required approval for the 5,903-file cleanup. Verified plugins/main now - equals that exact tested commit. The agent reported PR1 closed after - Forgejo left its merged flag stale following the fast-forward. -- That merge is NOT proof of deployment and does NOT complete the later GUI - correction. The plugin chat has been prompted to continue the actual GUI - replacement with original JARVIS functions retained. -- Resource-pack evidence from the CI artifact: 917 entries, 75 additive - assets, 389 item-card mappings. CI ZIP SHA256: - `2a11edeaeb5be5dfd535de62f3ccaa4d79cd4b00fb74980cc4ee9d314f896db8`. - Use the CI artifact; the Windows local ZIP had different newline bytes. -- The historical DuneMenus installer removes the retained GUI JARs/data. - It is incompatible with the approved backend-preservation scope and must - not be used. No verified compatible fleet-deployment hook was identified. -- Gateway discovery and a read-only `id` probe on the registered migration - server failed before returning remote output. No server change occurred; - this is not proof that the game servers are down. Any access/rollout fix - remains coordinator-only and must be codified in the build configuration. -- Follow-up: direct SSH using the existing local private-key store succeeded - for the already registered `dev` account. No key was disclosed or created. - Read-only inspection found the installed staging checkout still fetches - the old combined MC remote and has a divergent worktree HEAD. Do not reset - that worktree. The trigger and builder now pin the canonical web main fetch - in committed source, and the build emits a hashed operational-script package. - Bootstrap installation completed from the exact tested CI package, as recorded - below. The divergent staging worktree was preserved. -- Existing actual functions, NPC callbacks, JARVIS integration and earned - player progress must survive the interface replacement. Validate mappings, - artifact hashes, installed versions and in-game operation before claiming - the rollout works. - -## Monitoring and immediate next steps - -- The owner asked the coordinator to check the plugin chat roughly every - 20 minutes, prompt it to continue and resolve bounded implementation - blockers. Stop monitoring once verified work is finished. No recurring - automation/timer was created in this task. -- Complete PR619 publication according to the owner's merge direction and - required checks; then verify the actual web/main tree and live serving - revision before saying plugin sources or the fixes are live. -- Finish the one-header/footer rendered verification and DuneForge naming. -- Keep the plugin chat moving on the actual GUI replacement, not the already - rejected old-renderer restyle. Do not deploy through the incompatible - historical installer or fabricate a fleet path. - -## Verified operational bootstrap, 29 November 2026 - -The coordinating chat installed only the two existing deployment entrypoints -from CI913/API974 artifact6467, `DuneRealms-Website-Operations`, built from -`4f6b49918b65b126baeab43fbc9db4d9959866cc`. Downloaded ZIP SHA256: -`4e7a58084e942f5d63254cc23b5b2ab2267875ec46220e5b22c939a4e4070d05`. - -The archive's exact file list, source repository/commit, sizes and per-file -hashes were verified against the committed source and manifest, then checked -again on the server. Both scripts passed `bash -n`. The build service was -inactive. Atomic replacements were root-owned mode0755, and their installed -bytes matched the artifact. No staging worktree reset, application publication, -role/account change or game-server change occurred during this bootstrap. - -| Existing target | Previous SHA256 | Installed SHA256 | -| --- | --- | --- | -| `/usr/local/bin/dunerealms-ci-trigger` | `8a080ea8878d30a94edc1a14d4de0ad660a4da82a19a5c8fefe2c8fd2c5dccb7` | `08f15b7df22eecdd89530a8a6e650ef6b5de8bb8258171893c804ac646d04ef9` | -| `/usr/local/bin/dunerealms-build-release` | `4acf4ce5851b2612dc34525c87a0b099b758b7844514708adafb9f700e7f737e` | `7a9772abdc0638c87afd6e710971ce7266f6e0ef76366ebb4df8fa5939c469e1` | - -The first bootstrap verification stopped before mutation because its assumed -shebang differed from the trigger's actual committed `#!/bin/bash`. Verification -was corrected to accept the two real committed Bash shebangs; hashes and all -other checks stayed unchanged. The subsequent bounded installation succeeded. -Main-only commit verification remains enabled. Live website publication and -post-deployment item/header checks remain separate steps. - -A subsequent staging-input audit found that the full website suite checks -`tools/README.md` and `.forgejo/workflows` as repository boundaries. The builder -archive must retain these web-owned policy inputs as well as `website`; otherwise -the same passing CI suite would fail in staging. This correction and its -regression check are committed for the next CI-built operations package. -The first installed builder hash above is superseded only after that package -passes and its new installed hash is recorded. No website release was attempted -through the incomplete staging archive. diff --git a/website/docs/WEB-REPOSITORY-SPLIT-20261129.md b/website/docs/WEB-REPOSITORY-SPLIT-20261129.md index 41f7ca19..1cb331e9 100644 --- a/website/docs/WEB-REPOSITORY-SPLIT-20261129.md +++ b/website/docs/WEB-REPOSITORY-SPLIT-20261129.md @@ -39,13 +39,9 @@ grades are preserved rather than inferred from material names. public/private boundaries, cookbook equality, navigation, exports and CI policy. - The first complete local suite encountered denied loopback connections; its failed publication/proxy checks passed when rerun with loopback access - (10 passed, 4 platform skips). The complete unrestricted rerun finished: - 1,846 tests, 1,840 passed, 6 skipped, zero failures. + (10 passed, 4 platform skips). A full unrestricted rerun is in progress. - Linux deployment tests require `fcntl`; native Windows cannot run them. - Linux CI run 909 (API run970, job983) passed for code commit - `207002b48ae0820d0d20ed7ab4f6650054c00409`, including build, website tests - and deployment policy. Review-branch artifact upload/deployment were skipped - as required by the main-only publication guard. + They must pass in the existing Linux CI before publication. - This document records source/build work. It does not claim a live deployment. No SSH changes were made for this batch. The owner authorises SSH only for the diff --git a/website/ops/README.md b/website/ops/README.md index 3dd50c7a..63f5140a 100644 --- a/website/ops/README.md +++ b/website/ops/README.md @@ -1,54 +1,31 @@ -# Migrated web deployment - -## Canonical website source after the repository split - -The trigger and staging builder fetch `refs/heads/main` explicitly from -`https://www.dunerealms.com/git/unimatrix/web.git`. They do not trust the -historical checkout's configured `origin`. The checkout is an object store for -the approved commit: a divergent worktree HEAD must not be reset or copied live. -Both scripts compare the requested commit with the freshly fetched canonical -main before queueing or building it. - -The staging archive includes `website`, the documentation-only `tools` directory -and the web-only `.forgejo` checks/workflows, so the same repository-policy tests -run in CI and staging. No plugin source is included. - -The website build packages these two scripts in `dist/deployment`, with a -manifest recording repository, source commit, byte sizes and SHA256 hashes. -CI uploads the tested package as `DuneRealms-Website-Operations`. Any necessary -bootstrap installation must use that exact built package, verify its manifest -and expected tested commit, and install only the two existing script targets: -`/usr/local/bin/dunerealms-ci-trigger` and -`/usr/local/bin/dunerealms-build-release`. Record installed hashes and the CI -reference. Do not install scripts from a dirty worktree or publish handwritten -live fixes. Normal website publication remains main-only through CI. - -The production website is hosted at `91.107.196.242`. The Forgejo Actions -workflow pins that host's SSH key and can trigger deployment only from `main`. -Its deploy key is restricted to `/usr/local/bin/dunerealms-ci-trigger`, which -rejects commits that do not match the current main branch. - -Forgejo, repositories, artifact storage, the rootless runner, container data, -build workspaces and deployment state use `/mnt/HC_Volume_107481500/dunegit`. -Compatibility links preserve the existing application and home-directory paths. -The volume is part of the live service and must remain attached. The services -require its mount before starting, rather than writing to an empty mountpoint. - -`promote-safe-v3.py` is installed as -`/usr/local/sbin/dunerealms-promote-safe-v3`. It prepares an immutable release, -checks a candidate website and panel, updates their shared nginx configuration, -checks public readiness, and restores the previous routing if that check fails. -Retired background workers are stopped and the active process list is saved. - -The first successful promotion retires the migrated baseline systemd website -services. Subsequent candidates are supervised by `dunerealms-runtime.service`. -The separate Forgejo service remains `dunegit.service`. - -Run the promoter routing checks with: - -```sh -python3 -m unittest discover -s website/ops -p 'test_*.py' -``` +# Migrated web deployment + +The production website is hosted at `91.107.196.242`. The Forgejo Actions +workflow pins that host's SSH key and can trigger deployment only from `main`. +Its deploy key is restricted to `/usr/local/bin/dunerealms-ci-trigger`, which +rejects commits that do not match the current main branch. + +Forgejo, repositories, artifact storage, the rootless runner, container data, +build workspaces and deployment state use `/mnt/HC_Volume_107481500/dunegit`. +Compatibility links preserve the existing application and home-directory paths. +The volume is part of the live service and must remain attached. The services +require its mount before starting, rather than writing to an empty mountpoint. + +`promote-safe-v3.py` is installed as +`/usr/local/sbin/dunerealms-promote-safe-v3`. It prepares an immutable release, +checks a candidate website and panel, updates their shared nginx configuration, +checks public readiness, and restores the previous routing if that check fails. +Retired background workers are stopped and the active process list is saved. + +The first successful promotion retires the migrated baseline systemd website +services. Subsequent candidates are supervised by `dunerealms-runtime.service`. +The separate Forgejo service remains `dunegit.service`. + +Run the promoter routing checks with: + +```sh +python3 -m unittest discover -s website/ops -p 'test_*.py' +``` ## CI artifact retention @@ -66,4 +43,4 @@ Forgejo removes the corresponding physical chunks through its existing `cleanup_actions` maintenance task; deleting API records need not immediately increase free disk space. Deployed application releases and their rollback retention are separate from CI artifact retention. No backups or Git history -are removed by this policy. +are removed by this policy. diff --git a/website/ops/dunerealms-build-release b/website/ops/dunerealms-build-release index 8e3209ab..3660a553 100644 --- a/website/ops/dunerealms-build-release +++ b/website/ops/dunerealms-build-release @@ -2,21 +2,20 @@ set -Eeuo pipefail BASE=/home/dunedeploy/ci-deploy REPO=/home/dunedeploy/web-deployment -SOURCE_URL=https://www.dunerealms.com/git/unimatrix/web.git # Share the publication mutex; no cleanup command is part of a build. exec 9< /mnt/HC_Volume_107481500/dunegit/ci/promotion/safe-lock flock --shared --nonblock 9 || { echo 'Publication mutex busy; build deferred to systemd retry'; exit 75; } SHA=$(cat "$BASE/pending-commit") [[ "$SHA" =~ ^[0-9a-f]{40}$ ]] || exit 1 cd "$REPO" -git fetch -q "$SOURCE_URL" refs/heads/main +git fetch -q origin main MAIN=$(git rev-parse FETCH_HEAD) [[ "$SHA" == "$MAIN" ]] || { echo 'Not current main'; exit 1; } DEST="$BASE/artifacts/$SHA" TMP="$BASE/artifacts/.${SHA}.tmp.$$" trap 'rm -rf "$TMP"' EXIT mkdir -p "$TMP" -git archive "$SHA" website tools .forgejo | tar -x -C "$TMP" +git archive "$SHA" website | tar -x -C "$TMP" cd "$TMP/website" corepack pnpm install --frozen-lockfile corepack pnpm build diff --git a/website/ops/dunerealms-ci-trigger b/website/ops/dunerealms-ci-trigger index 7b63920c..f4e567fb 100644 --- a/website/ops/dunerealms-ci-trigger +++ b/website/ops/dunerealms-ci-trigger @@ -3,8 +3,7 @@ set -euo pipefail SHA="${SSH_ORIGINAL_COMMAND:-}" [[ "$SHA" =~ ^[0-9a-f]{40}$ ]] || { echo "Ongeldige commit"; exit 1; } REPO=/home/dunedeploy/web-deployment -SOURCE_URL=https://www.dunerealms.com/git/unimatrix/web.git -git -C "$REPO" fetch -q "$SOURCE_URL" refs/heads/main +git -C "$REPO" fetch -q origin main MAIN=$(git -C "$REPO" rev-parse FETCH_HEAD) if [ "$SHA" != "$MAIN" ]; then echo "Geweigerd: commit is niet de huidige main"; exit 1; fi exec 9< /mnt/HC_Volume_107481500/dunegit/ci/promotion/safe-lock diff --git a/website/scripts/build.mjs b/website/scripts/build.mjs index 03e17f5a..77aceccd 100644 --- a/website/scripts/build.mjs +++ b/website/scripts/build.mjs @@ -1,5 +1,4 @@ import {recipeCatalogue,recipeIcons} from './recipe-catalogue.mjs'; -import {packageDeploymentScripts} from './deployment-package.mjs'; import {applySharedHeader,applySharedFooter,SHARED_FOOTER_SCRIPT,cleanLegacyChromeScript,assertSharedChrome,sharedFooterBrandScript} from './site-chrome.mjs'; import {SHARED_HEADER} from './portal-navigation.mjs'; import {sharedHomepageHeaderScript} from './homepage-header.mjs'; @@ -62,10 +61,6 @@ mkdirSync(path.join(dist,'server'),{recursive:true});mkdirSync(path.join(dist,'. let api=['public-item-metadata.mjs','feed-api.mjs','exchange-api.mjs','forum-api.mjs','community-api.mjs','portal-api.mjs'].map(file=>readFileSync(path.join(root,'worker',file),'utf8').replace(/^import .*;$/gm,'').replace(/export /g,'')).join('\n');let runtime=readFileSync(path.join(root,'worker/runtime.mjs'),'utf8').replace(/^import .*;$/gm,''); writeFileSync(path.join(dist,'server/index.js'),shardNames.map((name,i)=>'import DATA'+i+' from '+JSON.stringify('./'+name)+';').join('\n')+'\nconst ASSET_DATA=Object.assign({},'+shardNames.map((_,i)=>'DATA'+i).join(',')+');\n'+api+'\n'+runtime);cpSync(path.join(root,'.openai/hosting.json'),path.join(dist,'.openai/hosting.json'));console.log('Built Worker with',assetCount,'embedded website assets'); if(existsSync(path.join(root,'drizzle')))cpSync(path.join(root,'drizzle'),path.join(dist,'.openai/drizzle'),{recursive:true}); -// Native applications consume the same compiled chrome as the public Worker. -// Operational fixes travel in the tested artifact rather than as live-only edits. -packageDeploymentScripts(path.join(dist,'deployment'),buildCommit||null); - // Native applications consume the same compiled chrome as the public Worker. // nginx follows the atomically promoted current release, so no stale host copy // can retain an old Alpha version, navigation badge or rates page. diff --git a/website/scripts/deployment-package.mjs b/website/scripts/deployment-package.mjs deleted file mode 100644 index c5d63cc4..00000000 --- a/website/scripts/deployment-package.mjs +++ /dev/null @@ -1,17 +0,0 @@ -import {mkdirSync,readFileSync,writeFileSync} from 'node:fs'; -import path from 'node:path'; -import {fileURLToPath} from 'node:url'; -import {createHash} from 'node:crypto'; - -export function packageDeploymentScripts(output,sourceCommit=null,{sourceDirectory=fileURLToPath(new URL('../ops/',import.meta.url))}={}){ - if(sourceCommit!==null&&!/^[a-f0-9]{40}$/.test(sourceCommit))throw Error('Invalid deployment source commit'); - const files={}; - for(const name of ['dunerealms-ci-trigger','dunerealms-build-release']){ - const bytes=Buffer.from(readFileSync(path.join(sourceDirectory,name),'utf8').replaceAll('\r\n','\n')); - files[name]={sha256:createHash('sha256').update(bytes).digest('hex'),bytes:bytes.length}; - mkdirSync(output,{recursive:true});writeFileSync(path.join(output,name),bytes); - } - const manifest={schema:1,sourceRepository:'https://www.dunerealms.com/git/unimatrix/web.git',sourceCommit,files}; - writeFileSync(path.join(output,'manifest.json'),JSON.stringify(manifest,null,2)+'\n'); - return manifest; -} diff --git a/website/tests/cp-v2-navigation.test.mjs b/website/tests/cp-v2-navigation.test.mjs index e625e7ed..e09cd785 100644 --- a/website/tests/cp-v2-navigation.test.mjs +++ b/website/tests/cp-v2-navigation.test.mjs @@ -26,15 +26,3 @@ test('personal bank appears once directly below correspondence with existing acc test('shop administration opens the native commerce login in a separate tab',()=>{ const item=menu.workspaces.find(w=>w.id==='bureau').groups.flatMap(g=>g.items).find(i=>i.id==='shop-admin');assert.equal(item.href,'https://shop.dunerealms.com/admin/');assert.equal(item.target,'_blank');assert.ok(item.viewPermission); }); - -test('the CP workspace switch names DuneForge consistently and keeps its existing route',()=>{ - const start=source.indexOf('function renderComfortNavigation('),end=source.indexOf('\nif(parent',start); - assert(start>=0&&end>start);const calls=[],bar={children:[],replaceChildren(){this.children=[];},append(...children){this.children.push(...children);}}; - const element=(tag,cls,text)=>({tag,cls,text,children:[],setAttribute(){},append(...children){this.children.push(...children);}}); - const execute=workspaces=>{runInNewContext(source.slice(start,end)+';renderComfortNavigation("forge");',{ - menu:{workspaces},document:{querySelector:selector=>selector==='.comfort-workspaces'?bar:null},el:element,go:id=>calls.push(id), - });return bar.children.filter(node=>node.tag==='button');}; - const buttons=execute(menu.workspaces),forge=buttons.find(button=>button.text==='DuneForge'); - assert(forge);assert(!buttons.some(button=>button.text==='Development'));forge.onclick();assert.deepEqual(calls,['forge']); - assert(!execute(menu.workspaces.filter(workspace=>workspace.id!=='forge')).some(button=>button.text==='DuneForge')); -}); diff --git a/website/tests/deployment-package.test.mjs b/website/tests/deployment-package.test.mjs deleted file mode 100644 index 55bf510f..00000000 --- a/website/tests/deployment-package.test.mjs +++ /dev/null @@ -1,38 +0,0 @@ -import test from 'node:test'; -import assert from 'node:assert/strict'; -import {mkdtempSync,readFileSync,mkdirSync,writeFileSync} from 'node:fs'; -import {tmpdir} from 'node:os'; -import path from 'node:path'; -import {createHash} from 'node:crypto'; -import {packageDeploymentScripts} from '../scripts/deployment-package.mjs'; - -test('built operational scripts have deterministic bytes, exact hashes and recorded source identity',()=>{ - const folder=mkdtempSync(path.join(tmpdir(),'dune-web-deployment-')),source=path.join(folder,'source'),output=path.join(folder,'output');mkdirSync(source); - for(const name of ['dunerealms-ci-trigger','dunerealms-build-release'])writeFileSync(path.join(source,name),'#!/bin/bash\r\necho verified\r\n'); - const commit='a'.repeat(40),manifest=packageDeploymentScripts(output,commit,{sourceDirectory:source}); - assert.equal(manifest.sourceCommit,commit);assert.equal(manifest.sourceRepository,'https://www.dunerealms.com/git/unimatrix/web.git'); - for(const [name,record] of Object.entries(manifest.files)){ - const bytes=readFileSync(path.join(output,name));assert.equal(bytes.toString(),'#!/bin/bash\necho verified\n'); - assert.equal(record.bytes,bytes.length);assert.equal(record.sha256,createHash('sha256').update(bytes).digest('hex')); - } - assert.deepEqual(JSON.parse(readFileSync(path.join(output,'manifest.json'))),manifest); - assert.throws(()=>packageDeploymentScripts(output,'../main',{sourceDirectory:source}),/Invalid deployment source commit/); -}); - -test('website trigger and builder fetch only canonical web main even when checkout origin differs',()=>{ - for(const name of ['dunerealms-ci-trigger','dunerealms-build-release']){ - const source=readFileSync(new URL('../ops/'+name,import.meta.url),'utf8'); - assert.match(source,/^SOURCE_URL=https:\/\/www\.dunerealms\.com\/git\/unimatrix\/web\.git\r?$/m); - assert.match(source,/git (?:-C "\$REPO" )?fetch -q "\$SOURCE_URL" refs\/heads\/main/); - assert.doesNotMatch(source,/git .*fetch -q origin/); - assert.match(source,/rev-parse FETCH_HEAD/); - } -}); - -test('staging archive retains the repository-policy inputs used by the full website suite',()=>{ - const source=readFileSync(new URL('../ops/dunerealms-build-release',import.meta.url),'utf8'); - const archived=source.match(/^git archive "\$SHA" (.+) \| tar -x -C "\$TMP"\r?$/m)?.[1].trim().split(/\s+/); - assert.deepEqual(archived,['website','tools','.forgejo']); - // web-repository-scope.test.mjs checks tools/README.md and the two web workflows. - assert.deepEqual(readFileSync(new URL('../../tools/README.md',import.meta.url),'utf8').length>0,true); -});