9 Commits
Author SHA1 Message Date
NuklearRabbit 32ed4fcb5e perf: streamline repository and deployment awareness
ForgeFlow quality gate / quality (push) Canceled after 0s
2026-08-12 15:26:53 +02:00
NuklearRabbit 38e221cbd1 fix: harden repository refresh and server pull
ForgeFlow quality gate / quality (push) Canceled after 0s
2026-08-12 15:05:57 +02:00
NuklearRabbit bffad670ef fix: complete server pull deployment setup
ForgeFlow quality gate / quality (push) Canceled after 0s
2026-08-09 00:43:08 +02:00
NuklearRabbit 4c21616e72 fix: harden deployment discovery and preflight
ForgeFlow quality gate / quality (push) Canceled after 0s
2026-08-08 23:59:27 +02:00
NuklearRabbit f866b12fbf fix: make updater checksum verification self-contained
ForgeFlow quality gate / quality (push) Canceled after 0s
2026-08-01 19:13:05 +02:00
NuklearRabbit f7d6bc374f fix: reconcile server deployments across repository views
ForgeFlow quality gate / quality (push) Canceled after 0s
2026-08-01 18:57:55 +02:00
NuklearRabbit 958d5b84d3 fix: make Windows updater helper launch reliable
ForgeFlow quality gate / quality (push) Canceled after 0s
2026-08-01 17:59:55 +02:00
NuklearRabbit 8fa4891075 chore: release ForgeFlow 0.10.5
ForgeFlow quality gate / quality (push) Canceled after 0s
2026-08-01 17:32:40 +02:00
NuklearRabbit 58d361bbab fix: align deployment links across repository views
ForgeFlow quality gate / quality (push) Canceled after 0s
2026-08-01 17:05:03 +02:00
50 changed files with 1316 additions and 252 deletions
+2 -2
View File
@@ -4,7 +4,7 @@
ForgeFlow is een Windows-desktopapp voor wie Git, Gitea en eigen Docker- of Unraid-servers gebruikt. Je ziet in één werkruimte wat lokaal gewijzigd is, wat op Gitea staat en welke exacte commit op de server draait. ForgeFlow begeleidt je daarna veilig door review, commit, push, deployment en verificatie. ForgeFlow is een Windows-desktopapp voor wie Git, Gitea en eigen Docker- of Unraid-servers gebruikt. Je ziet in één werkruimte wat lokaal gewijzigd is, wat op Gitea staat en welke exacte commit op de server draait. ForgeFlow begeleidt je daarna veilig door review, commit, push, deployment en verificatie.
> Huidige release: **0.10.4** · [download de laatste Windows-release](https://gitea.itworx.tech/Jens/ForgeFlow/releases/latest) > Huidige release: **0.10.12** · [download de laatste Windows-release](https://gitea.itworx.tech/Jens/ForgeFlow/releases/latest)
![ForgeFlow release-overzicht](docs/screenshots/overview.png) ![ForgeFlow release-overzicht](docs/screenshots/overview.png)
@@ -39,7 +39,7 @@ npm install
npm run demo npm run demo
``` ```
Open daarna `http://127.0.0.1:4173`. Open daarna `http://127.0.0.1:41737`.
## De dagelijkse workflow ## De dagelijkse workflow
+50 -40
View File
@@ -1,4 +1,4 @@
ForgeFlow 0.10.4 source manifest ForgeFlow 0.10.12 source manifest
SHA-256 BYTES PATH SHA-256 BYTES PATH
(The manifest excludes itself, dependencies and generated release artifacts.) (The manifest excludes itself, dependencies and generated release artifacts.)
cedceb71eb846d99c7c4019031833c1c7f93b84a1c6073aec7d2435dc744ca3d 703 .gitea/workflows/quality.yml cedceb71eb846d99c7c4019031833c1c7f93b84a1c6073aec7d2435dc744ca3d 703 .gitea/workflows/quality.yml
@@ -34,9 +34,17 @@ a0cd06a96f23a94e118feb012be0fa1ac51345951cb2ba8e67fb8c889c4c342a 5007
f79908fb3dad98c38030c6e6be7c79a1999e0478ed9c2496923891954438daa1 4581 docs/RELEASE_AUDIT_0.6.0.md f79908fb3dad98c38030c6e6be7c79a1999e0478ed9c2496923891954438daa1 4581 docs/RELEASE_AUDIT_0.6.0.md
979a0b8e129979be6b265e8571d0a3c1e9ddd4ddb6b0bf55ae748d3478e51854 2296 docs/RELEASE_NOTES_0.10.0.md 979a0b8e129979be6b265e8571d0a3c1e9ddd4ddb6b0bf55ae748d3478e51854 2296 docs/RELEASE_NOTES_0.10.0.md
0eb44bda2209a5979a6ac693ac4cd4d235c0015031e54b9e895990f37bf60054 1433 docs/RELEASE_NOTES_0.10.1.md 0eb44bda2209a5979a6ac693ac4cd4d235c0015031e54b9e895990f37bf60054 1433 docs/RELEASE_NOTES_0.10.1.md
5d3240169765e3fb1d3cd391d09547101227e76dd4670ee46be8ca3a21553a03 894 docs/RELEASE_NOTES_0.10.10.md
36edb4f096a248fb8679bd13e5766befb478cf628c6ccfb21e3eda71bbec7633 992 docs/RELEASE_NOTES_0.10.11.md
a355d3f577c2ec85dde5dfd7b6995f4f1615e2f6bac597529f3ff102acd93c35 1292 docs/RELEASE_NOTES_0.10.12.md
8d713471a437a8a55b00d7e1dd95290680862107bc4e586cf27d727f6274e46c 577 docs/RELEASE_NOTES_0.10.2.md 8d713471a437a8a55b00d7e1dd95290680862107bc4e586cf27d727f6274e46c 577 docs/RELEASE_NOTES_0.10.2.md
0942fb2c4a4f972296423b5232687f7389e2c6417a9d48a3244beef9dec907b9 1164 docs/RELEASE_NOTES_0.10.3.md 0942fb2c4a4f972296423b5232687f7389e2c6417a9d48a3244beef9dec907b9 1164 docs/RELEASE_NOTES_0.10.3.md
8f4a0fe6dc250ae210cc2fc1c57c46091822ae6c2a58caa76e0091f255f9f30d 775 docs/RELEASE_NOTES_0.10.4.md 8f4a0fe6dc250ae210cc2fc1c57c46091822ae6c2a58caa76e0091f255f9f30d 775 docs/RELEASE_NOTES_0.10.4.md
05ed618f5a74a854363930128ca98939808517eedd28b9a508660a0c46e91d97 884 docs/RELEASE_NOTES_0.10.5.md
94bfb2783c1befad1197e1c5e32fc002222c94a28d70d48360a8d53ecd260d5c 772 docs/RELEASE_NOTES_0.10.6.md
226a3b2d4bc7f54841749a283fcdd71b643cd585ba74d673084bee829fef6ea2 903 docs/RELEASE_NOTES_0.10.7.md
4be29ad0cb7ebcf5625172b8d2bd7a67cdc6d64d3a94e2c3f0656cdfd42dcb7a 642 docs/RELEASE_NOTES_0.10.8.md
fb64517aa64d3ecfe8b51b09e198c2c9fbba96d0cd24a87301c7f6dea3076095 961 docs/RELEASE_NOTES_0.10.9.md
a0c00ff76acd1682bb5e0e8dcf6589c9480da436c9c6d30780a1ed58b4dad94f 1770 docs/RELEASE_NOTES_0.2.0.md a0c00ff76acd1682bb5e0e8dcf6589c9480da436c9c6d30780a1ed58b4dad94f 1770 docs/RELEASE_NOTES_0.2.0.md
5773ead01aa4c522c556295553787482d01b1f5242f053b2c61f120c4de4fa76 5963 docs/RELEASE_NOTES_0.3.0.md 5773ead01aa4c522c556295553787482d01b1f5242f053b2c61f120c4de4fa76 5963 docs/RELEASE_NOTES_0.3.0.md
d46de73cf6c4cd5c2ba3f455a7a2af2e0d64ee9d94a97fd1a0bfb44e35c1624a 1093 docs/RELEASE_NOTES_0.3.1.md d46de73cf6c4cd5c2ba3f455a7a2af2e0d64ee9d94a97fd1a0bfb44e35c1624a 1093 docs/RELEASE_NOTES_0.3.1.md
@@ -96,32 +104,32 @@ c230b931abf2293d2d44b7a69b94c35f1142c093cc46b88739a0de5cbd6d1896 1532
106538d4a14a5a7b13419f9520c582b19809e8fafe2cb8c7dce2bc3e600dd10a 397 examples/server/nginx-forgeflow-status.conf 106538d4a14a5a7b13419f9520c582b19809e8fafe2cb8c7dce2bc3e600dd10a 397 examples/server/nginx-forgeflow-status.conf
2dff25fb39ce8fc7844026a50524b23f241bec5b614eb05371c7f908a080f69a 398 examples/server/status-example.json 2dff25fb39ce8fc7844026a50524b23f241bec5b614eb05371c7f908a080f69a 398 examples/server/status-example.json
4a561ead5ba7cdfaf4efce91842a4308c5f2a77980205879d83835efb8a579db 1067 LICENSE 4a561ead5ba7cdfaf4efce91842a4308c5f2a77980205879d83835efb8a579db 1067 LICENSE
1f0f388df4397e548887bbc7579fd3c864581b86469c01703201ece7a6cbf931 13667 main.cjs d7cae22a646c8f06f339db799f2b9921ba1799cdc44e5d05578c04aaace103ab 14357 main.cjs
91a984a89dd57a084b9a2331763cacdb061582fb590f13df379d92c1a77a2ee1 352 OVERLAY-INSTRUCTIONS.md 91a984a89dd57a084b9a2331763cacdb061582fb590f13df379d92c1a77a2ee1 352 OVERLAY-INSTRUCTIONS.md
58e26cc15df56efc6413b7c45a3dda0997a86758616da9c2479ef859091d475f 179806 package-lock.json 198a8a51705fcea2ddf716558a49e06df5a8181c5476709c474d183b64890ca0 179808 package-lock.json
5b51588b7ef64f3a94ecad5fb5e5df4b26640614fdf5d69851875741a17e0c72 5474 package.json 84fa9b490e0845b1788d4f58741d733f0afd5946db5487dfba03a6e3018890cc 5782 package.json
2a597a5704c576783b8a72407fbc377fa7506b36a4596ea7f7bce126e394f837 1326 playwright.config.mjs 1237df9ddcbb5ac7dc4316f18c34ff4a7030e3e0d56216ade6dd07369e5e2a04 1353 playwright.config.mjs
69318fdf054be7aa2fe86ead9847da9da65745d8d5de548c8346f3ba0afc4892 12175 preload.cjs 16d6c37007c6c14dbf541060535c594308758477b867fc2a190c2946d74022b9 12196 preload.cjs
abe5dd6fd68f2970cd19ef134094907c67219061d8fe9a1a08324c78de4ad437 484 PUBLISH-AND-ENABLE-UPDATE.cmd abe5dd6fd68f2970cd19ef134094907c67219061d8fe9a1a08324c78de4ad437 484 PUBLISH-AND-ENABLE-UPDATE.cmd
f018383f755352ca448e2ebb1e19b1dba412a3eb793d61e64b02953e300754fd 10538 Publish-ForgeFlow-Release.ps1 f018383f755352ca448e2ebb1e19b1dba412a3eb793d61e64b02953e300754fd 10538 Publish-ForgeFlow-Release.ps1
688fff7d2c989adb97ebb7fae38962656b70304a0aa5d27433c56adf7f136de0 4196 Publish-Missing-Binary-Release.ps1 688fff7d2c989adb97ebb7fae38962656b70304a0aa5d27433c56adf7f136de0 4196 Publish-Missing-Binary-Release.ps1
ae6ee934ace29cf16106b40ea669578b4d4f754dae0c06e162820a1d66d9ff0d 10313 README.md 42e2f375c2fa9bea138428b85eb2bb93fe8bf6e4a5fc0cd728f2c6713a019df7 10315 README.md
1fa7bf646321e07e40d98f4a7529d5f748c600edd5283f62ee13574b4e97280f 14329 reports/architecture-audit.json 8f8dc5ff0c2967563457e4027d795f6f515253e0a459ecca5a9f5bcf0b658870 14650 reports/architecture-audit.json
c1ff18f1367691332b189bb7589843a5e0bbde4817e3dd29df4ade7ea71dbd52 1114 reports/architecture-audit.md 5e923f0096895f588fe66b187779cdb7cb5af6644010c6dcc4d55876930ae376 1220 reports/architecture-audit.md
509c7bcff5280349bd9f45ed6151f70372bad7010a9ea582c13e2ccab91fe0cd 6272 scripts/acceptance.mjs 509c7bcff5280349bd9f45ed6151f70372bad7010a9ea582c13e2ccab91fe0cd 6272 scripts/acceptance.mjs
8fe616851e6a089a59fd134905465019c33d26f6408ebd0613fff587b6c589e0 4400 scripts/apply-binary-update.ps1 d0745072321aca2c80f44460974a7926715a9f429164aaf7660dced40b52c736 4790 scripts/apply-binary-update.ps1
706b49e001837c91134044d3af132d58fb14955245bc1d5c36b413eb65867002 10486 scripts/apply-source-update.ps1 404863bcbe7292355662e3a326455df864d7279badc29f90866a3b837420df54 10745 scripts/apply-source-update.ps1
02e924227f6cad3777fd06660230c85df590d8ce95e134194a4d18970a240b88 4145 scripts/architecture-audit.mjs 02e924227f6cad3777fd06660230c85df590d8ce95e134194a4d18970a240b88 4145 scripts/architecture-audit.mjs
4490bed84761f76e1fd87ee3117fe53e82e60b7760329c97d68772d6d820ebae 8521 scripts/audit-installed-deployments.cjs 47a5b16e95934bfe510c18bf94547ae65acb980c0f0506ae156d1a486dfbdfc9 8985 scripts/audit-installed-deployments.cjs
6d46dd6826069d842f20f9f22a99042257db936cdea0bee8d294d2d7ea290126 3893 scripts/doctor.mjs 6d46dd6826069d842f20f9f22a99042257db936cdea0bee8d294d2d7ea290126 3893 scripts/doctor.mjs
0244d42896b8c44f734d0bb6cdcb29b5981342be2f070ce89f8d9eaf3e4d49e6 1793 scripts/generate-source-manifest.mjs 0244d42896b8c44f734d0bb6cdcb29b5981342be2f070ce89f8d9eaf3e4d49e6 1793 scripts/generate-source-manifest.mjs
842436680521311594e798848b050ae4e488d0595f0de57315f6ec081c049fb9 1266 scripts/prune-dist.mjs 842436680521311594e798848b050ae4e488d0595f0de57315f6ec081c049fb9 1266 scripts/prune-dist.mjs
b83d443f5724ac15393567f3a688aed8315fbe3e5966832c864a9466e0669464 8102 scripts/publish-binary-release.cjs b83d443f5724ac15393567f3a688aed8315fbe3e5966832c864a9466e0669464 8102 scripts/publish-binary-release.cjs
444b397d515d65a7ee59d3088cba869cbb812d2b8cc18fc5d255105e3edb58c2 1468 scripts/serve-demo.mjs 558ff442988f1396c174c7161ff5bd3ef0b2f43cfc31459ec7c3967faa146bc3 1694 scripts/serve-demo.mjs
c76507857292c5713e1c699cf02e24b80265da39af2cecd148034bdb874adbb6 5246 scripts/test-authenticode-chain.ps1 c76507857292c5713e1c699cf02e24b80265da39af2cecd148034bdb874adbb6 5246 scripts/test-authenticode-chain.ps1
4393f7dc5f417e6d601a68238f4e26791799a3634acec228fe4d79deaee85eb5 3109 scripts/validate-installed-connections.cjs 4393f7dc5f417e6d601a68238f4e26791799a3634acec228fe4d79deaee85eb5 3109 scripts/validate-installed-connections.cjs
e6127e1e62f39c70ddb1abf72f4d7e7b8e3f19ff1f219e1a3660353c2e0cdfac 2411 scripts/verify-release-signatures.mjs e6127e1e62f39c70ddb1abf72f4d7e7b8e3f19ff1f219e1a3660353c2e0cdfac 2411 scripts/verify-release-signatures.mjs
f32f00dc6740019578e811d9fa1b8c38592394475005a5a98360f94fdac7b81d 18500 scripts/verify.mjs 1ad4023136361431eeda4df740ec1be5d00d63be0d7a3533250da68c3971480d 21407 scripts/verify.mjs
0b9f03ba3c67ff7cdb2916a902ad8ce25e81a7c90b210e4ae52d2ad029efabf3 2353 scripts/write-release-checksums.mjs 0b9f03ba3c67ff7cdb2916a902ad8ce25e81a7c90b210e4ae52d2ad029efabf3 2353 scripts/write-release-checksums.mjs
619515f524cb89960370ffcbd3fafd3c0e178b95f69c5868b1dd44777f23ec1e 2081 setup-windows.ps1 619515f524cb89960370ffcbd3fafd3c0e178b95f69c5868b1dd44777f23ec1e 2081 setup-windows.ps1
dd613d04b366f2cd071a1685a414016a5fb008082ed1b4cb8b24b79c100f640a 2412 src/main/audit-service.cjs dd613d04b366f2cd071a1685a414016a5fb008082ed1b4cb8b24b79c100f640a 2412 src/main/audit-service.cjs
@@ -129,7 +137,7 @@ dd613d04b366f2cd071a1685a414016a5fb008082ed1b4cb8b24b79c100f640a 2412
2fb04b1494b39f5d7c0720fa5fd298cd46fa85dc1b696d77657592347fcf1819 2731 src/main/configuration-backup.cjs 2fb04b1494b39f5d7c0720fa5fd298cd46fa85dc1b696d77657592347fcf1819 2731 src/main/configuration-backup.cjs
86e9fc2eda66b4b563f6c4bbb87d3e8514340d484fb503b73137e63b6b05c3c9 14597 src/main/deploy-key-lifecycle-service.cjs 86e9fc2eda66b4b563f6c4bbb87d3e8514340d484fb503b73137e63b6b05c3c9 14597 src/main/deploy-key-lifecycle-service.cjs
7cbfe51973d6607203cb197652ed7f296a3f6b6b644df876957117866a47d802 2159 src/main/deployment-identity.cjs 7cbfe51973d6607203cb197652ed7f296a3f6b6b644df876957117866a47d802 2159 src/main/deployment-identity.cjs
9d0af5074093108a5248d0dde0ff70a666748e61f1954b630886a81e8f34072c 24079 src/main/deployment-service.cjs e36ae11f6f60c9520a1f7b77b034091900d49306ff8674b5293eb95d679dcc5c 24273 src/main/deployment-service.cjs
c157640e76d558906a9aa9881eda811196623ef1c65fa3467f32f0f84b0ddd0c 15095 src/main/diagnostics-service.cjs c157640e76d558906a9aa9881eda811196623ef1c65fa3467f32f0f84b0ddd0c 15095 src/main/diagnostics-service.cjs
a2ef47d5330095b92c2bd22fcc39962091881f9cb60d02e261eb1dd1bd693170 1974 src/main/external-tools-service.cjs a2ef47d5330095b92c2bd22fcc39962091881f9cb60d02e261eb1dd1bd693170 1974 src/main/external-tools-service.cjs
0b7476c2cfe1872601978c20a466c20fe58be35e81b2303e38a753fea62bbc27 32548 src/main/git-service.cjs 0b7476c2cfe1872601978c20a466c20fe58be35e81b2303e38a753fea62bbc27 32548 src/main/git-service.cjs
@@ -138,35 +146,36 @@ e28fc1ca2fd4c0116148f5005d793feddf04c36ef711d2d348560394d209a613 7253
3cc53e24e023aa0d8bf36c35ce9672ca98e6c74066512c8b59ab42274e838c22 21307 src/main/gitea-service.cjs 3cc53e24e023aa0d8bf36c35ce9672ca98e6c74066512c8b59ab42274e838c22 21307 src/main/gitea-service.cjs
2ad3b2e647377f687ad987fe248a142ad399ecac98e4b49965aa7efc6093e5fa 6914 src/main/inventory-classifier.cjs 2ad3b2e647377f687ad987fe248a142ad399ecac98e4b49965aa7efc6093e5fa 6914 src/main/inventory-classifier.cjs
dafdb09133d2b6ec2161a3f0b09354551e54fc606c8107976fca37405643be91 3404 src/main/inventory-review-service.cjs dafdb09133d2b6ec2161a3f0b09354551e54fc606c8107976fca37405643be91 3404 src/main/inventory-review-service.cjs
00989577aed509a7ddfdf9f4df09a196a393a85b5ea59b21089002215e69f065 25949 src/main/ipc.cjs f263ab067edea8dfeb962958d045ed4ab20b49cbeb965936f4ffa8c1dd0b7d59 25905 src/main/ipc.cjs
0eb1cfdcd3a37a0ec9502bf753966f87230c03580335798bef9265add42ee6fa 12530 src/main/ipc/deployment-handlers.cjs 0eb1cfdcd3a37a0ec9502bf753966f87230c03580335798bef9265add42ee6fa 12530 src/main/ipc/deployment-handlers.cjs
dc9b5971c9fefe8c374aa31916f5513601ce86003fd48b1d0e51330a909ae3a5 3442 src/main/ipc/operations-handlers.cjs dc9b5971c9fefe8c374aa31916f5513601ce86003fd48b1d0e51330a909ae3a5 3442 src/main/ipc/operations-handlers.cjs
629b0f4704cda6ed6288c5a6ec9e5d73d6ae3e2692c43581b258431b65b58e51 15887 src/main/ipc/repository-handlers.cjs 253d4f027de09e1e8fd46b40ef0da4eaf8350c0edfbf069b0a3429d712c7e8c4 15929 src/main/ipc/repository-handlers.cjs
62f2c80c8210e19370b8556b1f296cbae50dae6b758a39e209f8fb461691fd4c 4235 src/main/log-redaction.cjs 62f2c80c8210e19370b8556b1f296cbae50dae6b758a39e209f8fb461691fd4c 4235 src/main/log-redaction.cjs
958595a99fb242c127f475f3d8622bdba4c07b2d658703f69fe3992227a9107e 12909 src/main/preflight-service.cjs 958595a99fb242c127f475f3d8622bdba4c07b2d658703f69fe3992227a9107e 12909 src/main/preflight-service.cjs
720c4a0c554f46386d87c3ab6607d1fbcae66e50b69483c7dbba169d5128c851 680 src/main/process-error-policy.cjs
3096b4181566cb93a27e56e248c92105d4f4df5aee39d73c6c7d8ae8c2231bc0 1570 src/main/process-runner.cjs 3096b4181566cb93a27e56e248c92105d4f4df5aee39d73c6c7d8ae8c2231bc0 1570 src/main/process-runner.cjs
e64f7257d478955c675a133b3735b6afe138a69d2ad090898061e56f557c43e5 9926 src/main/production-acceptance-harness.cjs e64f7257d478955c675a133b3735b6afe138a69d2ad090898061e56f557c43e5 9926 src/main/production-acceptance-harness.cjs
fc7a5a2a42579a311f60a96bec4776942bf3f63428928820029b0dcf4874d1aa 2745 src/main/repository-monitor.cjs fc7a5a2a42579a311f60a96bec4776942bf3f63428928820029b0dcf4874d1aa 2745 src/main/repository-monitor.cjs
17e2a53f61cd7faba461b9f332967143087eaac95b72001462292976278ca305 7782 src/main/repository-service.cjs e48ac82e3a618459170969a6370c8a2d667594cd0b1915ccece38ba3f7eda6df 10303 src/main/repository-service.cjs
52b6d88ed1f5c904a13cdde92e5f96d1e2b5971ceef49862152197353cdc6490 27928 src/main/server-inventory.cjs 52b6d88ed1f5c904a13cdde92e5f96d1e2b5971ceef49862152197353cdc6490 27928 src/main/server-inventory.cjs
afef3841a3948b2121f8fba809aae4ea3da71bd2fda86973ba50200a5b1f89b2 14894 src/main/ssh-service.cjs afef3841a3948b2121f8fba809aae4ea3da71bd2fda86973ba50200a5b1f89b2 14894 src/main/ssh-service.cjs
90504e27bfabcd2f927ba29930fad9bb65520fdf871a2a9e49cbcefcb837d84c 25492 src/main/unraid-access-methods.cjs 5394d16c1ceceef700a4b2a47cda088713e24c2e42a4bf4f86b1fa6006e796a2 25877 src/main/unraid-access-methods.cjs
2ede80cd1565a7f2c282cc58d35dc0889d58d7465346bc723026b9c8be4df0ac 9501 src/main/unraid-deploy-key-host.cjs 5ba5a90ad9b7a0d05dd64fa64968cbdd7271bec4df6971f9685a9dd411e4fad4 9536 src/main/unraid-deploy-key-host.cjs
803a079499f7b8148495209dea43b505f6eb9bb587de19e82054e47183186c6e 30461 src/main/unraid-deployment-methods.cjs 6d9910dace52625f88e066a8485af2663c3735ff15e9ce9031441ce742710a21 30793 src/main/unraid-deployment-methods.cjs
2e63fdc0be0bf4d8e5c3d7d45ff5811d786b0821a08b82f511f1301696e12c9d 17157 src/main/unraid-deployment-service.cjs b8a6ef72cfd5c5405e3f1a48848b5ef1575ca82ebbe8cad816dff0dc7335c8ec 17184 src/main/unraid-deployment-service.cjs
f0861356c1ff4ca361c7004c1f7d935858f51cc74335a7ad2136021f2e612220 36016 src/main/unraid-inventory-methods.cjs a2fa253bb2664ad7e430d7a4cd4c4434b89e6c54c19c7b9e4f53fe08485339d3 42652 src/main/unraid-inventory-methods.cjs
9e682411f73450f595b5cc4dfb28939c6c58b9547d0a91e287c3efb4955e8840 26299 src/main/unraid-preflight-methods.cjs 2c0cf07921ca7ee5a9085ced44498c2e6798e5cc1e8a5ecf704c3cecabe39a25 27607 src/main/unraid-preflight-methods.cjs
d45220176aed72d692f9ae5534f9d40bcc359a2d08e025e74a3b3b505b8b9ed4 16559 src/main/unraid-runtime-methods.cjs d45220176aed72d692f9ae5534f9d40bcc359a2d08e025e74a3b3b505b8b9ed4 16559 src/main/unraid-runtime-methods.cjs
d4b3a07eeca687a49544a94ea574f7c6f7e0bc3aa9311b614d5244a468ca4a1b 11307 src/main/unraid-state-methods.cjs 9f92b5716ff72e676218863ca8f9678edf5d61db8a9cef5bdfe579cc4446d9c8 11783 src/main/unraid-state-methods.cjs
b654a9e45044ad32c61fabe4a6d897288615ec83739b53e3241ff881e32f56bd 21677 src/main/update-service.cjs a387ac9735624ef89d964ea59e035dae256b9915ba2cee22ae5cbc2894f5808a 22000 src/main/update-service.cjs
b5c304531bec358d059189a27cd9db8fa20cefb7f817e5eb0287001f7353f6a7 985 src/renderer/actions/command.js b5c304531bec358d059189a27cd9db8fa20cefb7f817e5eb0287001f7353f6a7 985 src/renderer/actions/command.js
d0bf607dd1de9d55f2947d0adf0997cd3ca5c269d10a5362cc1d8bc4d1a2a8ae 6706 src/renderer/actions/deployment-operation.js d0bf607dd1de9d55f2947d0adf0997cd3ca5c269d10a5362cc1d8bc4d1a2a8ae 6706 src/renderer/actions/deployment-operation.js
0f2070aa3b5c404aedf643837dfd7c5d547e8f45b2e9c97e4cfcf11951555474 17705 src/renderer/actions/deployment-profile.js 33e65457e44708cecbe859b8c8a0c51b4ab33219c3b7a9f9dad884089f07d367 17904 src/renderer/actions/deployment-profile.js
48bed91dd2a85bb51ee7307f7acc3b79c881ce8cf63b22ba79d5d079b265eb4b 7785 src/renderer/actions/inventory.js 48bed91dd2a85bb51ee7307f7acc3b79c881ce8cf63b22ba79d5d079b265eb4b 7785 src/renderer/actions/inventory.js
4227a05a20580a31127d2c929640defc3d36e8e3e89d6be830aab1940da81082 12267 src/renderer/actions/recovery.js 4227a05a20580a31127d2c929640defc3d36e8e3e89d6be830aab1940da81082 12267 src/renderer/actions/recovery.js
cdfaacdcd5ae04b0e5c79fefa21f5e09d5c810bcea504c5b6e1d6b744182ff84 15567 src/renderer/actions/setup-and-settings.js cdfaacdcd5ae04b0e5c79fefa21f5e09d5c810bcea504c5b6e1d6b744182ff84 15567 src/renderer/actions/setup-and-settings.js
5d8110918b2957889047e38eb4ab2953b2b4476394d9328bd40ae6e4246e65ef 18584 src/renderer/actions/shell.js a980f2e86d8286ea605a7259b9e9adcf3fda4f657b8d54a5d2d8765a7bbbec13 19065 src/renderer/actions/shell.js
edcfa0585af4b11ec3b7458969132bdf215830505859f1519f1635dc111ce48a 24333 src/renderer/app.js d399b9b277350225ba98634f595032eae4412a07071faea69185ba5f1c0f2330 26597 src/renderer/app.js
16efd2fca83004f781eae40ae0f706a004ce0bddf338dd087b8adf7eb10c1d84 85704 src/renderer/assets/itworx-mark.png 16efd2fca83004f781eae40ae0f706a004ce0bddf338dd087b8adf7eb10c1d84 85704 src/renderer/assets/itworx-mark.png
813b8cdeecac43794166f3db9d3c5d2c441e0292f9ab7bd465ba136d6201e95d 82476 src/renderer/assets/itworx-wordmark-dark.png 813b8cdeecac43794166f3db9d3c5d2c441e0292f9ab7bd465ba136d6201e95d 82476 src/renderer/assets/itworx-wordmark-dark.png
094c1b71cc2482a9db250ac175f45f3de68f53277dfbde371a03e61923d00988 75240 src/renderer/assets/itworx-wordmark-light.png 094c1b71cc2482a9db250ac175f45f3de68f53277dfbde371a03e61923d00988 75240 src/renderer/assets/itworx-wordmark-light.png
@@ -175,11 +184,11 @@ edcfa0585af4b11ec3b7458969132bdf215830505859f1519f1635dc111ce48a 24333
eef2f269ba4fbb76bf66ad328d481b461255d0acb753b30878dd4d4eaac57dc6 6924 src/renderer/events.js eef2f269ba4fbb76bf66ad328d481b461255d0acb753b30878dd4d4eaac57dc6 6924 src/renderer/events.js
a84da5aecbb16ce7983dba1f6d6aab1bf47b2e9a87c2933fa1afb8123f7ef7d6 1497 src/renderer/index.html a84da5aecbb16ce7983dba1f6d6aab1bf47b2e9a87c2933fa1afb8123f7ef7d6 1497 src/renderer/index.html
06180d9656dd254edfb6949c397f8e313954fc560ddcb22b3a35fce3c3e35655 21350 src/renderer/mock-bridge.js 06180d9656dd254edfb6949c397f8e313954fc560ddcb22b3a35fce3c3e35655 21350 src/renderer/mock-bridge.js
9fa522dad0088e2981c4ca5c392e93d6c92e04ff23fd1083d9040a3aa52d2b55 28101 src/renderer/mock-deployment-bridge.js 870024aff376826a92c9cf7452689cc1ecc5d9034f055bea56734f3f7fcea5e5 28703 src/renderer/mock-deployment-bridge.js
123518a4cfd47b7e510ffab9102a2fd82edc93754aaabd7bc0259d51dfce5d63 20032 src/renderer/mock-repository-bridge.js 81b0155dd51c7bc8871fd29bd7fdb28857cf11a86ed6d6953238c04c2774800c 20033 src/renderer/mock-repository-bridge.js
94fa265c2fe9ca8d644f0ce9b620b6f85d9b25dca5802c4e9195b66dcbe80120 6522 src/renderer/operations.js 94fa265c2fe9ca8d644f0ce9b620b6f85d9b25dca5802c4e9195b66dcbe80120 6522 src/renderer/operations.js
6776e0adb690b8f36274bfc5b31e3140054893c46ba64621c4f56a0d91b52fc2 78323 src/renderer/styles.css 21b8f3228bddd6da06613857763282d1f88f4eeab3d063f3a63395d7b567f2e4 80004 src/renderer/styles.css
1703e64533b7e2717b27c5776296c7dd76331e6f97e8005aea9fd688f1aee3ae 94834 src/renderer/views.js 8bc794e191aa22a13cbbc89c9b3882e0c3070e1365a7c02cfe381a62d81877d9 101549 src/renderer/views.js
0a1e9d9d6cd4d190eb7f85dbc6668d80600b1cf2749cc0c2c51cc428f506f20d 1121 src/shared/clone-target.cjs 0a1e9d9d6cd4d190eb7f85dbc6668d80600b1cf2749cc0c2c51cc428f506f20d 1121 src/shared/clone-target.cjs
5d425d5c2f939d0f6beebee7ebb0c77146cb7e318535ba7286ec7081a4dc2269 2497 src/shared/deployment-policy.cjs 5d425d5c2f939d0f6beebee7ebb0c77146cb7e318535ba7286ec7081a4dc2269 2497 src/shared/deployment-policy.cjs
029e600229714d033c28e2dcb77817aa8269847001782ae0012960e83ffd183f 3057 src/shared/git-status.cjs 029e600229714d033c28e2dcb77817aa8269847001782ae0012960e83ffd183f 3057 src/shared/git-status.cjs
@@ -193,13 +202,13 @@ f8853dce6fdf360d5df2fbe2b6df3e5687630c807fee5ba8436679b34ec737ea 2436
058aeaa5d9bfe377c7e322f213c7871ecc4151b5d08ef790992f4ee28d857658 743 START-FORGEFLOW-OVERLAY.ps1 058aeaa5d9bfe377c7e322f213c7871ecc4151b5d08ef790992f4ee28d857658 743 START-FORGEFLOW-OVERLAY.ps1
f5b0ea887fcdeadec78c1ad49b0ec7979723562f5c0b730703acb77a37281ee0 1009 tests/acceptance.test.mjs f5b0ea887fcdeadec78c1ad49b0ec7979723562f5c0b730703acb77a37281ee0 1009 tests/acceptance.test.mjs
a4e5947204ff6878e601e32477bc85b53cd0153baf95a161c8935b6e5466c257 1155 tests/audit-service.test.mjs a4e5947204ff6878e601e32477bc85b53cd0153baf95a161c8935b6e5466c257 1155 tests/audit-service.test.mjs
2d57a66bb2a6461e4c3266f14998d505ba0582135b0bbcf8fce9f1542a70007a 10479 tests/browser/forgeflow.spec.mjs e8802b78b94af7245f7752e0a5f8697064aad2aae8bd002195ae052d69e59670 11619 tests/browser/forgeflow.spec.mjs
454edeaccb2bd41043bc918d3e3a6127db14339031d6a1c1562ac855e90455d2 4318 tests/clone-target.test.mjs 454edeaccb2bd41043bc918d3e3a6127db14339031d6a1c1562ac855e90455d2 4318 tests/clone-target.test.mjs
ac17f8bbe9e388b80abef7792c8b184a1fd482c93f13d23a478e433961020f75 17214 tests/config-store.test.mjs ac17f8bbe9e388b80abef7792c8b184a1fd482c93f13d23a478e433961020f75 17214 tests/config-store.test.mjs
f1463326aee79842d265687ae628189ce54e92544600f2bd14073780287cfb14 2502 tests/configuration-backup.test.mjs f1463326aee79842d265687ae628189ce54e92544600f2bd14073780287cfb14 2502 tests/configuration-backup.test.mjs
b7e009fed4171d6dd6b4c3154ba1d3f7198e98f5b79b298687841fc8169447cd 9354 tests/deploy-key-lifecycle.test.mjs b7e009fed4171d6dd6b4c3154ba1d3f7198e98f5b79b298687841fc8169447cd 9354 tests/deploy-key-lifecycle.test.mjs
1dc6477bd07de78be189e6e8195ec339eb9d75820c4dbd5b073b8520ee21f6b5 1938 tests/deployment-policy.test.mjs 1dc6477bd07de78be189e6e8195ec339eb9d75820c4dbd5b073b8520ee21f6b5 1938 tests/deployment-policy.test.mjs
50e90cd41dae952a14903c40c0cb1fd191d7b875cfeb730f06a454e755fad7ce 9076 tests/deployment-status.test.mjs bf4576901e32662d832687a2761852aa1b2cffe256de5044f18c6637c189463b 9780 tests/deployment-status.test.mjs
fae3634bae871abade4d487b94b4741b50e787804dbd6135249f634fdd83c6d0 3800 tests/diagnostics.test.mjs fae3634bae871abade4d487b94b4741b50e787804dbd6135249f634fdd83c6d0 3800 tests/diagnostics.test.mjs
dd121d96ca265a027cd415a52064500a4541b2f8a662f4f4b25f2f996d52b5da 762 tests/external-tools.test.mjs dd121d96ca265a027cd415a52064500a4541b2f8a662f4f4b25f2f996d52b5da 762 tests/external-tools.test.mjs
e7aebcc0d484a6a59d463d5cb26c11b3ad56e28f6535e7c38a0fe166a41565ea 13690 tests/git-integration.test.mjs e7aebcc0d484a6a59d463d5cb26c11b3ad56e28f6535e7c38a0fe166a41565ea 13690 tests/git-integration.test.mjs
@@ -213,19 +222,20 @@ fcc9a063882840dd89d74c2785284c8f2f6a9e5acec482b6d89ed8de62efdb85 9635
caf98cbd9de9b119dae610ee53fa333a7a11214f34762247452fbb85e8bbf725 2392 tests/log-redaction.test.mjs caf98cbd9de9b119dae610ee53fa333a7a11214f34762247452fbb85e8bbf725 2392 tests/log-redaction.test.mjs
96432a97d313f331694900bf0a2c21e38c20eac96d59147977aeed9055a9e3ad 2287 tests/partial-staging.test.mjs 96432a97d313f331694900bf0a2c21e38c20eac96d59147977aeed9055a9e3ad 2287 tests/partial-staging.test.mjs
1b6c920e18a248f78acaed6187197c88ec8d911b62d5e2a9f8ad57b91ae80499 11827 tests/preflight.test.mjs 1b6c920e18a248f78acaed6187197c88ec8d911b62d5e2a9f8ad57b91ae80499 11827 tests/preflight.test.mjs
7f2751ea2621f76b5427f442e931344d13e97faa7b6ef3151949bbd6a03097cf 1205 tests/process-error-policy.test.mjs
0cb884cf62c1cb02cf59a81662be055bcb5339d176de85e2a3eeb8e8573e11b3 6435 tests/production-acceptance.test.mjs 0cb884cf62c1cb02cf59a81662be055bcb5339d176de85e2a3eeb8e8573e11b3 6435 tests/production-acceptance.test.mjs
629ba26395c0b49cc5fdee6b0646d75369eb6338e1cc7b59509938f97eea08ec 9601 tests/renderer-workflow.test.mjs d4980aa7d2d364793f38771011383348be472d5447b6ee88a4d9e5f3a3b3ffa9 9911 tests/renderer-workflow.test.mjs
2b4956fa4df4624a04117737e57ba74020564330ff71303b5746d8ccc881e880 854 tests/repository-matching.test.mjs 2b4956fa4df4624a04117737e57ba74020564330ff71303b5746d8ccc881e880 854 tests/repository-matching.test.mjs
62e6d3df7051778124648c808caec634a6b2c439660dc556392ea10beec926d1 1870 tests/repository-monitor.test.mjs 62e6d3df7051778124648c808caec634a6b2c439660dc556392ea10beec926d1 1870 tests/repository-monitor.test.mjs
ebd3c0825bc9e2f1690cfd51e93a96bd33e939eb9c546aa373dd948b8cf71a69 7781 tests/repository-service.test.mjs 32056b36a7e78701e8b9253ea78646ab4ecd88c5788841a1459177417ecb2e08 10441 tests/repository-service.test.mjs
d49c772e3c7ddaa12dc5a1d4fc4cb474a4d99ae06fa5dab5a6cf1c44acb9ed6f 3463 tests/security-validation.test.mjs d49c772e3c7ddaa12dc5a1d4fc4cb474a4d99ae06fa5dab5a6cf1c44acb9ed6f 3463 tests/security-validation.test.mjs
bab853feb0e22aa25af17989baaa632c01efa636533ea67407fecfdd973c7024 627 tests/semver.test.mjs bab853feb0e22aa25af17989baaa632c01efa636533ea67407fecfdd973c7024 627 tests/semver.test.mjs
e631e9ca49a5bac7075860aac2ff4d377a32a78377b70e06ecf833f0f192fd5f 11552 tests/server-inventory-branches.test.mjs 12cb3b240bdd0922566323c0014838ca067ad10d9d4009943165ae2c4e93bc6f 11786 tests/server-inventory-branches.test.mjs
020eccfa9c4aef7a4ac4736d9af90518fcb6d1ad75aedcfaa1c92832a9e3d6d8 4609 tests/shell-verification.test.mjs 020eccfa9c4aef7a4ac4736d9af90518fcb6d1ad75aedcfaa1c92832a9e3d6d8 4609 tests/shell-verification.test.mjs
0d1bc4d623ce299337736c577ec61c8ffd6974ebe20335b72838d10eae35ecb1 7993 tests/ssh-service.test.mjs 0d1bc4d623ce299337736c577ec61c8ffd6974ebe20335b72838d10eae35ecb1 7993 tests/ssh-service.test.mjs
8a6a8477eb94b85ccef18cddd2640afb0d1eafa679c96bc7de20428d5d69e1be 1794 tests/tool-invocation.test.mjs 8a6a8477eb94b85ccef18cddd2640afb0d1eafa679c96bc7de20428d5d69e1be 1794 tests/tool-invocation.test.mjs
4182b61e395aff310b9a964c973a43c3566df0b44c454054c3abdd9459e86e3b 49134 tests/unraid-deployment.test.mjs db0a347cdab1da11a04d41981695a65d7244367c46f0cdc868326e8d00d73cbf 56694 tests/unraid-deployment.test.mjs
074031cac5018aa74c2bb57ecaf114521d69da707aa6170dda65983690bb1691 21487 tests/update-service.test.mjs bf95071f8d8bec6dcf2c889f1f9d83be1b56178dc0d2be84da555848b6319cbc 25650 tests/update-service.test.mjs
9cea5c1d5ba3e0972a0b5c7236cf1f7c5616373e0a39ea4a492ecebf70452e40 948 tests/validation.test.mjs 9cea5c1d5ba3e0972a0b5c7236cf1f7c5616373e0a39ea4a492ecebf70452e40 948 tests/validation.test.mjs
7ef4d4b9f5f3e6979293b29d571ce0e39f83197f3cade2d999a9cea7bacdd84d 1781 tests/zip-writer.test.mjs 7ef4d4b9f5f3e6979293b29d571ce0e39f83197f3cade2d999a9cea7bacdd84d 1781 tests/zip-writer.test.mjs
8f36b542736f2933bad8b9464ad7fa37b68196009c81cf702ce3b677cd637dea 767 UPDATE_FROM_0.3.2.md 8f36b542736f2933bad8b9464ad7fa37b68196009c81cf702ce3b677cd637dea 767 UPDATE_FROM_0.3.2.md
+10
View File
@@ -0,0 +1,10 @@
# ForgeFlow 0.10.10
## Complete server-pull deployment repair
- Missing repository-scoped read-only deploy keys can be provisioned and verified from Unraid against the exact Gitea branch.
- A repository deployment root can now remain above its Compose working directory without breaking workload recognition or being overwritten by inventory refresh.
- Nested Compose files are preserved as repository-relative deployment paths, including Ludarium, Launchpad and ITWorx MCP Hub layouts.
- The **Fix write access** action now receives its permission-report parser correctly instead of reporting a false write-access failure.
- Server-pull preflight proves every required deployment file at the exact Gitea commit before any container activation starts.
- Runtime secrets remain in server-side `.env` files and preserved appdata paths; no secret values are written to Git or diagnostic output.
+10
View File
@@ -0,0 +1,10 @@
# ForgeFlow 0.10.11
## Resilient repository refresh and consistent server pull
- Temporary Gitea list failures now use the in-session **last-known-good** repository inventory while local and server state continue to refresh. The UI clearly reports that remote data is stale.
- A **closed output pipe** from a detached parent process is no longer treated as a fatal desktop-app exception.
- Server pull, deploy-key verification, deployment, rollback and metadata now consistently prefer the verified **linked checkout origin** over a stale URL detected earlier on the server.
- Repository-scoped **read-only deploy key** checks remain fail-closed; a changed SSH host still requires explicit trust and access reconfiguration.
- The local **browser test server** now has a dedicated port and identity endpoint, preventing another localhost application from being mistaken for ForgeFlow.
- All 42 responsive browser flows pass across dark/light, compact/wide and reduced-motion configurations.
+12
View File
@@ -0,0 +1,12 @@
# ForgeFlow 0.10.12
## Faster awareness with stricter deployment truth
- Repository refreshes are **coalesced** and briefly cache Gitea inventory and workspace discovery; a manual refresh remains fully forced and file changes arriving mid-refresh receive one trailing refresh.
- Server discovery reuses its Docker and Compose evidence for existing deployment profiles instead of opening a separate SSH session for every linked workload.
- Deployment status only claims **exact Gitea commit parity** after comparing a concrete branch SHA with the live server SHA; matching repository provenance alone is no longer sufficient.
- Container discovery uses **batched Docker inspect** with a safe per-container fallback when a container disappears during the scan.
- Active Gitea and SSH deployment polling uses **bounded worker pools**, improving multi-deployment latency without flooding external services.
- A **stopped container** can no longer be marked healthy because another process answers on its previous healthcheck port.
- Large repository and server-inventory lists use offscreen rendering containment to reduce layout and paint work.
- Inventory diagnostics now include scan and state-refresh durations, and Gitea bulk verification fails fast after a confirmed connectivity outage.
+10
View File
@@ -0,0 +1,10 @@
# ForgeFlow 0.10.5
## Consistent repository and deployment links
- Every repository workspace now shows all configured deployment environments in a compact, directly actionable strip.
- The repository deployment tab includes every detected server workload linked to that repository, including its container, Compose identity, server and runtime state.
- A workload is only labelled linked when its repository and resolved profile both exist in the current ForgeFlow configuration.
- Stale or incomplete metadata is shown as **Link unresolved** and routed through explicit reconciliation instead of being presented as a healthy deployment.
- The global deployment inventory links directly to the correct repository deployment profile.
- Responsive browser coverage now verifies valid links, unresolved links, repository navigation and scrolling across dark/light and scaled layouts.
+9
View File
@@ -0,0 +1,9 @@
# ForgeFlow 0.10.6
## Permanent Windows updater launch repair
- ForgeFlow no longer launches hidden PowerShell update helpers with Node's defective Windows `detached` process mode.
- Binary and source updater processes remain hidden, are explicitly unreferenced after their verified handshake, and continue independently when ForgeFlow closes.
- A real Windows regression test now exercises the exact production Node spawn options instead of using a different process API.
- Startup is still fail-closed: ForgeFlow remains open unless the request-scoped helper status reaches `started`.
- Versions 0.10.4 and 0.10.5 need a one-time direct installation of 0.10.6 because their installed launcher cannot execute its own helper; updates after 0.10.6 use the repaired path.
+10
View File
@@ -0,0 +1,10 @@
# ForgeFlow 0.10.7
## Reliable server-to-repository recognition
- Live, running workloads with one unique exact provenance or runtime-identity match are now linked automatically during normal server discovery.
- Automatic adoption creates only ForgeFlow configuration and observed state; it performs no container changes and never automatically removes stale profiles.
- Ambiguous, duplicate, external and monitoring-only workloads remain behind explicit **Review & link** confirmation.
- Every linked repository now displays an `S` deployment badge with its profile count in the repository sidebar.
- The repository release rail reports **Linked** with container and server identity even when a legacy workload has no verifiable live commit yet.
- DevRunbook-style DockerMan deployments therefore show the same linked relationship in Deployments, the repository sidebar and the repository workspace.
+9
View File
@@ -0,0 +1,9 @@
# ForgeFlow 0.10.8
## Self-contained checksum verification
- Binary and source update helpers no longer depend on the optional PowerShell `Get-FileHash` cmdlet.
- Both helpers calculate checksums directly with the built-in .NET SHA-256 implementation.
- A real Windows regression test clears `PSModulePath` and verifies the downloaded binary successfully in that minimal environment.
- The helper still validates the exact published checksum before waiting for ForgeFlow to exit or changing installed files.
- This release retains the reliable non-detached launcher and server-to-repository recognition improvements from 0.10.6 and 0.10.7.
+10
View File
@@ -0,0 +1,10 @@
# ForgeFlow 0.10.9
## Reliable deployment inventory and preflight
- Unraid inventory now includes containers without healthchecks. Docker's complete JSON state is parsed safely instead of using a failing Go-template lookup.
- ForgeFlow is single-instance: opening it again focuses the existing window, preventing concurrent inventory scans and configuration writes.
- Server pull verifies required Compose files or the Dockerfile at the exact Gitea commit before any deployment operation starts.
- Server-pull verification now separates deploy-ready access from optional live-SHA and runtime-health evidence. A recoverable workload is no longer shown as blocked merely because parity is not yet provable.
- Deployment cards and audit output show concrete access blockers and non-blocking warnings instead of a generic incomplete result.
- All discovery, verification and preflight checks remain non-destructive; no containers are changed during these checks.
+21 -1
View File
@@ -33,6 +33,10 @@ const {
ExternalToolsService, ExternalToolsService,
} = require("./src/main/external-tools-service.cjs"); } = require("./src/main/external-tools-service.cjs");
const { registerIpc } = require("./src/main/ipc.cjs"); const { registerIpc } = require("./src/main/ipc.cjs");
const {
installOutputPipeGuards,
isBrokenPipeError,
} = require("./src/main/process-error-policy.cjs");
let mainWindow; let mainWindow;
let repositoryMonitor; let repositoryMonitor;
@@ -41,6 +45,18 @@ let diagnostics;
let configStore; let configStore;
let tray; let tray;
let quitCleanupStarted = false; let quitCleanupStarted = false;
const reportBrokenOutputPipe = (error) => {
const report = diagnostics?.warning("process.output-pipe.closed", {
code: error?.code || null,
message: error?.message || "The parent output pipe was closed.",
});
report?.catch(() => {});
};
installOutputPipeGuards({ onBrokenPipe: reportBrokenOutputPipe });
const ownsSingleInstanceLock = app.requestSingleInstanceLock();
if (!ownsSingleInstanceLock) app.quit();
else app.on("second-instance", () => showMainWindow());
function broadcast(channel, payload) { function broadcast(channel, payload) {
for (const window of BrowserWindow.getAllWindows()) { for (const window of BrowserWindow.getAllWindows()) {
@@ -171,6 +187,7 @@ function createWindow() {
app app
.whenReady() .whenReady()
.then(async () => { .then(async () => {
if (!ownsSingleInstanceLock) return;
session.defaultSession.webRequest.onHeadersReceived((details, callback) => { session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
callback({ callback({
responseHeaders: { responseHeaders: {
@@ -214,6 +231,10 @@ app
await audit.initialize(); await audit.initialize();
process.on("uncaughtException", (error) => { process.on("uncaughtException", (error) => {
if (isBrokenPipeError(error)) {
reportBrokenOutputPipe(error);
return;
}
diagnostics diagnostics
?.error("process.uncaught-exception", error) ?.error("process.uncaught-exception", error)
.finally(() => app.exit(1)); .finally(() => app.exit(1));
@@ -419,7 +440,6 @@ app
}); });
}) })
.catch(async (error) => { .catch(async (error) => {
console.error("[startup]", error);
await diagnostics?.error("app.startup.failed", error); await diagnostics?.error("app.startup.failed", error);
await diagnostics?.flush(); await diagnostics?.flush();
app.exit(1); app.exit(1);
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "forgeflow", "name": "forgeflow",
"version": "0.10.4", "version": "0.10.12",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "forgeflow", "name": "forgeflow",
"version": "0.10.4", "version": "0.10.12",
"dependencies": { "dependencies": {
"ssh2": "1.17.0" "ssh2": "1.17.0"
}, },
+9 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "forgeflow", "name": "forgeflow",
"version": "0.10.4", "version": "0.10.12",
"private": true, "private": true,
"description": "Desktop release cockpit for local Git, Gitea Actions and controlled exact-commit deployments.", "description": "Desktop release cockpit for local Git, Gitea Actions and controlled exact-commit deployments.",
"main": "main.cjs", "main": "main.cjs",
@@ -109,6 +109,14 @@
"docs/RELEASE_NOTES_0.10.2.md", "docs/RELEASE_NOTES_0.10.2.md",
"docs/RELEASE_NOTES_0.10.3.md", "docs/RELEASE_NOTES_0.10.3.md",
"docs/RELEASE_NOTES_0.10.4.md", "docs/RELEASE_NOTES_0.10.4.md",
"docs/RELEASE_NOTES_0.10.5.md",
"docs/RELEASE_NOTES_0.10.6.md",
"docs/RELEASE_NOTES_0.10.7.md",
"docs/RELEASE_NOTES_0.10.8.md",
"docs/RELEASE_NOTES_0.10.9.md",
"docs/RELEASE_NOTES_0.10.10.md",
"docs/RELEASE_NOTES_0.10.11.md",
"docs/RELEASE_NOTES_0.10.12.md",
"docs/CURRENT_STATE.md", "docs/CURRENT_STATE.md",
"docs/MUTATION_MODEL.md", "docs/MUTATION_MODEL.md",
"docs/RELEASING.md", "docs/RELEASING.md",
+2 -2
View File
@@ -18,14 +18,14 @@ export default defineConfig({
workers: process.env.CI ? 2 : 3, workers: process.env.CI ? 2 : 3,
reporter: [["line"], ["html", { outputFolder: "artifacts/browser-report", open: "never" }]], reporter: [["line"], ["html", { outputFolder: "artifacts/browser-report", open: "never" }]],
use: { use: {
baseURL: "http://127.0.0.1:4173", baseURL: "http://127.0.0.1:41737",
screenshot: "only-on-failure", screenshot: "only-on-failure",
trace: "retain-on-failure", trace: "retain-on-failure",
video: "retain-on-failure", video: "retain-on-failure",
}, },
webServer: { webServer: {
command: "node scripts/serve-demo.mjs", command: "node scripts/serve-demo.mjs",
url: "http://127.0.0.1:4173", url: "http://127.0.0.1:41737/__forgeflow_test_ready__",
reuseExistingServer: !process.env.CI, reuseExistingServer: !process.env.CI,
timeout: 30_000, timeout: 30_000,
}, },
+1 -1
View File
@@ -54,7 +54,7 @@ contextBridge.exposeInMainWorld(
serverId, serverId,
remoteFolder, remoteFolder,
}), }),
refreshRepositories: () => invoke('repositories:refresh'), refreshRepositories: (options = {}) => invoke('repositories:refresh', options),
discoverRepositories: (roots) => invoke('repositories:discover', { roots }), discoverRepositories: (roots) => invoke('repositories:discover', { roots }),
favoriteRepository: (fullName, favorite) => invoke('repository:favorite', { fullName, favorite }), favoriteRepository: (fullName, favorite) => invoke('repository:favorite', { fullName, favorite }),
linkRepository: (fullName, localPath) => invoke('repository:link', { fullName, localPath }), linkRepository: (fullName, localPath) => invoke('repository:link', { fullName, localPath }),
+106 -90
View File
@@ -1,5 +1,5 @@
{ {
"generatedAt": "2026-07-29T22:49:48.766Z", "generatedAt": "2026-08-01T15:23:33.157Z",
"thresholds": { "thresholds": {
"preferredMaximumLines": 750, "preferredMaximumLines": 750,
"justificationRequiredLines": 1000 "justificationRequiredLines": 1000
@@ -9,9 +9,9 @@
"cyclomaticHotspots": [ "cyclomaticHotspots": [
{ {
"file": "src/renderer/actions/shell.js", "file": "src/renderer/actions/shell.js",
"lines": 506, "lines": 518,
"branches": 98, "branches": 101,
"functions": 84, "functions": 86,
"ipcHandlers": 0, "ipcHandlers": 0,
"responsibilities": [ "responsibilities": [
"inventory", "inventory",
@@ -20,50 +20,7 @@
"renderer", "renderer",
"updates" "updates"
], ],
"hotspotScore": 128 "hotspotScore": 131
},
{
"file": "src/main/server-inventory.cjs",
"lines": 578,
"branches": 89,
"functions": 104,
"ipcHandlers": 0,
"responsibilities": [
"inventory",
"deployment",
"git",
"security",
"updates"
],
"hotspotScore": 119
},
{
"file": "src/main/git-service.cjs",
"lines": 632,
"branches": 98,
"functions": 109,
"ipcHandlers": 0,
"responsibilities": [
"git"
],
"hotspotScore": 98
}
],
"mixedResponsibilityModules": [
{
"file": "src/renderer/actions/shell.js",
"lines": 506,
"branches": 98,
"functions": 84,
"ipcHandlers": 0,
"responsibilities": [
"inventory",
"deployment",
"git",
"renderer",
"updates"
],
"hotspotScore": 128
}, },
{ {
"file": "src/main/server-inventory.cjs", "file": "src/main/server-inventory.cjs",
@@ -82,9 +39,9 @@
}, },
{ {
"file": "src/renderer/app.js", "file": "src/renderer/app.js",
"lines": 667, "lines": 676,
"branches": 74, "branches": 75,
"functions": 110, "functions": 113,
"ipcHandlers": 0, "ipcHandlers": 0,
"responsibilities": [ "responsibilities": [
"inventory", "inventory",
@@ -94,7 +51,66 @@
"security", "security",
"updates" "updates"
], ],
"hotspotScore": 114 "hotspotScore": 115
},
{
"file": "src/main/git-service.cjs",
"lines": 632,
"branches": 98,
"functions": 109,
"ipcHandlers": 0,
"responsibilities": [
"git"
],
"hotspotScore": 98
}
],
"mixedResponsibilityModules": [
{
"file": "src/renderer/actions/shell.js",
"lines": 518,
"branches": 101,
"functions": 86,
"ipcHandlers": 0,
"responsibilities": [
"inventory",
"deployment",
"git",
"renderer",
"updates"
],
"hotspotScore": 131
},
{
"file": "src/main/server-inventory.cjs",
"lines": 578,
"branches": 89,
"functions": 104,
"ipcHandlers": 0,
"responsibilities": [
"inventory",
"deployment",
"git",
"security",
"updates"
],
"hotspotScore": 119
},
{
"file": "src/renderer/app.js",
"lines": 676,
"branches": 75,
"functions": 113,
"ipcHandlers": 0,
"responsibilities": [
"inventory",
"deployment",
"git",
"renderer",
"security",
"updates"
],
"hotspotScore": 115
}, },
{ {
"file": "src/main/ipc.cjs", "file": "src/main/ipc.cjs",
@@ -130,9 +146,9 @@
}, },
{ {
"file": "src/renderer/views.js", "file": "src/renderer/views.js",
"lines": 693, "lines": 737,
"branches": 53, "branches": 55,
"functions": 138, "functions": 156,
"ipcHandlers": 0, "ipcHandlers": 0,
"responsibilities": [ "responsibilities": [
"inventory", "inventory",
@@ -142,7 +158,7 @@
"security", "security",
"updates" "updates"
], ],
"hotspotScore": 93 "hotspotScore": 95
}, },
{ {
"file": "src/main/unraid-inventory-methods.cjs", "file": "src/main/unraid-inventory-methods.cjs",
@@ -176,8 +192,8 @@
}, },
{ {
"file": "src/main/gitea-service.cjs", "file": "src/main/gitea-service.cjs",
"lines": 618, "lines": 624,
"branches": 66, "branches": 67,
"functions": 57, "functions": 57,
"ipcHandlers": 0, "ipcHandlers": 0,
"responsibilities": [ "responsibilities": [
@@ -186,7 +202,7 @@
"security", "security",
"updates" "updates"
], ],
"hotspotScore": 86 "hotspotScore": 87
}, },
{ {
"file": "src/renderer/actions/deployment-profile.js", "file": "src/renderer/actions/deployment-profile.js",
@@ -312,6 +328,35 @@
], ],
"hotspotScore": 73 "hotspotScore": 73
}, },
{
"file": "src/renderer/events.js",
"lines": 181,
"branches": 35,
"functions": 27,
"ipcHandlers": 0,
"responsibilities": [
"inventory",
"deployment",
"git",
"renderer",
"security"
],
"hotspotScore": 65
},
{
"file": "src/main/git-validator-service.cjs",
"lines": 600,
"branches": 43,
"functions": 77,
"ipcHandlers": 0,
"responsibilities": [
"deployment",
"git",
"security",
"updates"
],
"hotspotScore": 63
},
{ {
"file": "src/main/ssh-service.cjs", "file": "src/main/ssh-service.cjs",
"lines": 333, "lines": 333,
@@ -341,35 +386,6 @@
], ],
"hotspotScore": 61 "hotspotScore": 61
}, },
{
"file": "src/renderer/events.js",
"lines": 172,
"branches": 31,
"functions": 26,
"ipcHandlers": 0,
"responsibilities": [
"inventory",
"deployment",
"git",
"renderer",
"security"
],
"hotspotScore": 61
},
{
"file": "src/main/git-validator-service.cjs",
"lines": 588,
"branches": 40,
"functions": 74,
"ipcHandlers": 0,
"responsibilities": [
"deployment",
"git",
"security",
"updates"
],
"hotspotScore": 60
},
{ {
"file": "src/main/unraid-deployment-service.cjs", "file": "src/main/unraid-deployment-service.cjs",
"lines": 525, "lines": 525,
@@ -477,7 +493,7 @@
}, },
{ {
"file": "src/renderer/mock-deployment-bridge.js", "file": "src/renderer/mock-deployment-bridge.js",
"lines": 679, "lines": 699,
"branches": 11, "branches": 11,
"functions": 87, "functions": 87,
"ipcHandlers": 0, "ipcHandlers": 0,
@@ -686,7 +702,7 @@
}, },
{ {
"file": "src/main/ipc/repository-handlers.cjs", "file": "src/main/ipc/repository-handlers.cjs",
"lines": 411, "lines": 413,
"branches": 16, "branches": 16,
"functions": 79, "functions": 79,
"ipcHandlers": 51, "ipcHandlers": 51,
+3 -2
View File
@@ -1,6 +1,6 @@
# ForgeFlow architecture audit # ForgeFlow architecture audit
Generated 2026-07-29T22:49:48.766Z. Complexity is a deterministic decision-point count used for hotspot ranking, not a claim of exact McCabe complexity. Generated 2026-08-01T15:23:33.157Z. Complexity is a deterministic decision-point count used for hotspot ranking, not a claim of exact McCabe complexity.
## Files above 750 lines ## Files above 750 lines
@@ -18,8 +18,9 @@ No findings.
| File | Lines | Decisions | Functions | IPC handlers | Responsibilities | | File | Lines | Decisions | Functions | IPC handlers | Responsibilities |
|---|---:|---:|---:|---:|---| |---|---:|---:|---:|---:|---|
| `src/renderer/actions/shell.js` | 506 | 98 | 84 | 0 | inventory, deployment, git, renderer, updates | | `src/renderer/actions/shell.js` | 518 | 101 | 86 | 0 | inventory, deployment, git, renderer, updates |
| `src/main/server-inventory.cjs` | 578 | 89 | 104 | 0 | inventory, deployment, git, security, updates | | `src/main/server-inventory.cjs` | 578 | 89 | 104 | 0 | inventory, deployment, git, security, updates |
| `src/renderer/app.js` | 676 | 75 | 113 | 0 | inventory, deployment, git, renderer, security, updates |
| `src/main/git-service.cjs` | 632 | 98 | 109 | 0 | git | | `src/main/git-service.cjs` | 632 | 98 | 109 | 0 | git |
## Interpretation ## Interpretation
+17 -2
View File
@@ -8,7 +8,8 @@ param(
[Parameter(Mandatory = $true)][string]$LogPath, [Parameter(Mandatory = $true)][string]$LogPath,
[Parameter(Mandatory = $true)][string]$StatusPath, [Parameter(Mandatory = $true)][string]$StatusPath,
[Parameter(Mandatory = $true)][string]$UpdateId, [Parameter(Mandatory = $true)][string]$UpdateId,
[switch]$HandshakeOnly [switch]$HandshakeOnly,
[switch]$VerifyOnly
) )
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
@@ -51,6 +52,16 @@ function Write-UpdateState {
function Write-Log([string]$Message) { function Write-Log([string]$Message) {
"{0} {1}" -f [DateTime]::UtcNow.ToString("o"), $Message | Add-Content -LiteralPath $LogPath -Encoding UTF8 "{0} {1}" -f [DateTime]::UtcNow.ToString("o"), $Message | Add-Content -LiteralPath $LogPath -Encoding UTF8
} }
function Get-Sha256([string]$Path) {
$stream = [IO.File]::OpenRead($Path)
$algorithm = [Security.Cryptography.SHA256]::Create()
try {
return ([BitConverter]::ToString($algorithm.ComputeHash($stream))).Replace("-", "").ToLowerInvariant()
} finally {
$algorithm.Dispose()
$stream.Dispose()
}
}
try { try {
Write-UpdateState -State "started" -Message "Binary updater owns the update request." Write-UpdateState -State "started" -Message "Binary updater owns the update request."
@@ -59,9 +70,13 @@ try {
Write-Log "Handshake-only verification completed successfully." Write-Log "Handshake-only verification completed successfully."
exit 0 exit 0
} }
$actualSha256 = (Get-FileHash -LiteralPath $BinaryPath -Algorithm SHA256).Hash.ToLowerInvariant() $actualSha256 = Get-Sha256 -Path $BinaryPath
if ($actualSha256 -ne $ExpectedSha256.ToLowerInvariant()) { throw "Binary update SHA-256 verification failed." } if ($actualSha256 -ne $ExpectedSha256.ToLowerInvariant()) { throw "Binary update SHA-256 verification failed." }
if (-not (Test-Path -LiteralPath $CurrentExecutable -PathType Leaf)) { throw "Current ForgeFlow executable was not found." } if (-not (Test-Path -LiteralPath $CurrentExecutable -PathType Leaf)) { throw "Current ForgeFlow executable was not found." }
if ($VerifyOnly) {
Write-Log "Verification-only SHA-256 check completed successfully."
exit 0
}
Write-UpdateState -State "waiting-for-exit" -Message "Waiting for ForgeFlow to close." Write-UpdateState -State "waiting-for-exit" -Message "Waiting for ForgeFlow to close."
try { Wait-Process -Id $ParentPid -Timeout 60 -ErrorAction Stop } catch { try { Wait-Process -Id $ParentPid -Timeout 60 -ErrorAction Stop } catch {
+12 -1
View File
@@ -71,6 +71,17 @@ function Write-UpdateState {
} }
} }
function Get-Sha256([string]$Path) {
$stream = [IO.File]::OpenRead($Path)
$algorithm = [Security.Cryptography.SHA256]::Create()
try {
return ([BitConverter]::ToString($algorithm.ComputeHash($stream))).Replace("-", "").ToLowerInvariant()
} finally {
$algorithm.Dispose()
$stream.Dispose()
}
}
function Invoke-Robocopy { function Invoke-Robocopy {
param([string]$From, [string]$To) param([string]$From, [string]$To)
New-Item -ItemType Directory -Force -Path $To | Out-Null New-Item -ItemType Directory -Force -Path $To | Out-Null
@@ -120,7 +131,7 @@ try {
Start-Sleep -Milliseconds 500 Start-Sleep -Milliseconds 500
} }
$actualHash = (Get-FileHash -LiteralPath $ArchivePath -Algorithm SHA256).Hash.ToLowerInvariant() $actualHash = Get-Sha256 -Path $ArchivePath
if ($actualHash -ne $ExpectedSha256.ToLowerInvariant()) { throw "Update archive checksum mismatch." } if ($actualHash -ne $ExpectedSha256.ToLowerInvariant()) { throw "Update archive checksum mismatch." }
$working = Join-Path ([IO.Path]::GetTempPath()) ("forgeflow-update-" + [guid]::NewGuid().ToString("N")) $working = Join-Path ([IO.Path]::GetTempPath()) ("forgeflow-update-" + [guid]::NewGuid().ToString("N"))
+12 -1
View File
@@ -117,7 +117,18 @@ app.whenReady().then(async () => {
reviewBreakdown: Object.fromEntries(Object.entries(report.reviewBreakdown || {}).sort(([left], [right]) => left.localeCompare(right))), reviewBreakdown: Object.fromEntries(Object.entries(report.reviewBreakdown || {}).sort(([left], [right]) => left.localeCompare(right))),
reviewSamples: report.reviewSamples, reviewSamples: report.reviewSamples,
reconciliation: report.reconciliation, reconciliation: report.reconciliation,
access: report.access.map((item) => ({ repository: item.repository, profileId: item.profileId || null, ready: item.ready, readiness: item.readiness || item.action || null, remoteSha: item.remoteSha || item.branchSha || null, liveSha: item.liveSha || null, error: item.error || null })), access: report.access.map((item) => ({
repository: item.repository,
profileId: item.profileId || null,
ready: item.ready,
deployReady: item.deployReady ?? item.ready,
readiness: item.readiness || item.action || null,
remoteSha: item.remoteSha || item.branchSha || null,
liveSha: item.liveSha || null,
blockers: (item.deploymentBlockers || []).map((check) => ({ id: check.id, detail: check.detail })),
warnings: (item.checks || []).filter((check) => check.status !== "pass" && !(item.deploymentBlockers || []).some((blocker) => blocker.id === check.id)).map((check) => ({ id: check.id, status: check.status, detail: check.detail })),
error: item.error || null,
})),
review: report.workloads.filter((item) => !item.repository && item.running).map((item) => ({ name: item.name, confidence: item.confidence, folder: item.folder })), review: report.workloads.filter((item) => !item.repository && item.running).map((item) => ({ name: item.name, confidence: item.confidence, folder: item.folder })),
})) : reports; })) : reports;
console.log(JSON.stringify(output, null, 2)); console.log(JSON.stringify(output, null, 2));
+6 -1
View File
@@ -4,12 +4,17 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'src', 'renderer'); const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'src', 'renderer');
const port = Number(process.env.PORT || 4173); const port = Number(process.env.PORT || 41737);
const mime = { '.html': 'text/html; charset=utf-8', '.css': 'text/css; charset=utf-8', '.js': 'text/javascript; charset=utf-8', '.svg': 'image/svg+xml' }; const mime = { '.html': 'text/html; charset=utf-8', '.css': 'text/css; charset=utf-8', '.js': 'text/javascript; charset=utf-8', '.svg': 'image/svg+xml' };
const server = http.createServer(async (request, response) => { const server = http.createServer(async (request, response) => {
try { try {
const pathname = decodeURIComponent(new URL(request.url, `http://${request.headers.host}`).pathname); const pathname = decodeURIComponent(new URL(request.url, `http://${request.headers.host}`).pathname);
if (pathname === '/__forgeflow_test_ready__') {
response.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8', 'Cache-Control': 'no-store' });
response.end('forgeflow-demo-ready');
return;
}
const relative = pathname === '/' ? 'index.html' : pathname.replace(/^\//, ''); const relative = pathname === '/' ? 'index.html' : pathname.replace(/^\//, '');
const target = path.resolve(root, relative); const target = path.resolve(root, relative);
if (!target.startsWith(root)) throw Object.assign(new Error('Forbidden'), { code: 'EACCES' }); if (!target.startsWith(root)) throw Object.assign(new Error('Forbidden'), { code: 'EACCES' });
+42 -2
View File
@@ -84,6 +84,14 @@ const required = [
"docs/RELEASE_NOTES_0.10.2.md", "docs/RELEASE_NOTES_0.10.2.md",
"docs/RELEASE_NOTES_0.10.3.md", "docs/RELEASE_NOTES_0.10.3.md",
"docs/RELEASE_NOTES_0.10.4.md", "docs/RELEASE_NOTES_0.10.4.md",
"docs/RELEASE_NOTES_0.10.5.md",
"docs/RELEASE_NOTES_0.10.6.md",
"docs/RELEASE_NOTES_0.10.7.md",
"docs/RELEASE_NOTES_0.10.8.md",
"docs/RELEASE_NOTES_0.10.9.md",
"docs/RELEASE_NOTES_0.10.10.md",
"docs/RELEASE_NOTES_0.10.11.md",
"docs/RELEASE_NOTES_0.10.12.md",
"docs/UPDATING.md", "docs/UPDATING.md",
"docs/DIAGNOSTICS.md", "docs/DIAGNOSTICS.md",
"docs/DEPLOYMENT_SETUP.md", "docs/DEPLOYMENT_SETUP.md",
@@ -122,9 +130,9 @@ for (const file of required) await access(path.join(root, file));
const packageJson = JSON.parse( const packageJson = JSON.parse(
await readFile(path.join(root, "package.json"), "utf8"), await readFile(path.join(root, "package.json"), "utf8"),
); );
if (packageJson.version !== "0.10.4") if (packageJson.version !== "0.10.12")
throw new Error( throw new Error(
`Expected package version 0.10.4, got ${packageJson.version}.`, `Expected package version 0.10.12, got ${packageJson.version}.`,
); );
const sourceManifest = await readFile( const sourceManifest = await readFile(
path.join(root, "SOURCE_MANIFEST.txt"), path.join(root, "SOURCE_MANIFEST.txt"),
@@ -454,6 +462,38 @@ const release0104 = await readFile(path.join(root, "docs/RELEASE_NOTES_0.10.4.md
for (const phrase of ["Windows PowerShell 5.1", "atomic status", "handshake-only", "existing installations"]) { for (const phrase of ["Windows PowerShell 5.1", "atomic status", "handshake-only", "existing installations"]) {
if (!release0104.includes(phrase)) throw new Error(`0.10.4 release notes are missing: ${phrase}`); if (!release0104.includes(phrase)) throw new Error(`0.10.4 release notes are missing: ${phrase}`);
} }
const release0105 = await readFile(path.join(root, "docs/RELEASE_NOTES_0.10.5.md"), "utf8");
for (const phrase of ["repository workspace", "resolved profile", "Link unresolved", "reconciliation", "server workload"]) {
if (!release0105.includes(phrase)) throw new Error(`0.10.5 release notes are missing: ${phrase}`);
}
const release0106 = await readFile(path.join(root, "docs/RELEASE_NOTES_0.10.6.md"), "utf8");
for (const phrase of ["detached", "PowerShell", "production Node spawn", "source updater", "one-time direct installation"]) {
if (!release0106.includes(phrase)) throw new Error(`0.10.6 release notes are missing: ${phrase}`);
}
const release0107 = await readFile(path.join(root, "docs/RELEASE_NOTES_0.10.7.md"), "utf8");
for (const phrase of ["exact provenance", "automatic", "repository sidebar", "DevRunbook", "no container changes"]) {
if (!release0107.includes(phrase)) throw new Error(`0.10.7 release notes are missing: ${phrase}`);
}
const release0108 = await readFile(path.join(root, "docs/RELEASE_NOTES_0.10.8.md"), "utf8");
for (const phrase of ["Get-FileHash", ".NET SHA-256", "PSModulePath", "binary", "source update helpers"]) {
if (!release0108.includes(phrase)) throw new Error(`0.10.8 release notes are missing: ${phrase}`);
}
const release0109 = await readFile(path.join(root, "docs/RELEASE_NOTES_0.10.9.md"), "utf8");
for (const phrase of ["containers without healthchecks", "single-instance", "exact Gitea commit", "deploy-ready", "no containers are changed"]) {
if (!release0109.includes(phrase)) throw new Error(`0.10.9 release notes are missing: ${phrase}`);
}
const release01010 = await readFile(path.join(root, "docs/RELEASE_NOTES_0.10.10.md"), "utf8");
for (const phrase of ["read-only deploy keys", "repository deployment root", "Compose working directory", "Fix write access", "exact Gitea commit"]) {
if (!release01010.includes(phrase)) throw new Error(`0.10.10 release notes are missing: ${phrase}`);
}
const release01011 = await readFile(path.join(root, "docs/RELEASE_NOTES_0.10.11.md"), "utf8");
for (const phrase of ["last-known-good", "closed output pipe", "linked checkout origin", "read-only deploy key", "browser test server"]) {
if (!release01011.includes(phrase)) throw new Error(`0.10.11 release notes are missing: ${phrase}`);
}
const release01012 = await readFile(path.join(root, "docs/RELEASE_NOTES_0.10.12.md"), "utf8");
for (const phrase of ["coalesced", "exact Gitea commit parity", "batched Docker inspect", "bounded worker pools", "stopped container"]) {
if (!release01012.includes(phrase)) throw new Error(`0.10.12 release notes are missing: ${phrase}`);
}
const configSource = await readFile(path.join(root, "src/main/config-store.cjs"), "utf8"); const configSource = await readFile(path.join(root, "src/main/config-store.cjs"), "utf8");
for (const mode of ["server-git", "push-bundle", "monitor-only"]) { for (const mode of ["server-git", "push-bundle", "monitor-only"]) {
if (!configSource.includes(mode)) throw new Error(`Deployment configuration is missing mode: ${mode}`); if (!configSource.includes(mode)) throw new Error(`Deployment configuration is missing mode: ${mode}`);
+8 -1
View File
@@ -328,8 +328,15 @@ class DeploymentService {
async refreshActiveOperations() { async refreshActiveOperations() {
const active = this.store.data.operations.filter((item) => item.type === 'deployment' && !TERMINAL_STATUSES.has(item.status)); const active = this.store.data.operations.filter((item) => item.type === 'deployment' && !TERMINAL_STATUSES.has(item.status));
const queue = active.slice(0, 20);
const results = []; const results = [];
for (const operation of active.slice(0, 20)) results.push(await this.refreshOperation(operation.id)); const workers = Array.from({ length: Math.min(4, queue.length) }, async () => {
while (queue.length) {
const operation = queue.shift();
results.push(await this.refreshOperation(operation.id));
}
});
await Promise.all(workers);
return results; return results;
} }
-1
View File
@@ -72,7 +72,6 @@ function register(channel, handler) {
stack: error?.stack, stack: error?.stack,
}, },
}); });
console.error(`[${channel}]`, error);
return { ok: false, error: toErrorPayload(error) }; return { ok: false, error: toErrorPayload(error) };
} }
}); });
+2 -2
View File
@@ -6,8 +6,8 @@ function registerRepositoryIpc({
resolveRepository, cloneRepositoryInto, cloneDirectoryName, resolveRepository, cloneRepositoryInto, cloneDirectoryName,
matchRemoteToRepository, shell, dialog, matchRemoteToRepository, shell, dialog,
}) { }) {
register("repositories:refresh", async () => { register("repositories:refresh", async ({ force = false }) => {
const result = await repositories.refresh(); const result = await repositories.refresh({ force: force === true });
monitor?.setPaths(repositories.getWatchPaths()); monitor?.setPaths(repositories.getWatchPaths());
return result; return result;
}); });
+26
View File
@@ -0,0 +1,26 @@
'use strict';
function isBrokenPipeError(error) {
return error?.code === 'EPIPE';
}
function installOutputPipeGuards({
stdout = process.stdout,
stderr = process.stderr,
onBrokenPipe = () => {}
} = {}) {
const guardedStreams = [stdout, stderr].filter(Boolean);
const handlers = guardedStreams.map((stream) => {
const handler = (error) => {
if (!isBrokenPipeError(error)) throw error;
onBrokenPipe(error);
};
stream.on('error', handler);
return { stream, handler };
});
return () => {
for (const { stream, handler } of handlers) stream.off('error', handler);
};
}
module.exports = { installOutputPipeGuards, isBrokenPipeError };
+72 -7
View File
@@ -29,6 +29,12 @@ class RepositoryService {
this.gitea = giteaService; this.gitea = giteaService;
this.diagnostics = diagnostics; this.diagnostics = diagnostics;
this.lastKnownLocalPaths = []; this.lastKnownLocalPaths = [];
this.lastKnownRemoteRepositories = [];
this.lastSuccessfulRemoteRefreshAt = null;
this.lastRemoteRefreshAtMs = 0;
this.lastDiscoveredPaths = [];
this.lastDiscoveryAtMs = 0;
this.refreshPromise = null;
} }
async discoverInRoot(root, maxDepth = 4) { async discoverInRoot(root, maxDepth = 4) {
@@ -80,13 +86,65 @@ class RepositoryService {
return [...this.lastKnownLocalPaths]; return [...this.lastKnownLocalPaths];
} }
async refresh() { async getRemoteRepositories({ force = false } = {}) {
const started = Date.now(); if (!this.store.data.gitea.baseUrl || !this.store.getToken()) {
const remoteRepositories = this.store.data.gitea.baseUrl && this.store.getToken() this.lastKnownRemoteRepositories = [];
? await this.gitea.listRepositories() this.lastSuccessfulRemoteRefreshAt = null;
: []; return { repositories: [], stale: false, error: null };
}
const discoveredPaths = await this.discoverAll(this.store.data.workspaceRoots); if (!force && this.lastSuccessfulRemoteRefreshAt && Date.now() - this.lastRemoteRefreshAtMs < 15_000) {
return {
repositories: this.lastKnownRemoteRepositories.map((repository) => ({ ...repository })),
stale: false,
error: null,
cached: true
};
}
try {
const repositories = await this.gitea.listRepositories();
this.lastKnownRemoteRepositories = repositories.map((repository) => ({ ...repository }));
this.lastSuccessfulRemoteRefreshAt = new Date().toISOString();
this.lastRemoteRefreshAtMs = Date.now();
return { repositories, stale: false, error: null };
} catch (error) {
if (!this.lastSuccessfulRemoteRefreshAt) throw error;
await this.diagnostics?.warning('repositories.remote-refresh.degraded', {
message: error.message,
cachedCount: this.lastKnownRemoteRepositories.length,
lastSuccessfulAt: this.lastSuccessfulRemoteRefreshAt
});
return {
repositories: this.lastKnownRemoteRepositories.map((repository) => ({ ...repository })),
stale: true,
error: error.message
};
}
}
async getDiscoveredPaths({ force = false } = {}) {
if (!force && this.lastDiscoveryAtMs && Date.now() - this.lastDiscoveryAtMs < 30_000) {
return [...this.lastDiscoveredPaths];
}
const paths = await this.discoverAll(this.store.data.workspaceRoots);
this.lastDiscoveredPaths = [...paths];
this.lastDiscoveryAtMs = Date.now();
return paths;
}
async refresh(options = {}) {
if (this.refreshPromise) return this.refreshPromise;
this.refreshPromise = this.performRefresh(options).finally(() => { this.refreshPromise = null; });
return this.refreshPromise;
}
async performRefresh({ force = false } = {}) {
const started = Date.now();
const remoteResult = await this.getRemoteRepositories({ force });
const remoteRepositories = remoteResult.repositories;
const discoveredPaths = await this.getDiscoveredPaths({ force });
const mappedPaths = Object.values(this.store.data.repositoryMappings || {}); const mappedPaths = Object.values(this.store.data.repositoryMappings || {});
const localPaths = [...new Set([...discoveredPaths, ...mappedPaths])]; const localPaths = [...new Set([...discoveredPaths, ...mappedPaths])];
const localDescriptors = await this.getLocalDescriptors(localPaths); const localDescriptors = await this.getLocalDescriptors(localPaths);
@@ -106,7 +164,12 @@ class RepositoryService {
...profile, ...profile,
state: this.store.getDeploymentState(profile.id) state: this.store.getDeploymentState(profile.id)
})); }));
repositories.push(this.decorate(remote, local, profiles)); repositories.push({
...this.decorate(remote, local, profiles),
remoteStale: remoteResult.stale,
remoteRefreshError: remoteResult.error,
remoteLastRefreshedAt: this.lastSuccessfulRemoteRefreshAt
});
} }
for (const local of localDescriptors.filter((item) => !usedLocalPaths.has(item.localPath))) { for (const local of localDescriptors.filter((item) => !usedLocalPaths.has(item.localPath))) {
@@ -145,6 +208,8 @@ class RepositoryService {
await this.diagnostics?.debug('repositories.refresh.completed', { await this.diagnostics?.debug('repositories.refresh.completed', {
durationMs: Date.now() - started, durationMs: Date.now() - started,
remoteCount: remoteRepositories.length, remoteCount: remoteRepositories.length,
remoteStale: remoteResult.stale,
remoteCached: remoteResult.cached === true,
discoveredCount: discoveredPaths.length, discoveredCount: discoveredPaths.length,
linkedCount: sorted.filter((item) => item.localPath).length, linkedCount: sorted.filter((item) => item.localPath).length,
attentionCount: sorted.filter((item) => item.attention).length, attentionCount: sorted.filter((item) => item.attention).length,
+18 -4
View File
@@ -1,9 +1,14 @@
"use strict"; "use strict";
function createUnraidAccessMethods({ shellQuote, path, bash, inventoryRemoteIdentity, checksSummary, crypto }) { function createUnraidAccessMethods({ shellQuote, path, bash, inventoryRemoteIdentity, checksSummary, crypto, parsePermissionInspection }) {
class UnraidAccessMethods { class UnraidAccessMethods {
serverGitRemote(repository, profile) { serverGitRemote(repository, profile) {
const candidates = [repository.sshUrl, profile.cloneUrl, repository.preferredCloneUrl] const candidates = [
repository.localStatus?.remoteUrl,
repository.sshUrl,
repository.preferredCloneUrl,
profile.cloneUrl,
]
.map((value) => String(value || "").trim()) .map((value) => String(value || "").trim())
.filter(Boolean); .filter(Boolean);
const value = candidates.find((candidate) => /^ssh:\/\//i.test(candidate) || /^[^@\s]+@[^:\s]+:.+/.test(candidate)); const value = candidates.find((candidate) => /^ssh:\/\//i.test(candidate) || /^[^@\s]+@[^:\s]+:.+/.test(candidate));
@@ -212,10 +217,19 @@ function createUnraidAccessMethods({ shellQuote, path, bash, inventoryRemoteIden
add("commit-parity", "Gitea and server parity", branchSha && liveSha && branchSha === liveSha ? "pass" : branchSha && liveSha ? "warning" : "incomplete", branchSha && liveSha ? branchSha === liveSha ? "The exact Gitea commit is live." : `Live ${String(liveSha).slice(0, 12)} differs from Gitea ${String(branchSha).slice(0, 12)}.` : "Parity cannot be proven until both SHAs are available.", { branchSha, liveSha }); add("commit-parity", "Gitea and server parity", branchSha && liveSha && branchSha === liveSha ? "pass" : branchSha && liveSha ? "warning" : "incomplete", branchSha && liveSha ? branchSha === liveSha ? "The exact Gitea commit is live." : `Live ${String(liveSha).slice(0, 12)} differs from Gitea ${String(branchSha).slice(0, 12)}.` : "Parity cannot be proven until both SHAs are available.", { branchSha, liveSha });
add("runtime", "Container runtime", running === true ? "pass" : running === false ? "fail" : "incomplete", running === true ? "The linked container is running." : running === false ? "The linked container is stopped." : "Runtime state has not been verified."); add("runtime", "Container runtime", running === true ? "pass" : running === false ? "fail" : "incomplete", running === true ? "The linked container is running." : running === false ? "The linked container is stopped." : "Runtime state has not been verified.");
add("health", "Runtime health", healthy === true ? "pass" : healthy === false ? "fail" : "incomplete", healthy === true ? "Runtime health passed." : healthy === false ? "Runtime health failed." : "No conclusive runtime health evidence is available."); add("health", "Runtime health", healthy === true ? "pass" : healthy === false ? "fail" : "incomplete", healthy === true ? "Runtime health passed." : healthy === false ? "Runtime health failed." : "No conclusive runtime health evidence is available.");
const deploymentCheckIds = new Set(["gitea-access", "remote-branch", "deploy-key-scope", "server-git-access", "server-inspection"]);
const deploymentBlockers = checks.filter((item) => deploymentCheckIds.has(item.id) && item.status !== "pass");
const deployReady = Boolean(branchSha) && deploymentBlockers.length === 0;
const failed = checks.some((item) => item.status === "fail"); const failed = checks.some((item) => item.status === "fail");
const incomplete = checks.some((item) => ["warning", "incomplete", "unsupported"].includes(item.status)); const incomplete = checks.some((item) => ["warning", "incomplete", "unsupported"].includes(item.status));
const readiness = failed ? (checks.some((item) => item.id.includes("access") || item.id.includes("key")) ? "Access failed" : checks.some((item) => item.id === "runtime" || item.id === "health") ? "Runtime unhealthy" : "Configuration required") : incomplete ? (branchSha && liveSha && branchSha !== liveSha ? "Commit mismatch" : "Verification incomplete") : "Ready"; const readiness = deploymentBlockers.length
return { readiness, ready: readiness === "Ready" || readiness === "Commit mismatch", checkedAt: new Date().toISOString(), repository: repository.fullName, profileId, server: { id: server.id, name: server.name }, remotePath, branch: profile.branch, branchSha, liveSha, checks }; ? "Access failed"
: failed
? "Deploy-ready; runtime unhealthy"
: incomplete
? (branchSha && liveSha && branchSha !== liveSha ? "Deployable update available" : "Deploy-ready; runtime verification incomplete")
: "Ready";
return { readiness, ready: deployReady, deployReady, deploymentBlockers, checkedAt: new Date().toISOString(), repository: repository.fullName, profileId, server: { id: server.id, name: server.name }, remotePath, branch: profile.branch, branchSha, liveSha, checks };
} }
permissionTargets(profile, server, remotePath) { permissionTargets(profile, server, remotePath) {
+1 -1
View File
@@ -20,7 +20,7 @@ class UnraidDeployKeyHost {
return { directory, privateKey: path.join(directory, "deploy-key"), publicKey: path.join(directory, "deploy-key.pub"), knownHosts: path.join(directory, "known_hosts"), recovery: path.join(directory, "recovery") }; return { directory, privateKey: path.join(directory, "deploy-key"), publicKey: path.join(directory, "deploy-key.pub"), knownHosts: path.join(directory, "known_hosts"), recovery: path.join(directory, "recovery") };
} }
remote(repository, profile) { remote(repository, profile) {
const value = [repository.sshUrl, profile.cloneUrl, repository.preferredCloneUrl].map((item) => String(item || "").trim()).find((item) => /^ssh:\/\//i.test(item) || /^[^@\s]+@[^:\s]+:.+/.test(item)); const value = [repository.localStatus?.remoteUrl, repository.sshUrl, repository.preferredCloneUrl, profile.cloneUrl].map((item) => String(item || "").trim()).find((item) => /^ssh:\/\//i.test(item) || /^[^@\s]+@[^:\s]+:.+/.test(item));
if (!value) throw Object.assign(new Error("Server pull requires a Gitea SSH URL."), { code: "SERVER_GIT_SSH_URL_REQUIRED" }); if (!value) throw Object.assign(new Error("Server pull requires a Gitea SSH URL."), { code: "SERVER_GIT_SSH_URL_REQUIRED" });
return value; return value;
} }
+8 -2
View File
@@ -418,9 +418,12 @@ function createUnraidDeploymentMethods({
const generated = profile.generatedCompose ? this.generatedCompose(profile, repository) : ""; const generated = profile.generatedCompose ? this.generatedCompose(profile, repository) : "";
const iconReference = await this.prepareIcon(profile, repository, server); const iconReference = await this.prepareIcon(profile, repository, server);
const deploymentRepositoryUrl = mode === "server-git"
? this.serverGitRemote(repository, profile)
: repository.localStatus?.remoteUrl || repository.sshUrl || repository.cloneUrl || repository.htmlUrl || repository.fullName;
const metadata = this.metadataCompose(profile, repository, iconReference, { const metadata = this.metadataCompose(profile, repository, iconReference, {
sha: targetSha, sha: targetSha,
repositoryUrl: profile.cloneUrl || repository.sshUrl || repository.cloneUrl || repository.htmlUrl || repository.fullName, repositoryUrl: deploymentRepositoryUrl,
}); });
const previousState = this.store.getDeploymentState?.(profileId) || null; const previousState = this.store.getDeploymentState?.(profileId) || null;
@@ -518,9 +521,12 @@ function createUnraidDeploymentMethods({
}); });
const generated = profile.generatedCompose ? this.generatedCompose(profile, repository) : ""; const generated = profile.generatedCompose ? this.generatedCompose(profile, repository) : "";
const iconReference = await this.prepareIcon(profile, repository, server); const iconReference = await this.prepareIcon(profile, repository, server);
const rollbackRepositoryUrl = rollbackMode === "server-git"
? this.serverGitRemote(repository, profile)
: repository.localStatus?.remoteUrl || repository.sshUrl || repository.cloneUrl || repository.htmlUrl || repository.fullName;
const metadata = this.metadataCompose(profile, repository, iconReference, { const metadata = this.metadataCompose(profile, repository, iconReference, {
sha: target, sha: target,
repositoryUrl: profile.cloneUrl || repository.sshUrl || repository.cloneUrl || repository.htmlUrl || repository.fullName, repositoryUrl: rollbackRepositoryUrl,
}); });
try { try {
const mode = rollbackMode; const mode = rollbackMode;
+1 -1
View File
@@ -490,7 +490,7 @@ for (const name of Object.getOwnPropertyNames(preflightMethods)) {
if (name !== "constructor") Object.defineProperty(UnraidDeploymentService.prototype, name, Object.getOwnPropertyDescriptor(preflightMethods, name)); if (name !== "constructor") Object.defineProperty(UnraidDeploymentService.prototype, name, Object.getOwnPropertyDescriptor(preflightMethods, name));
} }
const accessMethods = createUnraidAccessMethods({ shellQuote, path, bash, inventoryRemoteIdentity, checksSummary, crypto }); const accessMethods = createUnraidAccessMethods({ shellQuote, path, bash, inventoryRemoteIdentity, checksSummary, crypto, parsePermissionInspection });
for (const name of Object.getOwnPropertyNames(accessMethods)) { for (const name of Object.getOwnPropertyNames(accessMethods)) {
if (name !== "constructor") Object.defineProperty(UnraidDeploymentService.prototype, name, Object.getOwnPropertyDescriptor(accessMethods, name)); if (name !== "constructor") Object.defineProperty(UnraidDeploymentService.prototype, name, Object.getOwnPropertyDescriptor(accessMethods, name));
} }
+144 -27
View File
@@ -34,14 +34,23 @@ function createUnraidInventoryMethods({
fi fi
if [ -n "$ids" ]; then if [ -n "$ids" ]; then
disappeared=0 disappeared=0
while IFS= read -r container_id; do mapfile -t container_ids <<< "$ids"
# Docker accepts multiple IDs and returns one JSON array. This avoids one
# daemon round-trip per container on larger Unraid installations.
if inspect=$(docker inspect "\${container_ids[@]}" 2>/dev/null); then
printf 'C\\t%s\\n' "$(printf '%s' "$inspect" | base64 | tr -d '\\r\\n')"
else
# A container can disappear between docker ps and inspect. Fall back to
# individual reads so the remaining inventory stays complete.
for container_id in "\${container_ids[@]}"; do
[ -n "$container_id" ] || continue [ -n "$container_id" ] || continue
if inspect=$(docker inspect --format '{"id":{{json .Id}},"name":{{json .Name}},"image":{{json .Config.Image}},"imageId":{{json .Image}},"running":{{json .State.Running}},"status":{{json .State.Status}},"health":{{if .State.Health}}{{json .State.Health.Status}}{{else}}null{{end}},"labels":{{json .Config.Labels}},"ports":{{json .NetworkSettings.Ports}},"mounts":{{json .Mounts}},"networks":{{json .NetworkSettings.Networks}},"restartPolicy":{{json .HostConfig.RestartPolicy.Name}}}' "$container_id" 2>/dev/null); then if inspect=$(docker inspect "$container_id" 2>/dev/null); then
printf 'C\\t%s\\n' "$(printf '%s' "$inspect" | base64 | tr -d '\\r\\n')" printf 'C\\t%s\\n' "$(printf '%s' "$inspect" | base64 | tr -d '\\r\\n')"
else else
disappeared=$((disappeared + 1)) disappeared=$((disappeared + 1))
fi fi
done <<< "$ids" done
fi
if [ "$disappeared" -gt 0 ]; then if [ "$disappeared" -gt 0 ]; then
printf 'W\\t%s\\n' "$(printf '%s' "$disappeared stale container reference(s) disappeared during inventory; current containers were still processed." | base64 | tr -d '\\r\\n')" printf 'W\\t%s\\n' "$(printf '%s' "$disappeared stale container reference(s) disappeared during inventory; current containers were still processed." | base64 | tr -d '\\r\\n')"
fi fi
@@ -95,26 +104,35 @@ function createUnraidInventoryMethods({
( (
set -- -f "$primary" set -- -f "$primary"
files_text=$primary files_text=$primary
has_override=false
for extra in "$dir/compose.override.yml" "$dir/compose.override.yaml" "$dir/docker-compose.override.yml" "$dir/docker-compose.override.yaml"; do for extra in "$dir/compose.override.yml" "$dir/compose.override.yaml" "$dir/docker-compose.override.yml" "$dir/docker-compose.override.yaml"; do
[ -f "$extra" ] || continue [ -f "$extra" ] || continue
has_override=true
set -- "$@" -f "$extra" set -- "$@" -f "$extra"
files_text="$files_text files_text="$files_text
$extra" $extra"
done done
project_name=$(sed -n 's/^name:[[:space:]]*//p' "$primary" 2>/dev/null | head -n1 | cut -d'#' -f1 | tr -d '"' | tr -d "'" | xargs 2>/dev/null || true) project_name=$(sed -n 's/^name:[[:space:]]*//p' "$primary" 2>/dev/null | head -n1 | cut -d'#' -f1 | tr -d '"' | tr -d "'" | xargs 2>/dev/null || true)
[ -n "$project_name" ] || project_name=$(basename "$dir") [ -n "$project_name" ] || project_name=$(basename "$dir")
valid=false; services=''; images=''; compose_error='' valid=false; services=''; compose_error=''
images=$(awk '
/^[[:space:]]*services:[[:space:]]*($|#)/ { in_services=1; next }
in_services && /^[^[:space:]]/ { exit }
in_services && /^[[:space:]]+image:[[:space:]]*/ {
line=$0; sub(/^[[:space:]]*image:[[:space:]]*/, "", line); sub(/[[:space:]]+#.*/, "", line); gsub(/"/, "", line); print line
}
' "$primary" 2>/dev/null || true)
if [ "$compose_ok" != true ]; then if [ "$compose_ok" != true ]; then
compose_error='Docker Compose is unavailable; file metadata was still detected.' compose_error='Docker Compose is unavailable; file metadata was still detected.'
elif [ "$compose_v2" = true ]; then elif [ "$compose_v2" = true ]; then
if services=$(cd "$dir" && docker compose "$@" config --services 2>&1); then if services=$(cd "$dir" && docker compose "$@" config --services 2>&1); then
valid=true valid=true
images=$(cd "$dir" && docker compose "$@" config --images 2>/dev/null || true) if [ "$has_override" = true ] || [ -z "$images" ] || printf '%s' "$images" | grep -q '\$'; then images=$(cd "$dir" && docker compose "$@" config --images 2>/dev/null || true); fi
else compose_error=$services; services=''; fi else compose_error=$services; services=''; fi
else else
if services=$(cd "$dir" && docker-compose "$@" config --services 2>&1); then if services=$(cd "$dir" && docker-compose "$@" config --services 2>&1); then
valid=true valid=true
images=$(cd "$dir" && docker-compose "$@" config --images 2>/dev/null || true) if [ "$has_override" = true ] || [ -z "$images" ] || printf '%s' "$images" | grep -q '\$'; then images=$(cd "$dir" && docker-compose "$@" config --images 2>/dev/null || true); fi
else compose_error=$services; services=''; fi else compose_error=$services; services=''; fi
fi fi
if [ -z "$services" ]; then if [ -z "$services" ]; then
@@ -126,15 +144,6 @@ function createUnraidInventoryMethods({
} }
' "$primary" 2>/dev/null || true) ' "$primary" 2>/dev/null || true)
fi fi
if [ -z "$images" ]; then
images=$(awk '
/^[[:space:]]*services:[[:space:]]*($|#)/ { in_services=1; next }
in_services && /^[^[:space:]]/ { exit }
in_services && /^[[:space:]]+image:[[:space:]]*/ {
line=$0; sub(/^[[:space:]]*image:[[:space:]]*/, "", line); sub(/[[:space:]]+#.*/, "", line); gsub(/"/, "", line); print line
}
' "$primary" 2>/dev/null || true)
fi
printf 'Y\\t%s\\t%s\\t%s\\t%s\\t%s\\t%s\\t%s\\n' \\ printf 'Y\\t%s\\t%s\\t%s\\t%s\\t%s\\t%s\\t%s\\n' \\
"$(printf '%s' "$dir" | base64 | tr -d '\\r\\n')" \\ "$(printf '%s' "$dir" | base64 | tr -d '\\r\\n')" \\
"$(printf '%s' "$files_text" | base64 | tr -d '\\r\\n')" \\ "$(printf '%s' "$files_text" | base64 | tr -d '\\r\\n')" \\
@@ -251,19 +260,38 @@ function createUnraidInventoryMethods({
} }
refreshedProfileFromWorkload(repository, server, workload, existingProfile) { refreshedProfileFromWorkload(repository, server, workload, existingProfile) {
const configuredRoot = path.join(server.basePath, existingProfile.remoteFolder || "").replace(/\/+$/, "");
const composeWorkingDir = String(workload.compose?.workingDir || "").replace(/\/+$/, "");
const configuredRootOwnsCompose = Boolean(
configuredRoot
&& composeWorkingDir
&& (composeWorkingDir === configuredRoot || composeWorkingDir.startsWith(`${configuredRoot}/`)),
);
const detected = this.profileFromWorkload(repository, server, workload, { const detected = this.profileFromWorkload(repository, server, workload, {
linkSource: existingProfile.workloadIdentity?.linkSource || "automatic-compose", linkSource: existingProfile.workloadIdentity?.linkSource || "automatic-compose",
deploymentMode: ["push-bundle", "server-git", "monitor-only"].includes(existingProfile.deploymentMode) deploymentMode: ["push-bundle", "server-git", "monitor-only"].includes(existingProfile.deploymentMode)
? existingProfile.deploymentMode ? existingProfile.deploymentMode
: "push-bundle", : "push-bundle",
remoteFolder: workload.remoteFolderCandidate || existingProfile.remoteFolder, remoteFolder: configuredRootOwnsCompose
? existingProfile.remoteFolder
: workload.remoteFolderCandidate || existingProfile.remoteFolder,
}); });
const repositoryRelativeComposeFiles = configuredRootOwnsCompose
? [...new Set((workload.compose?.configFiles || []).map((file) => {
const value = String(file || "").trim().replace(/\\/g, "/");
if (value.startsWith(`${configuredRoot}/`)) return value.slice(configuredRoot.length + 1);
return value.startsWith("/") ? "" : value;
}).filter(Boolean))]
: [];
const composeFiles = repositoryRelativeComposeFiles.length
? repositoryRelativeComposeFiles
: detected.composeFiles;
return { return {
...existingProfile, ...existingProfile,
deploymentMode: detected.deploymentMode, deploymentMode: detected.deploymentMode,
remoteFolder: detected.remoteFolder, remoteFolder: detected.remoteFolder,
composeFile: detected.composeFile, composeFile: composeFiles[0],
composeFiles: detected.composeFiles, composeFiles,
composeProject: detected.composeProject, composeProject: detected.composeProject,
composeWorkingDir: detected.composeWorkingDir, composeWorkingDir: detected.composeWorkingDir,
composeService: detected.composeService, composeService: detected.composeService,
@@ -287,7 +315,7 @@ function createUnraidInventoryMethods({
}; };
} }
async saveWorkloadState(profile, workload, server) { async saveWorkloadState(profile, workload, server, { expectedGiteaSha = null, health = null } = {}) {
const candidateSha = String(workload.metadata?.liveRevision || ""); const candidateSha = String(workload.metadata?.liveRevision || "");
const previousState = this.store.getDeploymentState?.(profile.id) || {}; const previousState = this.store.getDeploymentState?.(profile.id) || {};
const observedLiveSha = /^[0-9a-f]{40,64}$/i.test(candidateSha) ? candidateSha.toLowerCase() : null; const observedLiveSha = /^[0-9a-f]{40,64}$/i.test(candidateSha) ? candidateSha.toLowerCase() : null;
@@ -295,11 +323,21 @@ function createUnraidInventoryMethods({
const profileRemote = inventoryRemoteIdentity(profile.cloneUrl); const profileRemote = inventoryRemoteIdentity(profile.cloneUrl);
const workloadRemote = inventoryRemoteIdentity(workload.metadata?.sourceRepository); const workloadRemote = inventoryRemoteIdentity(workload.metadata?.sourceRepository);
const repositoryMatches = Boolean(observedLiveSha && profileRemote && workloadRemote && profileRemote === workloadRemote); const repositoryMatches = Boolean(observedLiveSha && profileRemote && workloadRemote && profileRemote === workloadRemote);
const verifiedGiteaSha = /^[0-9a-f]{40}$/i.test(String(expectedGiteaSha || ""))
? String(expectedGiteaSha).toLowerCase()
: null;
const matchesGitea = Boolean(repositoryMatches && verifiedGiteaSha && observedLiveSha === verifiedGiteaSha);
const primary = workload.containers.find((container) => container.running) || workload.containers[0] || {}; const primary = workload.containers.find((container) => container.running) || workload.containers[0] || {};
const dockerHealthy = workload.runtime.health === "healthy" ? true : workload.runtime.health === "unhealthy" ? false : null;
const effectiveHealthy = workload.runtime.running === false
? false
: health?.configured ? health.healthy : dockerHealthy;
return this.store.saveDeploymentState(profile.id, { return this.store.saveDeploymentState(profile.id, {
liveSha, liveSha,
healthy: workload.runtime.health === "healthy" ? true : workload.runtime.health === "unhealthy" ? false : null, healthy: effectiveHealthy,
runtimeVerification: workload.runtime.health === "unverified" ? "running-unverified" : workload.runtime.health, healthStatus: health?.status ?? null,
healthLatencyMs: health?.latencyMs ?? null,
runtimeVerification: workload.runtime.running === false ? "stopped" : health?.configured ? "desktop-healthcheck" : workload.runtime.health === "unverified" ? "running-unverified" : workload.runtime.health,
containerRunning: workload.runtime.running, containerRunning: workload.runtime.running,
dockerHealth: primary.health || null, dockerHealth: primary.health || null,
containerName: primary.name || profile.containerName, containerName: primary.name || profile.containerName,
@@ -309,8 +347,8 @@ function createUnraidInventoryMethods({
composeProject: workload.compose?.project || null, composeProject: workload.compose?.project || null,
observedAt: workload.observedAt, observedAt: workload.observedAt,
evidence: liveSha ? "container-provenance-label" : "runtime-only", evidence: liveSha ? "container-provenance-label" : "runtime-only",
giteaSha: repositoryMatches ? observedLiveSha : previousState.giteaSha || null, giteaSha: verifiedGiteaSha,
matchesGitea: repositoryMatches ? true : previousState.matchesGitea === true && previousState.liveSha === liveSha, matchesGitea,
previousSha: previousState.previousSha || null, previousSha: previousState.previousSha || null,
}); });
} }
@@ -384,15 +422,43 @@ function createUnraidInventoryMethods({
}; };
} }
async scanServerInventory(serverId, repositories) { async scanServerInventory(serverId, repositories, { autoLink = false } = {}) {
const started = Date.now();
const { server, inventory, workloads } = await this.collectServerInventory(serverId, repositories); const { server, inventory, workloads } = await this.collectServerInventory(serverId, repositories);
const response = this.inventoryResponse(server, inventory, workloads); let adopted = 0;
const adoptedLinks = [];
if (autoLink) {
const plan = this.reconciliationPlan(server, workloads, repositories, { autoLink: true });
if (plan.additions.length) await this.store.createRecoverySnapshot?.(`automatic-server-links-${serverId}`);
const linkedRepositories = new Set(workloads
.filter((workload) => workload.link?.repositoryFullName)
.map((workload) => String(workload.link.repositoryFullName).toLowerCase()));
for (const addition of plan.additions) {
const workload = workloads.find((item) => item.workloadId === addition.workloadId);
const repository = (repositories || []).find((item) => String(item.fullName).toLowerCase() === String(addition.repositoryFullName).toLowerCase());
const key = String(repository?.fullName || "").toLowerCase();
if (!workload || !repository || linkedRepositories.has(key)) continue;
const linkSource = addition.evidence === "exact-provenance" ? "automatic" : "automatic-runtime-identity";
const profile = this.profileFromWorkload(repository, server, workload, { linkSource, deploymentMode: "server-git" });
const saved = await this.store.saveDeploymentProfile(repository.fullName, profile);
await this.saveWorkloadState(saved, workload, server);
workload.status = "linked";
workload.link = { status: "linked", profileId: saved.id, repositoryFullName: repository.fullName, source: linkSource };
linkedRepositories.add(key);
adopted += 1;
adoptedLinks.push({ repositoryFullName: repository.fullName, profileId: saved.id, workloadId: workload.workloadId });
}
}
const response = this.inventoryResponse(server, inventory, workloads, { adopted });
await this.diagnostics?.info("unraid.workloads.scanned", { await this.diagnostics?.info("unraid.workloads.scanned", {
serverId, serverId,
detected: response.detected, detected: response.detected,
linked: response.linked, linked: response.linked,
needsReview: response.needsReview, needsReview: response.needsReview,
readOnly: true, adopted,
adoptedLinks,
readOnly: !autoLink,
durationMs: Date.now() - started,
}); });
return response; return response;
} }
@@ -428,6 +494,7 @@ function createUnraidInventoryMethods({
evidence: candidate.exact ? "exact-provenance" : "exact-runtime-identity", evidence: candidate.exact ? "exact-provenance" : "exact-runtime-identity",
impact: "Create a server-pull deployment profile; no container changes", impact: "Create a server-pull deployment profile; no container changes",
}); });
linkedRepositories.add(String(candidate.repositoryFullName).toLowerCase());
} else if (["suggested", "ambiguous"].includes(workload.status) || (workload.runtime?.running && workload.candidates?.length)) { } else if (["suggested", "ambiguous"].includes(workload.status) || (workload.runtime?.running && workload.candidates?.length)) {
conflicts.push({ conflicts.push({
workloadId: workload.workloadId, workloadId: workload.workloadId,
@@ -559,7 +626,57 @@ function createUnraidInventoryMethods({
} }
async discoverServerWorkloads(serverId, repositories) { async discoverServerWorkloads(serverId, repositories) {
return this.scanServerInventory(serverId, repositories); const started = Date.now();
const inventory = await this.scanServerInventory(serverId, repositories, { autoLink: true });
const server = this.store.getServer(serverId);
const queue = inventory.workloads.filter((workload) => workload.link?.profileId && workload.link?.repositoryFullName);
const refreshedProfileIds = [];
let giteaUnavailable = false;
let giteaFailureReported = false;
const workers = Array.from({ length: Math.min(5, queue.length) }, async () => {
while (queue.length) {
const workload = queue.shift();
const repository = repositories.find((item) => String(item.fullName).toLowerCase() === String(workload.link.repositoryFullName).toLowerCase());
const profile = this.store.getDeploymentProfile?.(workload.link.repositoryFullName, workload.link.profileId)
|| this.store.getDeploymentProfiles?.(workload.link.repositoryFullName)?.find((item) => item.id === workload.link.profileId)
|| this.allSshProfiles().find((item) => item.id === workload.link.profileId);
if (!repository || !profile) continue;
let expectedGiteaSha = null;
const status = repository.localStatus;
if (status?.head && status.branch?.head === profile.branch && status.branch?.upstream && status.branch.ahead === 0 && status.branch.behind === 0) {
expectedGiteaSha = status.head;
} else if (!giteaUnavailable) {
try {
const [owner, repo] = String(repository.fullName).split("/");
const branch = await this.gitea.getBranch(owner, repo, profile.branch);
expectedGiteaSha = branch?.commit?.id || branch?.commit?.sha || null;
} catch (error) {
if (!error?.status || Number(error.status) >= 500) {
giteaUnavailable = true;
if (!giteaFailureReported) {
giteaFailureReported = true;
await this.diagnostics?.warning("unraid.workloads.gitea-verification-degraded", {
serverId,
message: error.message,
});
}
}
}
}
const health = workload.runtime.running
? await this.checkHealth(profile.healthcheckUrl)
: { configured: false, healthy: false, skipped: "container-stopped" };
await this.saveWorkloadState(profile, workload, server, { expectedGiteaSha, health });
refreshedProfileIds.push(profile.id);
}
});
await Promise.all(workers);
await this.diagnostics?.debug("unraid.workloads.states-refreshed", {
serverId,
profiles: refreshedProfileIds.length,
durationMs: Date.now() - started,
});
return { ...inventory, refreshedProfiles: refreshedProfileIds.length, refreshedProfileIds };
} }
async linkServerWorkload({ repository, serverId, workloadId, deploymentMode = "server-git", remoteFolder = "" }) { async linkServerWorkload({ repository, serverId, workloadId, deploymentMode = "server-git", remoteFolder = "" }) {
+29
View File
@@ -283,6 +283,35 @@ function createUnraidPreflightMethods({
} }
} }
if (deploymentMode === "server-git") {
const [owner, repo] = String(repository.fullName || "").split("/");
const deploymentFiles = profile.generatedCompose
? ["Dockerfile"]
: this.deploymentComposeFiles(profile);
try {
const existence = await Promise.all(deploymentFiles.map(async (filePath) => ({
filePath,
exists: await this.gitea.repositoryFileExists({ owner, repo, filePath, ref: targetSha }),
})));
const missing = existence.filter((item) => !item.exists).map((item) => item.filePath);
checks.push({
id: "gitea-deployment-files",
label: profile.generatedCompose ? "Dockerfile at Gitea commit" : "Compose files at Gitea commit",
status: missing.length ? "fail" : "pass",
detail: missing.length
? `Missing at exact commit ${targetSha.slice(0, 12)}: ${missing.join(", ")}.`
: `${deploymentFiles.join(", ")} verified at exact commit ${targetSha.slice(0, 12)}.`,
});
} catch (error) {
checks.push({
id: "gitea-deployment-files",
label: "Deployment files at Gitea commit",
status: "fail",
detail: error.message,
});
}
}
try { try {
const connection = await this.ssh.test(server.id, { trustOnFirstUse: false }); const connection = await this.ssh.test(server.id, { trustOnFirstUse: false });
connectionCapabilities = connection.capabilities || {}; connectionCapabilities = connection.capabilities || {};
+20 -6
View File
@@ -59,18 +59,23 @@ function createUnraidStateMethods({ path, bash, shellQuote, inventoryRemoteIdent
return ""; return "";
} }
}; };
const health = await this.checkHealth(profile.healthcheckUrl); const containerRunning = fields.containerRunning === "true";
const health = containerRunning
? await this.checkHealth(profile.healthcheckUrl)
: { configured: false, healthy: false, skipped: "container-stopped" };
const dockerHealthy = fields.dockerHealth const dockerHealthy = fields.dockerHealth
? fields.dockerHealth === "healthy" ? fields.dockerHealth === "healthy"
: null; : null;
const effectiveHealthy = health.configured ? health.healthy : dockerHealthy; const effectiveHealthy = !containerRunning ? false : health.configured ? health.healthy : dockerHealthy;
const runtimeVerification = health.configured const runtimeVerification = !containerRunning
? "stopped"
: health.configured
? "desktop-healthcheck" ? "desktop-healthcheck"
: dockerHealthy === true : dockerHealthy === true
? "docker-healthcheck" ? "docker-healthcheck"
: dockerHealthy === false : dockerHealthy === false
? "docker-unhealthy" ? "docker-unhealthy"
: fields.containerRunning === "true" : containerRunning
? "running-unverified" ? "running-unverified"
: "stopped"; : "stopped";
return this.store.saveDeploymentState(profile.id, { return this.store.saveDeploymentState(profile.id, {
@@ -85,7 +90,7 @@ function createUnraidStateMethods({ path, bash, shellQuote, inventoryRemoteIdent
healthStatus: health.status, healthStatus: health.status,
healthLatencyMs: health.latencyMs, healthLatencyMs: health.latencyMs,
containerName, containerName,
containerRunning: fields.containerRunning === "true", containerRunning,
dockerHealth: fields.dockerHealth || null, dockerHealth: fields.dockerHealth || null,
dockerMan: { dockerMan: {
webUi: decode(fields.webUiLabel), webUi: decode(fields.webUiLabel),
@@ -273,7 +278,16 @@ function createUnraidStateMethods({ path, bash, shellQuote, inventoryRemoteIdent
item.status, item.status,
), ),
); );
return Promise.all(active.map((item) => this.refreshOperation(item.id))); const queue = [...active];
const results = [];
const workers = Array.from({ length: Math.min(4, queue.length) }, async () => {
while (queue.length) {
const operation = queue.shift();
results.push(await this.refreshOperation(operation.id));
}
});
await Promise.all(workers);
return results;
} }
} }
return UnraidStateMethods.prototype; return UnraidStateMethods.prototype;
+23 -12
View File
@@ -33,6 +33,18 @@ function resolveWindowsPowerShellPath(environment = process.env) {
return "powershell.exe"; return "powershell.exe";
} }
function windowsUpdaterSpawnOptions(cwd) {
return {
// A detached hidden PowerShell child can exit successfully on Windows
// without ever executing its -File script. Normal Windows children survive
// their parent; unref() below releases the event-loop reference instead.
detached: false,
stdio: "ignore",
windowsHide: true,
cwd,
};
}
async function readJsonFile(filePath) { async function readJsonFile(filePath) {
try { try {
return JSON.parse(await fs.readFile(filePath, "utf8")); return JSON.parse(await fs.readFile(filePath, "utf8"));
@@ -450,12 +462,11 @@ class UpdateService {
const childState = { exited: false, code: null, error: null }; const childState = { exited: false, code: null, error: null };
let child; let child;
try { try {
child = this.spawnProcess(executable, args, { child = this.spawnProcess(
detached: true, executable,
stdio: "ignore", args,
windowsHide: true, windowsUpdaterSpawnOptions(this.sourcePath),
cwd: this.sourcePath, );
});
} catch (error) { } catch (error) {
error.code ||= "UPDATE_HELPER_SPAWN_FAILED"; error.code ||= "UPDATE_HELPER_SPAWN_FAILED";
throw error; throw error;
@@ -591,12 +602,11 @@ class UpdateService {
"-UpdateId", "-UpdateId",
updateId, updateId,
]; ];
const child = this.spawnProcess(executable, args, { const child = this.spawnProcess(
detached: true, executable,
stdio: "ignore", args,
windowsHide: true, windowsUpdaterSpawnOptions(this.updateDirectory),
cwd: this.updateDirectory, );
});
const childState = { exited: false, code: null, error: null }; const childState = { exited: false, code: null, error: null };
child.once?.("error", (error) => { child.once?.("error", (error) => {
childState.error = error; childState.error = error;
@@ -700,6 +710,7 @@ module.exports = {
UpdateService, UpdateService,
safeRepositoryPart, safeRepositoryPart,
resolveWindowsPowerShellPath, resolveWindowsPowerShellPath,
windowsUpdaterSpawnOptions,
waitForUpdaterStarted, waitForUpdaterStarted,
readJsonFile, readJsonFile,
readLogTail, readLogTail,
+7 -2
View File
@@ -337,8 +337,13 @@ async function handleDeploymentProfileActions(event, target, action, repository)
const result = await window.forgeflow.verifyServerGitProfile(repository, profileId); const result = await window.forgeflow.verifyServerGitProfile(repository, profileId);
ui.serverGitVerifications[profileId] = result; ui.serverGitVerifications[profileId] = result;
render(); render();
const failures = result.checks.filter((check) => check.status === "fail"); const blockers = result.deploymentBlockers || [];
showToast(result.readiness, failures[0]?.detail || `Verified ${result.checks.length} server-pull checks without changing the server.`, result.ready ? "success" : "warning"); const warnings = result.checks.filter((check) => check.status !== "pass" && !blockers.some((blocker) => blocker.id === check.id));
showToast(
result.readiness,
blockers[0]?.detail || warnings[0]?.detail || `Verified ${result.checks.length} server-pull checks without changing the server.`,
blockers.length ? "error" : warnings.length ? "warning" : "success",
);
} catch (error) { } catch (error) {
showToast("Server-pull verification failed", error.message, "error"); showToast("Server-pull verification failed", error.message, "error");
} finally { } finally {
+12
View File
@@ -9,6 +9,18 @@ async function handleShellActions(event, target, action, repository) {
setLoading(false); setLoading(false);
} }
} else if (action === "select-repo") selectRepository(target.dataset.id); } else if (action === "select-repo") selectRepository(target.dataset.id);
else if (action === "open-deployment-link") {
if (!repository) return true;
selectRepository(repository.id, false);
ui.selectedProfileId = target.dataset.profileId || selectedProfile(repository)?.id || null;
ui.repositoryTab = "deployments";
ui.currentView = "repository";
render();
} else if (action === "select-deployment-profile") {
ui.selectedProfileId = target.dataset.profileId || null;
ui.repositoryTab = "deployments";
render();
}
else if (action === "refresh") { else if (action === "refresh") {
await refreshRepositories(true); await refreshRepositories(true);
await refreshActiveOperations(false); await refreshActiveOperations(false);
+59 -3
View File
@@ -176,7 +176,12 @@ const ui = {
inputRenderTimer: null, inputRenderTimer: null,
isMock: false, isMock: false,
refreshError: null, refreshError: null,
refreshWarning: null,
autoRefreshPending: false, autoRefreshPending: false,
repositoryRefreshPromise: null,
repositoryRefreshRequest: null,
deploymentTruthPromise: null,
deploymentTruthRequest: null,
paletteQuery: "", paletteQuery: "",
updateStatus: null, updateStatus: null,
updateChecking: false, updateChecking: false,
@@ -423,11 +428,39 @@ function scheduleAutoRefresh() {
} }
async function refreshRepositories(withLoader = true, silent = false) { async function refreshRepositories(withLoader = true, silent = false) {
ui.repositoryRefreshRequest = {
withLoader: ui.repositoryRefreshRequest?.withLoader === true || withLoader,
silent: ui.repositoryRefreshRequest ? ui.repositoryRefreshRequest.silent && silent : silent,
};
if (ui.repositoryRefreshPromise) return ui.repositoryRefreshPromise;
ui.repositoryRefreshPromise = (async () => {
let result;
while (ui.repositoryRefreshRequest) {
const request = ui.repositoryRefreshRequest;
ui.repositoryRefreshRequest = null;
result = await performRepositoryRefresh(request.withLoader, request.silent);
}
return result;
})();
try {
return await ui.repositoryRefreshPromise;
} finally {
ui.repositoryRefreshPromise = null;
}
}
async function performRepositoryRefresh(withLoader = true, silent = false) {
if (withLoader) setLoading(true, "Refreshing Local → Gitea → Server state…"); if (withLoader) setLoading(true, "Refreshing Local → Gitea → Server state…");
try { try {
const selectedId = ui.selectedRepoId; const selectedId = ui.selectedRepoId;
ui.repositories = await window.forgeflow.refreshRepositories(); ui.repositories = await window.forgeflow.refreshRepositories({ force: withLoader });
ui.refreshError = null; ui.refreshError = null;
const staleRepository = ui.repositories.find(
(repository) => repository.remoteStale,
);
ui.refreshWarning = staleRepository
? `Gitea could not be reached. Showing repository data last refreshed ${formatDate(staleRepository.remoteLastRefreshedAt)} while local and server state continue to refresh.`
: null;
if (selectedId && !selectedRepository()) ui.selectedRepoId = null; if (selectedId && !selectedRepository()) ui.selectedRepoId = null;
const repository = selectedRepository(); const repository = selectedRepository();
if ( if (
@@ -459,6 +492,7 @@ async function refreshRepositories(withLoader = true, silent = false) {
selectRepository(ui.repositories[0].id, false); selectRepository(ui.repositories[0].id, false);
} catch (error) { } catch (error) {
ui.refreshError = error.message; ui.refreshError = error.message;
ui.refreshWarning = null;
if (!silent) showToast("Refresh failed", error.message, "error"); if (!silent) showToast("Refresh failed", error.message, "error");
} finally { } finally {
if (withLoader) setLoading(false); if (withLoader) setLoading(false);
@@ -480,6 +514,25 @@ async function refreshActiveOperations(showErrors = true) {
} }
async function refreshDeploymentTruth(showErrors = false) { async function refreshDeploymentTruth(showErrors = false) {
ui.deploymentTruthRequest = { showErrors: ui.deploymentTruthRequest?.showErrors === true || showErrors };
if (ui.deploymentTruthPromise) return ui.deploymentTruthPromise;
ui.deploymentTruthPromise = (async () => {
let result;
while (ui.deploymentTruthRequest) {
const request = ui.deploymentTruthRequest;
ui.deploymentTruthRequest = null;
result = await performDeploymentTruthRefresh(request.showErrors);
}
return result;
})();
try {
return await ui.deploymentTruthPromise;
} finally {
ui.deploymentTruthPromise = null;
}
}
async function performDeploymentTruthRefresh(showErrors = false) {
let discovery = []; let discovery = [];
try { try {
discovery = (await window.forgeflow.discoverServerDeployments?.()) || []; discovery = (await window.forgeflow.discoverServerDeployments?.()) || [];
@@ -508,8 +561,11 @@ async function refreshDeploymentTruth(showErrors = false) {
); );
if (!targets.length) return { checked: 0, failed: 0, discovery }; if (!targets.length) return { checked: 0, failed: 0, discovery };
const inventoryRefreshedProfiles = new Set(discovery.flatMap((server) => server.refreshedProfileIds || []));
const pendingTargets = targets.filter(({ profile }) => !inventoryRefreshedProfiles.has(profile.id));
const failures = []; const failures = [];
const queue = [...targets]; const queue = [...pendingTargets];
const workers = Array.from( const workers = Array.from(
{ length: Math.min(3, queue.length) }, { length: Math.min(3, queue.length) },
async () => { async () => {
@@ -539,7 +595,7 @@ async function refreshDeploymentTruth(showErrors = false) {
"error", "error",
); );
} }
return { checked: targets.length, failed: failures.length, discovery }; return { checked: targets.length, reusedInventory: targets.length - pendingTargets.length, failed: failures.length, discovery };
} }
function selectRepository(id, shouldRender = true) { function selectRepository(id, shouldRender = true) {
+19 -4
View File
@@ -238,13 +238,15 @@ function createMockDeploymentBridge(context) {
{ {
serverId: "server-unraid", serverId: "server-unraid",
serverName: "Unraid", serverName: "Unraid",
detected: 2, detected: 3,
adopted: 0, adopted: 0,
verified: 1, verified: 1,
linked: 1, refreshedProfiles: 1,
refreshedProfileIds: ["profile-portfolio"],
linked: 2,
unmatched: 0, unmatched: 0,
needsReview: 1, needsReview: 2,
running: 2, running: 3,
stopped: 0, stopped: 0,
capabilities: { capabilities: {
docker: true, docker: true,
@@ -296,6 +298,19 @@ function createMockDeploymentBridge(context) {
reasons: ["container and repository names are similar"], reasons: ["container and repository names are similar"],
})), })),
}, },
{
workloadId: "workload-demo-unresolved",
displayName: "Legacy Worker",
status: "linked",
runtime: { running: true, health: "healthy" },
containers: [{ name: "legacy-worker", running: true }],
candidates: [],
link: {
profileId: "profile-that-no-longer-exists",
repositoryFullName: "jens/removed-repository",
source: "manual",
},
},
], ],
}, },
]; ];
+1 -1
View File
@@ -5,7 +5,7 @@ function createMockRepositoryBridge(context) {
await wait(80); await wait(80);
snapshot(); snapshot();
return { return {
appVersion: "0.10.4-demo", appVersion: "0.10.12-demo",
platform: "win32", platform: "win32",
state: clone(state), state: clone(state),
git: { available: true, version: "git version 2.47.3" }, git: { available: true, version: "git version 2.47.3" },
+62
View File
@@ -357,6 +357,8 @@ select:focus-visible {
padding: 0 6px 10px; padding: 0 6px 10px;
} }
.repo-row { .repo-row {
content-visibility: auto;
contain-intrinsic-size: auto 48px;
width: 100%; width: 100%;
display: grid; display: grid;
grid-template-columns: 18px minmax(0, 1fr) auto; grid-template-columns: 18px minmax(0, 1fr) auto;
@@ -849,6 +851,64 @@ select:focus-visible {
.release-node:last-child { .release-node:last-child {
border-right: 0; border-right: 0;
} }
.repository-deployment-summary {
display: flex;
align-items: center;
gap: 10px;
min-height: 48px;
padding: 7px 12px;
border-bottom: 1px solid var(--line);
background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 7%, var(--surface-1)), var(--surface-1) 42%);
}
.repository-deployment-summary-label {
display: inline-flex;
align-items: center;
gap: 6px;
flex: 0 0 auto;
color: var(--text-muted);
font-size: 10px;
font-weight: 760;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.repository-deployment-summary-label svg {
width: 14px;
height: 14px;
color: var(--accent);
}
.repository-deployment-chips {
display: flex;
gap: 7px;
min-width: 0;
flex: 1;
overflow-x: auto;
scrollbar-width: thin;
}
.repository-deployment-chip {
display: inline-flex;
align-items: center;
gap: 6px;
flex: 0 0 auto;
max-width: 280px;
padding: 6px 9px;
border: 1px solid var(--line);
border-radius: 8px;
background: color-mix(in srgb, var(--surface-2) 88%, transparent);
color: var(--text);
cursor: pointer;
}
.repository-deployment-chip:hover {
border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
}
.repository-deployment-chip strong,
.repository-deployment-chip span:last-child {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.repository-deployment-chip strong { font-size: 11px; }
.repository-deployment-chip span:last-child { color: var(--text-muted); font-size: 10px; }
.release-node:not(:last-child)::after { .release-node:not(:last-child)::after {
content: ""; content: "";
position: absolute; position: absolute;
@@ -2648,6 +2708,8 @@ kbd {
background: linear-gradient(180deg, var(--primary), var(--success)); background: linear-gradient(180deg, var(--primary), var(--success));
} }
.server-inventory-panel .tool-row { .server-inventory-panel .tool-row {
content-visibility: auto;
contain-intrinsic-size: auto 76px;
transition: background 150ms ease, transform 150ms ease; transition: background 150ms ease, transform 150ms ease;
} }
.server-inventory-panel .tool-row:hover { .server-inventory-panel .tool-row:hover {
+63 -8
View File
@@ -31,6 +31,9 @@ function renderTitlebar() {
function renderRepositoryRow(repository) { function renderRepositoryRow(repository) {
const status = repository.localStatus; const status = repository.localStatus;
const profiles = repository.deploymentProfiles || [];
const workloads = linkedWorkloadsForRepository(repository);
const runningWorkloads = workloads.filter((workload) => workload.runtime?.running);
const badges = []; const badges = [];
if (status?.counts.conflicts) if (status?.counts.conflicts)
badges.push('<span class="mini-badge danger" title="Conflicts">!</span>'); badges.push('<span class="mini-badge danger" title="Conflicts">!</span>');
@@ -50,10 +53,14 @@ function renderRepositoryRow(repository) {
badges.push( badges.push(
'<span class="mini-badge success" title="Ready to deploy">↗</span>', '<span class="mini-badge success" title="Ready to deploy">↗</span>',
); );
if (profiles.length)
badges.push(
`<span class="mini-badge ${runningWorkloads.length ? "success" : "warning"} deployment-badge" title="${attr(`${profiles.length} server deployment${profiles.length === 1 ? "" : "s"} linked${runningWorkloads.length ? ` · ${runningWorkloads.length} running` : ""}`)}">S${profiles.length}</span>`,
);
if (!repository.localPath) if (!repository.localPath)
badges.push('<span class="mini-badge" title="No local folder">—</span>'); badges.push('<span class="mini-badge" title="No local folder">—</span>');
const branch = status?.branch.head || repository.defaultBranch || "remote"; const branch = status?.branch.head || repository.defaultBranch || "remote";
return `<button class="repo-row ${String(repository.id) === String(ui.selectedRepoId) ? "active" : ""} ${repository.attention ? "attention" : ""}" data-action="select-repo" data-id="${attr(repository.id)}"> return `<button class="repo-row ${String(repository.id) === String(ui.selectedRepoId) ? "active" : ""} ${repository.attention ? "attention" : ""}" data-action="select-repo" data-id="${attr(repository.id)}" data-deployment-count="${profiles.length}">
<span class="repo-icon">${repository.favorite ? icon("star") : icon(repository.localPath ? "git" : "cloud")}</span> <span class="repo-icon">${repository.favorite ? icon("star") : icon(repository.localPath ? "git" : "cloud")}</span>
<span class="repo-main"><span class="repo-name">${escapeHtml(repository.name)}</span><span class="repo-sub"><span>${escapeHtml(branch)}</span>${status?.shortHead ? `<span>• ${escapeHtml(status.shortHead)}</span>` : ""}</span></span> <span class="repo-main"><span class="repo-name">${escapeHtml(repository.name)}</span><span class="repo-sub"><span>${escapeHtml(branch)}</span>${status?.shortHead ? `<span>• ${escapeHtml(status.shortHead)}</span>` : ""}</span></span>
<span class="repo-badges">${badges.join("")}</span> <span class="repo-badges">${badges.join("")}</span>
@@ -150,6 +157,7 @@ function renderOverview() {
return `<div class="page"> return `<div class="page">
<div class="page-header visual-page-header"><div><div class="eyebrow">Coding flow</div><h1>Release overview</h1><p>One decision surface for local work, Gitea synchronization and the exact version running on your server.</p></div>${projectIllustration("flow")}<button class="button" data-action="refresh">${icon("refresh")}Refresh all</button></div> <div class="page-header visual-page-header"><div><div class="eyebrow">Coding flow</div><h1>Release overview</h1><p>One decision surface for local work, Gitea synchronization and the exact version running on your server.</p></div>${projectIllustration("flow")}<button class="button" data-action="refresh">${icon("refresh")}Refresh all</button></div>
${ui.refreshError ? `<div class="notice danger">${icon("error")} ${escapeHtml(ui.refreshError)}</div>` : ""} ${ui.refreshError ? `<div class="notice danger">${icon("error")} ${escapeHtml(ui.refreshError)}</div>` : ""}
${ui.refreshWarning ? `<div class="notice warning">${icon("warning")} ${escapeHtml(ui.refreshWarning)}</div>` : ""}
<div class="summary-grid"> <div class="summary-grid">
${renderSummaryCard("Local work", changed, changed === 1 ? "repository has changes" : "repositories have changes", "file", changed ? "warning" : "success")} ${renderSummaryCard("Local work", changed, changed === 1 ? "repository has changes" : "repositories have changes", "file", changed ? "warning" : "success")}
${renderSummaryCard("Unpushed", unpushed, "repositories ahead of Gitea", "arrowUp", unpushed ? "warning" : "success")} ${renderSummaryCard("Unpushed", unpushed, "repositories ahead of Gitea", "arrowUp", unpushed ? "warning" : "success")}
@@ -188,6 +196,16 @@ function releaseNode(label, value, description, tone = "") {
return `<div class="release-node"><div class="release-label">${label}</div><div class="release-value"><span class="state-dot ${tone}"></span><strong>${escapeHtml(value)}</strong><span>${escapeHtml(description)}</span></div></div>`; return `<div class="release-node"><div class="release-label">${label}</div><div class="release-value"><span class="state-dot ${tone}"></span><strong>${escapeHtml(value)}</strong><span>${escapeHtml(description)}</span></div></div>`;
} }
function linkedWorkloadsForRepository(repository) {
const fullName = String(repository?.fullName || "").toLowerCase();
if (!fullName) return [];
return (ui.serverDiscovery || []).flatMap((server) =>
(server.workloads || [])
.filter((workload) => String(workload.link?.repositoryFullName || "").toLowerCase() === fullName)
.map((workload) => ({ ...workload, serverId: server.serverId, serverName: server.serverName || server.server?.name || "Server" })),
);
}
function diffAtmosphere(diff) { function diffAtmosphere(diff) {
if (!ui.selectedFile) return ""; if (!ui.selectedFile) return "";
const lines = String(diff || "").split("\n"); const lines = String(diff || "").split("\n");
@@ -355,12 +373,19 @@ function renderProfileCard(repository, profile, compact = false) {
const serverAccessAction = isSsh && mode === "server-git" const serverAccessAction = isSsh && mode === "server-git"
? `<button class="button" data-action="verify-server-git-access" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("shield")}Verify server pull</button><button class="button" data-action="manage-deploy-key" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("key")}Deploy key lifecycle</button><button class="button" data-action="configure-server-git-access" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("key")}Configure Gitea access</button>` ? `<button class="button" data-action="verify-server-git-access" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("shield")}Verify server pull</button><button class="button" data-action="manage-deploy-key" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("key")}Deploy key lifecycle</button><button class="button" data-action="configure-server-git-access" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("key")}Configure Gitea access</button>`
: ""; : "";
return `<article class="deploy-card accent-${identity.accent} ${compact ? "compact-card" : ""}"><div class="container-identity"><span class="container-avatar">${escapeHtml(identity.initial)}</span><div><span>Container</span><strong>${escapeHtml(identity.name)}</strong><small>${escapeHtml(repository.fullName)} · ${escapeHtml(profile.environment)}</small></div>${syncLabel}</div><div class="deploy-card-header"><div><div class="eyebrow">${escapeHtml(isSsh ? "SSH / UNRAID" : "GITEA ACTIONS")}</div><h3>${escapeHtml(profile.name)}</h3><p>${escapeHtml(providerDetail)}</p></div><span class="status-pill ${health.tone}"><span class="state-dot ${health.tone}"></span>${health.label}</span></div><div class="deploy-card-body"><div class="deploy-metadata"><span>Live commit</span><strong>${state.liveSha ? shortSha(state.liveSha) : "Unknown"}</strong><span>Deploy source</span><strong>${escapeHtml(sourceLabel)}</strong><span>Previous version</span><strong>${state.previousSha ? shortSha(state.previousSha) : "Unknown"}</strong><span>Last checked</span><strong>${state.checkedAt ? formatDate(state.checkedAt) : "Never"}</strong>${isSsh ? `<span>Deployment mode</span><strong>${escapeHtml(modeLabel)}</strong><span>Compose project</span><strong>${escapeHtml(profile.composeProject || "ForgeFlow-generated identity")}</strong><span>Runtime</span><strong>${state.containerRunning === false ? "Stopped" : state.containerRunning ? state.runtimeVerification === "running-unverified" ? "Running · unverified" : "Running" : "Unknown"}</strong><span>DockerMan</span><strong class="${managesDockerMan && !dockerManReady ? "text-warning" : "text-success"}">${escapeHtml(dockerManLabel)}</strong>` : ""}<span>Rollback</span><strong>${rollbackConfigured ? "Available after first deploy" : "Not configured"}</strong></div><div class="card-actions"><button class="button" data-action="run-deployment-preflight" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("shield")}Preflight</button>${isSsh ? `<button class="button" data-action="repair-deployment-write-access" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("wrench")}Check / fix write access</button>` : ""}${serverAccessAction}<button class="button" data-action="reconcile-deployment" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("refresh")}Refresh truth</button>${webUi ? `<button class="button" data-action="open-profile-webui" data-url="${attr(webUi)}">${icon("external")}Open Web UI</button>` : ""}${managesDockerMan ? `<button class="button ${dockerManReady ? "ghost" : ""}" data-action="apply-dockerman-metadata" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("wrench")}${dockerManReady ? "Reapply DockerMan integration" : "Repair DockerMan integration"}</button>` : ""}${ready ? `<button class="button primary" data-action="deploy-profile" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("rocket")}Deploy ${escapeHtml(shortSha(targetSha))}</button>` : ""}<button class="button ghost" data-action="edit-deployment-profile" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">Edit</button>${state.previousSha && rollbackConfigured ? `<button class="button danger" data-action="rollback-profile" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("undo")}Rollback</button>` : ""}</div></div></article>`; return `<article class="deploy-card accent-${identity.accent} ${compact ? "compact-card" : ""}"><div class="container-identity"><span class="container-avatar">${escapeHtml(identity.initial)}</span><div><span>Container</span><strong>${escapeHtml(identity.name)}</strong><small>${escapeHtml(repository.fullName)} · ${escapeHtml(profile.environment)}</small></div>${syncLabel}</div><div class="deploy-card-header"><div><div class="eyebrow">${escapeHtml(isSsh ? "SSH / UNRAID" : "GITEA ACTIONS")}</div><h3>${escapeHtml(profile.name)}</h3><p>${escapeHtml(providerDetail)}</p></div><span class="status-pill ${health.tone}"><span class="state-dot ${health.tone}"></span>${health.label}</span></div><div class="deploy-card-body"><div class="deploy-metadata"><span>Live commit</span><strong>${state.liveSha ? shortSha(state.liveSha) : "Unknown"}</strong><span>Deploy source</span><strong>${escapeHtml(sourceLabel)}</strong><span>Previous version</span><strong>${state.previousSha ? shortSha(state.previousSha) : "Unknown"}</strong><span>Last checked</span><strong>${state.checkedAt ? formatDate(state.checkedAt) : "Never"}</strong>${isSsh ? `<span>Deployment mode</span><strong>${escapeHtml(modeLabel)}</strong>${mode === "server-git" ? `<span>Server pull</span><strong class="${verification ? verification.deployReady ? "text-success" : "text-warning" : ""}">${escapeHtml(verification?.readiness || "Verify before deployment")}</strong>` : ""}<span>Compose project</span><strong>${escapeHtml(profile.composeProject || "ForgeFlow-generated identity")}</strong><span>Runtime</span><strong>${state.containerRunning === false ? "Stopped" : state.containerRunning ? state.runtimeVerification === "running-unverified" ? "Running · unverified" : "Running" : "Unknown"}</strong><span>DockerMan</span><strong class="${managesDockerMan && !dockerManReady ? "text-warning" : "text-success"}">${escapeHtml(dockerManLabel)}</strong>` : ""}<span>Rollback</span><strong>${rollbackConfigured ? "Available after first deploy" : "Not configured"}</strong></div><div class="card-actions"><button class="button" data-action="run-deployment-preflight" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("shield")}Preflight</button>${isSsh ? `<button class="button" data-action="repair-deployment-write-access" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("wrench")}Check / fix write access</button>` : ""}${serverAccessAction}<button class="button" data-action="reconcile-deployment" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("refresh")}Refresh truth</button>${webUi ? `<button class="button" data-action="open-profile-webui" data-url="${attr(webUi)}">${icon("external")}Open Web UI</button>` : ""}${managesDockerMan ? `<button class="button ${dockerManReady ? "ghost" : ""}" data-action="apply-dockerman-metadata" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("wrench")}${dockerManReady ? "Reapply DockerMan integration" : "Repair DockerMan integration"}</button>` : ""}${ready ? `<button class="button primary" data-action="deploy-profile" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("rocket")}Deploy ${escapeHtml(shortSha(targetSha))}</button>` : ""}<button class="button ghost" data-action="edit-deployment-profile" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">Edit</button>${state.previousSha && rollbackConfigured ? `<button class="button danger" data-action="rollback-profile" data-repository-id="${attr(repository.id)}" data-profile-id="${attr(profile.id)}">${icon("undo")}Rollback</button>` : ""}</div></div></article>`;
} }
function renderRepositoryDeployments(repository) { function renderRepositoryDeployments(repository) {
const profiles = repository.deploymentProfiles || []; const profiles = repository.deploymentProfiles || [];
const workloads = linkedWorkloadsForRepository(repository);
const profileIds = new Set(profiles.map((profile) => profile.id));
const workloadRows = workloads.map((workload) => {
const containers = (workload.containers || []).map((container) => container.name).filter(Boolean);
const profileResolved = Boolean(workload.link?.profileId && profileIds.has(workload.link.profileId));
return `<div class="tool-row repository-workload-row"><div><strong>${escapeHtml(workload.displayName || containers[0] || "Server workload")}</strong><span>${escapeHtml(workload.serverName)} · ${containers.length ? escapeHtml(containers.join(", ")) : "container identity unavailable"} · ${workload.runtime?.running ? "running" : "stopped"}</span><span>${escapeHtml(workload.compose?.project ? `Compose ${workload.compose.project}` : workload.remoteFolderCandidate || "Docker workload")}</span></div><div class="stack horizontal compact"><span class="status-pill ${profileResolved ? "success" : "danger"}">${profileResolved ? "Repository linked" : "Link needs reconciliation"}</span>${profileResolved ? `<button class="button ghost" data-action="select-deployment-profile" data-profile-id="${attr(workload.link.profileId)}">Open profile</button>` : `<button class="button" data-action="navigate" data-view="deployments">Review inventory</button>`}</div></div>`;
}).join("");
const repoOps = repositoryOperations(repository).slice(0, 10); const repoOps = repositoryOperations(repository).slice(0, 10);
return `<div class="tab-page"><div class="section-heading"><div><h2>Deployment environments</h2><span class="meta">Exact-commit Gitea Actions or pinned SSH / Unraid deployments</span></div><button class="button primary" data-action="configure-deployment">${icon("plus")}Add environment</button></div>${profiles.length ? `<div class="deploy-card-grid">${profiles.map((profile) => renderProfileCard(repository, profile)).join("")}</div>` : '<div class="empty-state panel"><div class="empty-icon">↗</div><h3>No deployment profile</h3><p>Connect a Gitea Actions workflow or a trusted SSH / Unraid server.</p><button class="button primary" data-action="configure-deployment">Configure deployment</button></div>'}<section class="section-block"><div class="section-heading"><h2>Release history</h2></div><div class="panel">${repoOps.length ? `<table class="data-table"><thead><tr><th>Action</th><th>Environment</th><th>Commit</th><th>Status</th><th>Updated</th><th></th></tr></thead><tbody>${repoOps.map((operation) => `<tr><td>${escapeHtml(operation.action || "deploy")}</td><td>${escapeHtml(operation.environment)}</td><td class="mono">${escapeHtml(operation.shortSha || shortSha(operation.sha))}</td><td><span class="status-pill ${toneForStatus(operation.status)}">${escapeHtml(operation.status)}</span></td><td>${formatDate(operation.updatedAt || operation.createdAt)}</td><td><button class="button ghost" data-action="open-operation" data-operation-id="${attr(operation.id)}">Open</button></td></tr>`).join("")}</tbody></table>` : '<div class="empty-state compact"><p>No releases for this repository yet.</p></div>'}</div></section></div>`; return `<div class="tab-page"><div class="section-heading"><div><h2>Deployment environments</h2><span class="meta">${profiles.length} configured profile${profiles.length === 1 ? "" : "s"} · ${workloads.length} server workload${workloads.length === 1 ? "" : "s"} linked to this repository</span></div><button class="button primary" data-action="configure-deployment">${icon("plus")}Add environment</button></div>${workloads.length ? `<section class="panel repository-workloads"><div class="panel-header"><div><h3>Detected on server</h3><span class="meta">Live Docker / Compose identities resolved back to this repository</span></div></div><div class="panel-body"><div class="tool-list">${workloadRows}</div></div></section>` : ""}${profiles.length ? `<div class="deploy-card-grid">${profiles.map((profile) => renderProfileCard(repository, profile)).join("")}</div>` : '<div class="empty-state panel"><div class="empty-icon">↗</div><h3>No deployment profile</h3><p>Connect a Gitea Actions workflow or a trusted SSH / Unraid server.</p><button class="button primary" data-action="configure-deployment">Configure deployment</button></div>'}<section class="section-block"><div class="section-heading"><h2>Release history</h2></div><div class="panel">${repoOps.length ? `<table class="data-table"><thead><tr><th>Action</th><th>Environment</th><th>Commit</th><th>Status</th><th>Updated</th><th></th></tr></thead><tbody>${repoOps.map((operation) => `<tr><td>${escapeHtml(operation.action || "deploy")}</td><td>${escapeHtml(operation.environment)}</td><td class="mono">${escapeHtml(operation.shortSha || shortSha(operation.sha))}</td><td><span class="status-pill ${toneForStatus(operation.status)}">${escapeHtml(operation.status)}</span></td><td>${formatDate(operation.updatedAt || operation.createdAt)}</td><td><button class="button ghost" data-action="open-operation" data-operation-id="${attr(operation.id)}">Open</button></td></tr>`).join("")}</tbody></table>` : '<div class="empty-state compact"><p>No releases for this repository yet.</p></div>'}</div></section></div>`;
} }
function renderGitTools(repository) { function renderGitTools(repository) {
@@ -412,7 +437,10 @@ function renderGitValidator(repository) {
function renderRepositoryWorkspace(repository) { function renderRepositoryWorkspace(repository) {
const status = repository.localStatus; const status = repository.localStatus;
const profiles = repository.deploymentProfiles || [];
const linkedWorkloads = linkedWorkloadsForRepository(repository);
const profile = selectedProfile(repository); const profile = selectedProfile(repository);
const profileWorkload = linkedWorkloads.find((workload) => workload.link?.profileId === profile?.id);
const serverState = profile?.state || {}; const serverState = profile?.state || {};
const localTone = status?.counts.conflicts const localTone = status?.counts.conflicts
? "danger" ? "danger"
@@ -433,6 +461,8 @@ function renderRepositoryWorkspace(repository) {
? "danger" ? "danger"
: serverState.healthy === true : serverState.healthy === true
? "success" ? "success"
: profileWorkload?.runtime?.running
? "success"
: ""; : "";
const content = ( const content = (
{ {
@@ -444,9 +474,19 @@ function renderRepositoryWorkspace(repository) {
settings: renderRepositorySettings, settings: renderRepositorySettings,
}[ui.repositoryTab] || renderChanges }[ui.repositoryTab] || renderChanges
)(repository); )(repository);
const deploymentLinks = profiles.length
? `<div class="repository-deployment-summary"><span class="repository-deployment-summary-label">${icon("server")}Linked deployments</span><div class="repository-deployment-chips">${profiles.map((item) => {
const workload = linkedWorkloads.find((candidate) => candidate.link?.profileId === item.id);
const itemState = item.state || {};
const tone = itemState.healthy === false ? "danger" : itemState.healthy === true ? "success" : workload?.runtime?.running ? "success" : "warning";
const identity = workload?.displayName || item.containerName || item.remoteFolder || item.environment;
return `<button class="repository-deployment-chip" data-action="select-deployment-profile" data-profile-id="${attr(item.id)}"><span class="state-dot ${tone}"></span><strong>${escapeHtml(identity)}</strong><span>${escapeHtml(item.environment)}${workload?.serverName ? ` · ${escapeHtml(workload.serverName)}` : ""}</span></button>`;
}).join("")}</div><button class="button ghost" data-action="select-deployment-profile" data-profile-id="${attr(profile?.id || profiles[0].id)}">View all</button></div>`
: "";
return `<div class="repo-workspace"><header class="repo-header illustrated-repo-header"><div class="repo-heading"><h1><button class="favorite-button ${repository.favorite ? "active" : ""}" data-action="toggle-favorite" title="Toggle favorite">${icon("star")}</button>${escapeHtml(repository.fullName)}</h1><p>${escapeHtml(repository.localPath || "No local working tree linked")}</p></div>${projectIllustration("repo")}<div class="repo-header-actions"><button class="button" data-action="fetch" ${!repository.localPath ? "disabled" : ""}>${icon("refresh")}Fetch</button><button class="button" data-action="open-path" ${!repository.localPath ? "disabled" : ""}>${icon("folder")}Folder</button><button class="button" data-action="open-gitea" ${!repository.htmlUrl ? "disabled" : ""}>${icon("external")}Gitea</button></div></header> return `<div class="repo-workspace"><header class="repo-header illustrated-repo-header"><div class="repo-heading"><h1><button class="favorite-button ${repository.favorite ? "active" : ""}" data-action="toggle-favorite" title="Toggle favorite">${icon("star")}</button>${escapeHtml(repository.fullName)}</h1><p>${escapeHtml(repository.localPath || "No local working tree linked")}</p></div>${projectIllustration("repo")}<div class="repo-header-actions"><button class="button" data-action="fetch" ${!repository.localPath ? "disabled" : ""}>${icon("refresh")}Fetch</button><button class="button" data-action="open-path" ${!repository.localPath ? "disabled" : ""}>${icon("folder")}Folder</button><button class="button" data-action="open-gitea" ${!repository.htmlUrl ? "disabled" : ""}>${icon("external")}Gitea</button></div></header>
${repository.localPath ? `<div class="repo-quick-actions"><button class="button" data-action="open-editor">${icon("external")}Open in editor</button><button class="button" data-action="open-terminal">${icon("terminal")}Open terminal</button><button class="button" data-action="check-branch-protection">${icon("shield")}Check branch protection</button><button class="button primary" data-action="open-pull-request">${icon("git")}Create pull request</button>${ui.branchProtection ? `<span class="status-pill ${ui.branchProtection.protected ? "warning" : "success"}">${ui.branchProtection.protected ? `Protected · ${ui.branchProtection.requiredApprovals || 0} approval(s)` : "Direct pushes allowed"}</span>` : ""}</div>` : ""} ${repository.localPath ? `<div class="repo-quick-actions"><button class="button" data-action="open-editor">${icon("external")}Open in editor</button><button class="button" data-action="open-terminal">${icon("terminal")}Open terminal</button><button class="button" data-action="check-branch-protection">${icon("shield")}Check branch protection</button><button class="button primary" data-action="open-pull-request">${icon("git")}Create pull request</button>${ui.branchProtection ? `<span class="status-pill ${ui.branchProtection.protected ? "warning" : "success"}">${ui.branchProtection.protected ? `Protected · ${ui.branchProtection.requiredApprovals || 0} approval(s)` : "Direct pushes allowed"}</span>` : ""}</div>` : ""}
<div class="release-rail">${releaseNode("Local", status?.shortHead || "Not linked", status ? `${status.counts.changed} changes · ${status.branch.head}` : "No working tree", localTone)}${releaseNode("Gitea", status?.shortHead || "Unknown", status?.branch.upstream ? `${status.branch.ahead} ahead · ${status.branch.behind} behind` : "Branch not published", remoteTone)}${releaseNode(`Server${profile ? ` · ${profile.environment}` : ""}`, serverState.liveSha ? shortSha(serverState.liveSha) : "Unknown", profile ? (serverState.checkedAt ? `checked ${formatDate(serverState.checkedAt)}` : "not checked") : "No deployment profile", serverTone)}</div> <div class="release-rail">${releaseNode("Local", status?.shortHead || "Not linked", status ? `${status.counts.changed} changes · ${status.branch.head}` : "No working tree", localTone)}${releaseNode("Gitea", status?.shortHead || "Unknown", status?.branch.upstream ? `${status.branch.ahead} ahead · ${status.branch.behind} behind` : "Branch not published", remoteTone)}${releaseNode(`Server${profile ? ` · ${profile.environment}` : ""}`, serverState.liveSha ? shortSha(serverState.liveSha) : profile ? "Linked" : "Unknown", profileWorkload ? `${profileWorkload.displayName || profile.containerName || "Container"} · ${profileWorkload.runtime?.running ? "running" : "stopped"} on ${profileWorkload.serverName}` : profile ? (serverState.checkedAt ? `checked ${formatDate(serverState.checkedAt)}` : "profile linked · awaiting live scan") : "No deployment profile", serverTone)}</div>
${deploymentLinks}
<nav class="tabs">${[ <nav class="tabs">${[
["changes", "Changes"], ["changes", "Changes"],
["history", "History"], ["history", "History"],
@@ -531,9 +571,13 @@ function renderServerInventory() {
? visibleWorkloads.map((workload) => { ? visibleWorkloads.map((workload) => {
const containers = (workload.containers || []).map((container) => container.name).filter(Boolean).join(", "); const containers = (workload.containers || []).map((container) => container.name).filter(Boolean).join(", ");
const topCandidate = workload.candidates?.[0]; const topCandidate = workload.candidates?.[0];
const linked = (workload.status === "linked" || Boolean(workload.link)) && workload.classification?.type !== "stale-link"; const linkedRepository = ui.repositories.find((repository) => String(repository.fullName).toLowerCase() === String(workload.link?.repositoryFullName || "").toLowerCase());
const linkedProfile = linkedRepository?.deploymentProfiles?.find((profile) => profile.id === workload.link?.profileId);
const claimsLink = workload.status === "linked" || Boolean(workload.link);
const linked = Boolean(claimsLink && linkedRepository && linkedProfile) && workload.classification?.type !== "stale-link";
const inconsistentLink = claimsLink && !linked;
const classification = workload.classification?.type || workload.status || "review"; const classification = workload.classification?.type || workload.status || "review";
const statusTone = linked && !workload.reviewDecisionStale ? "success" : ["ambiguous", "duplicate", "orphan-container"].includes(classification) || workload.reviewDecisionStale ? "danger" : "warning"; const statusTone = linked && !workload.reviewDecisionStale ? "success" : inconsistentLink || ["ambiguous", "duplicate", "orphan-container"].includes(classification) || workload.reviewDecisionStale ? "danger" : "warning";
const detail = workload.compose?.project const detail = workload.compose?.project
? `Compose ${workload.compose.project} · ${(workload.compose.services || []).join(", ") || "services unknown"}` ? `Compose ${workload.compose.project} · ${(workload.compose.services || []).join(", ") || "services unknown"}`
: workload.dockerMan?.templatePath : workload.dockerMan?.templatePath
@@ -541,6 +585,8 @@ function renderServerInventory() {
: `Container installation · ${containers || "unnamed"}`; : `Container installation · ${containers || "unnamed"}`;
const candidate = linked const candidate = linked
? `Linked to ${workload.link?.repositoryFullName || "repository"}` ? `Linked to ${workload.link?.repositoryFullName || "repository"}`
: inconsistentLink
? `Stored link cannot be resolved to a loaded repository profile`
: topCandidate : topCandidate
? `${topCandidate.repositoryFullName} suggested · ${topCandidate.confidence || topCandidate.status || "review required"}` ? `${topCandidate.repositoryFullName} suggested · ${topCandidate.confidence || topCandidate.status || "review required"}`
: "No repository candidate; select one manually"; : "No repository candidate; select one manually";
@@ -549,10 +595,19 @@ function renderServerInventory() {
? `<button class="button primary" data-action="quick-link-server-workload" data-server-id="${attr(server.serverId)}" data-workload-id="${attr(workload.workloadId)}" data-repository="${attr(topCandidate.repositoryFullName)}">${icon("link")}Link to ${escapeHtml(topCandidate.repositoryName || topCandidate.repositoryFullName)}</button>` ? `<button class="button primary" data-action="quick-link-server-workload" data-server-id="${attr(server.serverId)}" data-workload-id="${attr(workload.workloadId)}" data-repository="${attr(topCandidate.repositoryFullName)}">${icon("link")}Link to ${escapeHtml(topCandidate.repositoryName || topCandidate.repositoryFullName)}</button>`
: `<button class="button primary" data-action="link-server-workload" data-server-id="${attr(server.serverId)}" data-workload-id="${attr(workload.workloadId)}">${icon("link")}Review & link</button>`; : `<button class="button primary" data-action="link-server-workload" data-server-id="${attr(server.serverId)}" data-workload-id="${attr(workload.workloadId)}">${icon("link")}Review & link</button>`;
const evidenceNote = workload.reviewDecisionStale ? "Saved decision is stale because server evidence changed" : workload.classification?.reason || "Awaiting review"; const evidenceNote = workload.reviewDecisionStale ? "Saved decision is stale because server evidence changed" : workload.classification?.reason || "Awaiting review";
return `<div class="tool-row"><div><strong>${escapeHtml(workload.displayName)}</strong><span>${escapeHtml(detail)} · ${workload.runtime?.running ? "running" : "stopped"}</span><span>${escapeHtml(candidate)}</span><span class="${workload.reviewDecisionStale ? "text-warning" : "meta"}">${escapeHtml(evidenceNote)}</span>${workload.metadata?.composeDefinitionError ? `<span class="text-warning">Compose file found; validation warning: ${escapeHtml(workload.metadata.composeDefinitionError)}</span>` : ""}</div><div class="stack horizontal compact"><span class="status-pill ${statusTone}">${escapeHtml(workload.reviewDecisionStale ? "Decision stale" : linked ? "Linked" : classification)}</span>${linked ? `<button class="button ghost" data-action="edit-deployment-profile" data-profile-id="${attr(workload.link?.profileId || "")}">Open link</button>` : linkButton}</div></div>`; return `<div class="tool-row"><div><strong>${escapeHtml(workload.displayName)}</strong><span>${escapeHtml(detail)} · ${workload.runtime?.running ? "running" : "stopped"}</span><span>${escapeHtml(candidate)}</span><span class="${workload.reviewDecisionStale || inconsistentLink ? "text-warning" : "meta"}">${escapeHtml(inconsistentLink ? "Reconcile this inventory link before deployment" : evidenceNote)}</span>${workload.metadata?.composeDefinitionError ? `<span class="text-warning">Compose file found; validation warning: ${escapeHtml(workload.metadata.composeDefinitionError)}</span>` : ""}</div><div class="stack horizontal compact"><span class="status-pill ${statusTone}">${escapeHtml(workload.reviewDecisionStale ? "Decision stale" : linked ? "Linked" : inconsistentLink ? "Link unresolved" : classification)}</span>${linked ? `<button class="button ghost" data-action="open-deployment-link" data-repository-id="${attr(linkedRepository.id)}" data-profile-id="${attr(linkedProfile.id)}">Open in repository</button>` : inconsistentLink ? `<button class="button" data-action="plan-server-reconciliation" data-server-id="${attr(server.serverId)}">Reconcile</button>` : linkButton}</div></div>`;
}).join("") }).join("")
: `<div class="empty-state compact"><p>${server.error ? "No inventory could be read until the SSH connection works." : "Docker returned no containers, Compose projects or DockerMan templates."}</p></div>`; : `<div class="empty-state compact"><p>${server.error ? "No inventory could be read until the SSH connection works." : "Docker returned no containers, Compose projects or DockerMan templates."}</p></div>`;
return `<section class="panel server-inventory-panel"><div class="panel-header"><div><h3>${escapeHtml(server.serverName || server.server?.name || server.serverId)}</h3><span class="meta">${server.running || 0} running · ${server.linked || 0} repository links · ${visibleWorkloads.filter((workload) => !workload.link).length} to review${hiddenCount ? ` · ${hiddenCount} unrelated/system workloads hidden` : ""}</span></div><div class="stack horizontal compact"><span class="status-pill ${server.error ? "danger" : capabilities.docker && capabilities.compose ? "success" : "warning"}">${server.error ? "Scan failed" : escapeHtml(capabilityText)}</span>${server.error ? "" : `<button class="button" data-action="plan-server-reconciliation" data-server-id="${attr(server.serverId)}">${icon("shield")}Review reconciliation</button>`}</div></div><div class="panel-body">${errorBlock}${warnings}<div class="tool-list">${workloads}</div></div></section>`; const resolvedLinks = visibleWorkloads.filter((workload) => {
const repository = ui.repositories.find((item) => String(item.fullName).toLowerCase() === String(workload.link?.repositoryFullName || "").toLowerCase());
return repository?.deploymentProfiles?.some((profile) => profile.id === workload.link?.profileId);
}).length;
const unresolvedLinks = visibleWorkloads.filter((workload) => {
if (!(workload.status === "linked" || workload.link)) return false;
const repository = ui.repositories.find((item) => String(item.fullName).toLowerCase() === String(workload.link?.repositoryFullName || "").toLowerCase());
return !repository?.deploymentProfiles?.some((profile) => profile.id === workload.link?.profileId);
}).length;
return `<section class="panel server-inventory-panel"><div class="panel-header"><div><h3>${escapeHtml(server.serverName || server.server?.name || server.serverId)}</h3><span class="meta">${server.running || 0} running · ${resolvedLinks} visible repository links${unresolvedLinks ? ` · ${unresolvedLinks} unresolved` : ""} · ${visibleWorkloads.filter((workload) => !workload.link).length} to review${hiddenCount ? ` · ${hiddenCount} unrelated/system workloads hidden` : ""}</span></div><div class="stack horizontal compact"><span class="status-pill ${server.error ? "danger" : capabilities.docker && capabilities.compose ? "success" : "warning"}">${server.error ? "Scan failed" : escapeHtml(capabilityText)}</span>${server.error ? "" : `<button class="button" data-action="plan-server-reconciliation" data-server-id="${attr(server.serverId)}">${icon("shield")}Review reconciliation</button>`}</div></div><div class="panel-body">${errorBlock}${warnings}<div class="tool-list">${workloads}</div></div></section>`;
}).join(""); }).join("");
const empty = configuredServers.length const empty = configuredServers.length
? `<div class="empty-state panel"><h3>Server inventory has not completed</h3><p>ForgeFlow will query Docker directly. A failed connection is shown explicitly instead of being reported as zero deployments.</p><button class="button primary" data-action="scan-server-inventory">Scan servers now</button></div>` ? `<div class="empty-state panel"><h3>Server inventory has not completed</h3><p>ForgeFlow will query Docker directly. A failed connection is shown explicitly instead of being reported as zero deployments.</p><button class="button primary" data-action="scan-server-inventory">Scan servers now</button></div>`
+23 -3
View File
@@ -74,8 +74,11 @@ async function assertScrollableWhenOverflowing(page, selector) {
return metrics.connected && metrics.clientHeight > 0; return metrics.connected && metrics.clientHeight > 0;
}).toBe(true); }).toBe(true);
if (metrics.scrollHeight > metrics.clientHeight + 1) { if (metrics.scrollHeight > metrics.clientHeight + 1) {
await target.evaluate((element) => { element.scrollTop = element.scrollHeight; }); await expect.poll(() => target.evaluate((element) => {
await expect.poll(() => target.evaluate((element) => element.scrollTop)).toBeGreaterThan(0); if (element.scrollHeight <= element.clientHeight + 1) return 1;
element.scrollTop = element.scrollHeight;
return element.scrollTop;
})).toBeGreaterThan(0);
} }
} }
test("shell, overview, repositories and settings remain responsive and accessible", async ({ page }, testInfo) => { test("shell, overview, repositories and settings remain responsive and accessible", async ({ page }, testInfo) => {
@@ -115,8 +118,12 @@ test("repository changes, Git tools and Git Validator complete their primary flo
test("every long application surface retains a working vertical scroll owner", async ({ page }) => { test("every long application surface retains a working vertical scroll owner", async ({ page }) => {
for (const view of ["overview", "deployments", "diagnostics", "settings"]) { for (const view of ["overview", "deployments", "diagnostics", "settings"]) {
await page.locator(`.nav-button[data-view="${view}"]`).click(); await test.step(`${view} view scrolls`, async () => {
const navigation = page.locator(`.nav-button[data-view="${view}"]`);
await navigation.click();
await expect(navigation).toHaveClass(/active/);
await assertScrollableWhenOverflowing(page, ".main-canvas"); await assertScrollableWhenOverflowing(page, ".main-canvas");
});
} }
await page.locator('[data-action="select-repo"]').first().click(); await page.locator('[data-action="select-repo"]').first().click();
for (const tab of ["history", "deployments", "gittools", "validator", "settings"]) { for (const tab of ["history", "deployments", "gittools", "validator", "settings"]) {
@@ -135,6 +142,19 @@ test("deployment inventory supports dense workloads without ambiguous blank card
for (let index = 0; index < Math.min(count, 25); index += 1) { for (let index = 0; index < Math.min(count, 25); index += 1) {
await expect(cards.nth(index)).not.toHaveText(/^\s*$/); await expect(cards.nth(index)).not.toHaveText(/^\s*$/);
} }
const unresolved = page.locator(".tool-row", { hasText: "Legacy Worker" });
await expect(unresolved).toContainText("Link unresolved");
await expect(unresolved).not.toContainText(/^Linked$/);
await expect(page.locator(".server-inventory-panel").first()).toContainText("1 unresolved");
const repositoryLink = page.locator('[data-action="open-deployment-link"]');
if (await repositoryLink.count()) {
await repositoryLink.first().click();
await expect(page.locator('.repo-row.active')).toHaveAttribute("data-deployment-count", /^[1-9]/);
await expect(page.locator('.repo-row.active .deployment-badge')).toBeVisible();
await expect(page.locator('.tab[data-action="repo-tab"][data-tab="deployments"]')).toHaveClass(/active/);
await expect(page.locator(".repository-workloads")).toBeVisible();
await expect(page.locator(".repository-workload-row").first()).toContainText("Repository linked");
}
await assertSurface(page); await assertSurface(page);
}); });
+19
View File
@@ -172,3 +172,22 @@ test('rollback refuses a stale target that is no longer the server-reported prev
assert.equal(dispatched, false); assert.equal(dispatched, false);
}); });
test('active deployment refreshes run concurrently with a bounded worker pool', async () => {
const operations = Array.from({ length: 9 }, (_, index) => ({ id: `operation-${index}`, type: 'deployment', status: 'running' }));
const service = new DeploymentService({ data: { operations } }, {}, {});
let running = 0;
let peak = 0;
service.refreshOperation = async (id) => {
running += 1;
peak = Math.max(peak, running);
await new Promise((resolve) => setTimeout(resolve, 10));
running -= 1;
return { id };
};
const refreshed = await service.refreshActiveOperations();
assert.equal(refreshed.length, operations.length);
assert.ok(peak > 1);
assert.ok(peak <= 4);
});
+26
View File
@@ -0,0 +1,26 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { EventEmitter } from 'node:events';
import policyModule from '../src/main/process-error-policy.cjs';
const { installOutputPipeGuards, isBrokenPipeError } = policyModule;
test('broken output pipes are recognized without treating unrelated failures as EPIPE', () => {
assert.equal(isBrokenPipeError(Object.assign(new Error('closed'), { code: 'EPIPE' })), true);
assert.equal(isBrokenPipeError(Object.assign(new Error('denied'), { code: 'EACCES' })), false);
assert.equal(isBrokenPipeError(null), false);
});
test('output pipe guard absorbs EPIPE and can be cleanly removed', () => {
const stdout = new EventEmitter();
const stderr = new EventEmitter();
const observed = [];
const remove = installOutputPipeGuards({ stdout, stderr, onBrokenPipe: (error) => observed.push(error.code) });
stdout.emit('error', Object.assign(new Error('closed'), { code: 'EPIPE' }));
stderr.emit('error', Object.assign(new Error('closed'), { code: 'EPIPE' }));
assert.deepEqual(observed, ['EPIPE', 'EPIPE']);
remove();
assert.equal(stdout.listenerCount('error'), 0);
assert.equal(stderr.listenerCount('error'), 0);
});
+7
View File
@@ -10,6 +10,13 @@ async function ipcSource() {
return (await Promise.all(["ipc.cjs", "ipc/repository-handlers.cjs", "ipc/deployment-handlers.cjs", "ipc/operations-handlers.cjs"].map((file) => readFile(new URL(`../src/main/${file}`, import.meta.url), "utf8")))).join("\n"); return (await Promise.all(["ipc.cjs", "ipc/repository-handlers.cjs", "ipc/deployment-handlers.cjs", "ipc/operations-handlers.cjs"].map((file) => readFile(new URL(`../src/main/${file}`, import.meta.url), "utf8")))).join("\n");
} }
test("desktop shell serializes ForgeFlow to one configuration writer", async () => {
const main = await readFile(new URL("../main.cjs", import.meta.url), "utf8");
assert.match(main, /requestSingleInstanceLock\(\)/);
assert.match(main, /second-instance/);
assert.match(main, /showMainWindow\(\)/);
});
test("changed file list has an independently scrollable bounded layout", async () => { test("changed file list has an independently scrollable bounded layout", async () => {
const css = await readFile( const css = await readFile(
new URL("../src/renderer/styles.css", import.meta.url), new URL("../src/renderer/styles.css", import.meta.url),
+61
View File
@@ -143,6 +143,67 @@ test('refresh remains local-only without configured Gitea credentials', async ()
assert.deepEqual(await instance.refresh(), []); assert.deepEqual(await instance.refresh(), []);
}); });
test('refresh uses last-known Gitea repositories after a transient remote failure', async () => {
const warnings = [];
let remoteAvailable = true;
const store = {
data: {
gitea: { baseUrl: 'https://gitea.example' }, workspaceRoots: [], repositoryMappings: {},
preferences: { preferredCloneProtocol: 'ssh' }, favorites: []
},
getToken: () => 'token', getDeploymentProfiles: () => [], getDeploymentState: () => null
};
const instance = new RepositoryService(store, {}, {
listRepositories: async () => {
if (!remoteAvailable) throw new Error('Gitea timed out');
return [remote];
}
}, { debug: async () => {}, warning: async (...args) => warnings.push(args) });
instance.discoverAll = async () => [];
const fresh = await instance.refresh();
remoteAvailable = false;
const degraded = await instance.refresh({ force: true });
assert.equal(fresh[0].remoteStale, false);
assert.equal(degraded[0].fullName, remote.full_name);
assert.equal(degraded[0].remoteStale, true);
assert.equal(degraded[0].remoteRefreshError, 'Gitea timed out');
assert.ok(degraded[0].remoteLastRefreshedAt);
assert.equal(warnings[0][0], 'repositories.remote-refresh.degraded');
});
test('initial Gitea failure remains visible when no safe cache exists', async () => {
const store = {
data: { gitea: { baseUrl: 'https://gitea.example' } },
getToken: () => 'token'
};
const instance = new RepositoryService(store, {}, {
listRepositories: async () => { throw new Error('Gitea unavailable'); }
});
await assert.rejects(() => instance.refresh(), /Gitea unavailable/);
});
test('refresh coalesces concurrent work and briefly reuses remote and discovery results', async () => {
let remoteCalls = 0;
let discoveryCalls = 0;
const store = {
data: { gitea: { baseUrl: 'https://gitea.example' }, workspaceRoots: [], repositoryMappings: {}, preferences: { preferredCloneProtocol: 'ssh' }, favorites: [] },
getToken: () => 'token', getDeploymentProfiles: () => [], getDeploymentState: () => null
};
const instance = new RepositoryService(store, {}, { listRepositories: async () => { remoteCalls += 1; await new Promise((resolve) => setTimeout(resolve, 10)); return [remote]; } });
instance.discoverAll = async () => { discoveryCalls += 1; return []; };
const [first, second] = await Promise.all([instance.refresh(), instance.refresh()]);
assert.deepEqual(first, second);
await instance.refresh();
assert.equal(remoteCalls, 1);
assert.equal(discoveryCalls, 1);
await instance.refresh({ force: true });
assert.equal(remoteCalls, 2);
assert.equal(discoveryCalls, 2);
});
test('decoration reports conflicts, behind branches, errors and remote-only repositories', () => { test('decoration reports conflicts, behind branches, errors and remote-only repositories', () => {
const instance = service(); const instance = service();
const conflicted = instance.decorate(remote, { localPath: 'repo', status: { ...status(), counts: { changed: 1, conflicts: 2 }, branch: { ...status().branch, behind: 3 } } }, []); const conflicted = instance.decorate(remote, { localPath: 'repo', status: { ...status(), counts: { changed: 1, conflicts: 2 }, branch: { ...status().branch, behind: 3 } } }, []);
+6
View File
@@ -141,4 +141,10 @@ test('legacy container sanitizer applies safe defaults to partial Docker inspect
'tech.itworx.forgeflow.branch': '', 'net.unraid.docker.webui': '', 'net.unraid.docker.icon': '', 'net.unraid.docker.shell': '', 'net.unraid.docker.managed': '', 'tech.itworx.forgeflow.branch': '', 'net.unraid.docker.webui': '', 'net.unraid.docker.icon': '', 'net.unraid.docker.shell': '', 'net.unraid.docker.managed': '',
}, ports: {}, mounts: [], networks: {}, restartPolicy: '', }, ports: {}, mounts: [], networks: {}, restartPolicy: '',
}); });
assert.equal(sanitizeLegacyContainer({
Id: 'no-healthcheck',
Name: '/NoHealthcheck',
State: { Running: true, Status: 'running' },
Config: { Image: 'example/no-healthcheck:latest', Labels: null },
}).health, null);
}); });
+149 -10
View File
@@ -40,6 +40,36 @@ test("server release directories resolve to the stable deployment root", () => {
assert.equal(deploymentRootCandidate("ludarium/source/deploy"), "ludarium/source/deploy"); assert.equal(deploymentRootCandidate("ludarium/source/deploy"), "ludarium/source/deploy");
}); });
test("inventory refresh preserves a repository deployment root above its Compose working directory", () => {
const service = new UnraidDeploymentService({});
const existing = {
id: "profile", provider: "ssh-unraid", serverId: "server", environment: "production",
branch: "main", deploymentMode: "server-git", remoteFolder: "App/source",
composeWorkingDir: "/mnt/user/appdata/App/source/ops", composeProject: "app",
composeFiles: ["ops/compose.yml"], composeServices: ["web"], containerName: "app-web",
workloadIdentity: { linkSource: "automatic-compose" }, preservePaths: [".env"],
};
const workload = {
workloadId: "workload", kind: "compose-project", displayName: "app",
remoteFolderCandidate: "App/source/ops", selector: { kind: "compose-project", composeProject: "app" },
compose: {
project: "app", workingDir: "/mnt/user/appdata/App/source/ops",
configFiles: ["/mnt/user/appdata/App/source/ops/compose.yml"], services: ["web"],
},
containers: [{ name: "app-web", running: true, service: "web", mounts: [], ports: [] }],
metadata: {}, dockerMan: null,
};
const refreshed = service.refreshedProfileFromWorkload(
{ fullName: "Owner/App", name: "App", defaultBranch: "main", sshUrl: "git@gitea.test:Owner/App.git" },
{ id: "server", name: "Server", basePath: "/mnt/user/appdata" },
workload,
existing,
);
assert.equal(refreshed.remoteFolder, "App/source");
assert.equal(refreshed.composeWorkingDir, "/mnt/user/appdata/App/source/ops");
assert.deepEqual(refreshed.composeFiles, ["ops/compose.yml"]);
});
test("server inspection key-value payload is decoded safely", () => { test("server inspection key-value payload is decoded safely", () => {
const b64 = (value) => Buffer.from(value).toString("base64"); const b64 = (value) => Buffer.from(value).toString("base64");
const parsed = parseInspection( const parsed = parseInspection(
@@ -86,6 +116,36 @@ test("server pull provisions a pinned repository-scoped key and records access m
assert.equal(result.remoteSha, "a".repeat(40)); assert.equal(result.remoteSha, "a".repeat(40));
}); });
test("server pull prefers the linked checkout origin over stale detected SSH endpoints", () => {
const service = new UnraidDeploymentService({});
const repository = {
fullName: "Jens/Portfolio",
localStatus: { remoteUrl: "git@gitea.itworx.tech:Jens/Portfolio.git" },
sshUrl: "ssh://git@192.168.10.150:222/Jens/Portfolio.git",
preferredCloneUrl: "ssh://git@192.168.10.150:222/Jens/Portfolio.git",
};
const profile = { cloneUrl: "ssh://git@192.168.10.150:222/Jens/Portfolio.git" };
assert.equal(service.serverGitRemote(repository, profile), "git@gitea.itworx.tech:Jens/Portfolio.git");
assert.deepEqual(service.serverGitHost(repository, profile), { host: "gitea.itworx.tech", port: 22 });
});
test("write-access inspection parses the remote permission report through the access module", async () => {
const encoded = (value) => Buffer.from(value).toString("base64");
const profile = { id: "profile", provider: "ssh-unraid", serverId: "server", remoteFolder: "App", composeFiles: ["compose.yml"] };
const service = new UnraidDeploymentService({
store: {
getDeploymentProfile: () => profile,
getServer: () => ({ id: "server", basePath: "/mnt/user/appdata" }),
},
ssh: { exec: async () => ({ stdout: `__FORGEFLOW_PERMISSIONS__\nI\t${encoded("deploy")}\t1000\t1000\t${encoded("users")}\tfalse\tfalse\nP\t${encoded("project-root")}\t${encoded("Project folder")}\t${encoded("/mnt/user/appdata/App")}\tdirectory\ttrue\ttrue\ttrue\ttrue\ttrue\ttrue\t${encoded("deploy")}\t${encoded("users")}\t2775\t${encoded("/mnt/user/appdata/App")}\t${encoded("Read/write probe passed.")}\n` }) },
});
const report = await service.inspectWriteAccess({ repository: { fullName: "Owner/App" }, profileId: "profile" });
assert.equal(report.ready, true);
assert.equal(report.identity.user, "deploy");
assert.equal(report.targets[0].effectiveWritable, true);
});
test("server pull verification proves a repository-scoped read-only key and exact commit parity", async () => { test("server pull verification proves a repository-scoped read-only key and exact commit parity", async () => {
const sha = "c".repeat(40); const sha = "c".repeat(40);
const profile = { const profile = {
@@ -112,6 +172,33 @@ test("server pull verification proves a repository-scoped read-only key and exac
assert.equal(report.checks.find((check) => check.id === "deploy-key-scope").status, "pass"); assert.equal(report.checks.find((check) => check.id === "deploy-key-scope").status, "pass");
}); });
test("server pull remains deploy-ready when only live runtime evidence is incomplete", async () => {
const sha = "c".repeat(40);
const profile = {
id: "profile-runtime-incomplete", provider: "ssh-unraid", serverId: "unraid", remoteFolder: "portfolio",
environment: "production", branch: "main", deploymentMode: "server-git", composeFiles: ["compose.yml"],
serverGitAccess: { deployKeyId: 17, keyFingerprint: "SHA256:key", hostFingerprint: "SHA256:host" },
};
const service = new UnraidDeploymentService({
store: {
getDeploymentProfile: () => profile,
getServer: () => ({ id: "unraid", name: "Unraid", basePath: "/mnt/user/appdata" }),
getDeploymentState: () => ({ containerRunning: true, healthy: null }),
},
ssh: { exec: async () => ({ stdout: `__FORGEFLOW_SERVER_GIT_PROBE__\nremoteSha=${sha}\nkeyFingerprint=SHA256:key\nhostFingerprint=SHA256:host\n` }) },
gitea: {
getBranch: async () => ({ commit: { id: sha } }),
listDeployKeys: async () => [{ id: 17, read_only: true }],
},
});
service.inspect = async () => ({ exists: true, composeFiles: ["compose.yml"], head: null });
const report = await service.verifyServerGitProfile({ repository: { fullName: "Jens/Portfolio", sshUrl: "git@gitea.test:Jens/Portfolio.git" }, profileId: profile.id });
assert.equal(report.deployReady, true);
assert.equal(report.ready, true);
assert.equal(report.readiness, "Deploy-ready; runtime verification incomplete");
assert.deepEqual(report.deploymentBlockers, []);
});
test("server pull verification blocks a writable Gitea deploy key", async () => { test("server pull verification blocks a writable Gitea deploy key", async () => {
const sha = "d".repeat(40); const sha = "d".repeat(40);
const profile = { const profile = {
@@ -168,7 +255,7 @@ test("server workload inventory links running containers to exact Gitea checkout
); );
}); });
test("server discovery is read-only and explicit reconciliation adopts a verified deployment", async () => { test("low-level inventory scan is read-only and user discovery auto-links exact provenance", async () => {
const b64 = (value) => Buffer.from(value).toString("base64"); const b64 = (value) => Buffer.from(value).toString("base64");
const sha = "b".repeat(40); const sha = "b".repeat(40);
const container = { const container = {
@@ -218,20 +305,19 @@ test("server discovery is read-only and explicit reconciliation adopts a verifie
sshUrl: "git@gitea.itworx.tech:Jens/Portfolio.git", sshUrl: "git@gitea.itworx.tech:Jens/Portfolio.git",
}, },
]; ];
const discovery = await service.discoverServerWorkloads("unraid", repositories); const readOnlyDiscovery = await service.scanServerInventory("unraid", repositories);
assert.equal(discovery.adopted, 0); assert.equal(readOnlyDiscovery.adopted, 0);
assert.equal(discovery.verified, 0); assert.equal(readOnlyDiscovery.verified, 0);
assert.equal(profiles.length, 0); assert.equal(profiles.length, 0);
assert.equal(states.size, 0); assert.equal(states.size, 0);
const preview = await service.planServerInventoryReconciliation("unraid", repositories, { autoLink: true }); const discovery = await service.discoverServerWorkloads("unraid", repositories);
assert.equal(preview.plan.summary.additions, 1); assert.equal(discovery.adopted, 1);
const result = await service.reconcileServerInventory("unraid", repositories, { autoLink: true, expectedPlanId: preview.plan.id }); assert.equal(discovery.verified, 1);
assert.equal(result.adopted, 1);
assert.equal(result.verified, 1);
assert.equal(profiles[0].containerName, "Portfolio"); assert.equal(profiles[0].containerName, "Portfolio");
assert.equal(profiles[0].adoptedFromServer, true); assert.equal(profiles[0].adoptedFromServer, true);
assert.equal(states.get(profiles[0].id).matchesGitea, true); assert.equal(states.get(profiles[0].id).matchesGitea, true);
assert.deepEqual(discovery.refreshedProfileIds, [profiles[0].id]);
}); });
@@ -300,6 +386,18 @@ test("server inventory includes stopped DockerMan containers without Git and kee
assert.match(workloads[0].candidates[0].reasons.join(" "), /manual confirmation/i); assert.match(workloads[0].candidates[0].reasons.join(" "), /manual confirmation/i);
}); });
test("server inventory batches Docker inspect and retains a disappearing-container fallback", async () => {
const source = await unraidSource();
assert.match(source, /docker inspect "\\\$\{container_ids\[@\]\}"/);
assert.match(source, /for container_id in "\\\$\{container_ids\[@\]\}"/);
});
test("server inventory avoids a second Compose process for static image definitions", async () => {
const source = await unraidSource();
assert.match(source, /has_override=false/);
assert.match(source, /\[ -z "\$images" \].*config --images/);
});
test("server inventory groups multi-service Compose projects and preserves their identity", () => { test("server inventory groups multi-service Compose projects and preserves their identity", () => {
const baseContainer = { const baseContainer = {
image: "example/app:latest", image: "example/app:latest",
@@ -392,6 +490,40 @@ test("manual workload linking does not claim Gitea parity for unrelated provenan
assert.equal(savedState.giteaSha, null); assert.equal(savedState.giteaSha, null);
}); });
test("inventory provenance alone never claims Gitea commit parity", async () => {
let savedState = null;
const service = new UnraidDeploymentService({
store: { getDeploymentState: () => ({}), saveDeploymentState: async (_id, state) => { savedState = state; return state; } },
});
await service.saveWorkloadState(
{ id: "profile", remoteFolder: "app", cloneUrl: "git@gitea.test:Owner/App.git" },
{
workloadId: "workload", observedAt: new Date().toISOString(),
metadata: { sourceRepository: "git@gitea.test:Owner/App.git", liveRevision: "a".repeat(40) },
runtime: { running: true, health: "healthy" }, containers: [{ name: "app", running: true, health: "healthy" }], compose: {},
},
{ basePath: "/mnt/user/appdata" },
);
assert.equal(savedState.matchesGitea, false);
assert.equal(savedState.giteaSha, null);
});
test("a stopped workload cannot become healthy through a reused healthcheck port", async () => {
let savedState = null;
const service = new UnraidDeploymentService({
store: { getDeploymentState: () => ({}), saveDeploymentState: async (_id, state) => { savedState = state; return state; } },
});
await service.saveWorkloadState(
{ id: "profile", remoteFolder: "app", healthcheckUrl: "http://server.test/health" },
{ workloadId: "workload", metadata: {}, runtime: { running: false, health: "unverified" }, containers: [{ name: "app", running: false }], compose: {} },
{ basePath: "/mnt/user/appdata" },
{ health: { configured: true, healthy: true, status: 200 } },
);
assert.equal(savedState.containerRunning, false);
assert.equal(savedState.healthy, false);
assert.equal(savedState.runtimeVerification, "stopped");
});
test("Docker ignore checks identify exact runtime and Git context exclusions", () => { test("Docker ignore checks identify exact runtime and Git context exclusions", () => {
const rules = "# build context\n.git\ndata/\nlogs/**\n!logs/keep.txt\n"; const rules = "# build context\n.git\ndata/\nlogs/**\n!logs/keep.txt\n";
assert.equal(dockerIgnoreHasPath(rules, ".git"), true); assert.equal(dockerIgnoreHasPath(rules, ".git"), true);
@@ -1073,6 +1205,8 @@ test("inventory scan uses only configured roots and reports partial find failure
assert.match(script, /-name 'scratch'/); assert.match(script, /-name 'scratch'/);
assert.match(script, /Inventory scan partially failed/); assert.match(script, /Inventory scan partially failed/);
assert.match(script, /2>"\$scan_error" \|\| true/); assert.match(script, /2>"\$scan_error" \|\| true/);
assert.match(script, /docker inspect "\$container_id"/);
assert.doesNotMatch(script, /docker inspect --format/);
assert.doesNotMatch(script, /add_scan_root \/mnt\/cache\/appdata/); assert.doesNotMatch(script, /add_scan_root \/mnt\/cache\/appdata/);
}); });
@@ -1296,7 +1430,10 @@ test("server-pull preflight resolves Gitea SHA and reports every degraded capabi
}, },
git: { status: async () => ({ root: "/local", clean: false, counts: { changed: 3 }, branch: { head: "main" } }) }, git: { status: async () => ({ root: "/local", clean: false, counts: { changed: 3 }, branch: { head: "main" } }) },
ssh: { test: async () => ({ capabilities: { docker: true, dockerReady: false, compose: false, git: false, tar: true, checksum: false, baseWritable: false } }) }, ssh: { test: async () => ({ capabilities: { docker: true, dockerReady: false, compose: false, git: false, tar: true, checksum: false, baseWritable: false } }) },
gitea: { getBranch: async () => ({ commit: { sha } }) }, gitea: {
getBranch: async () => ({ commit: { sha } }),
repositoryFileExists: async ({ filePath, ref }) => ref === sha && filePath === "compose.yml",
},
sourcePath: process.cwd() sourcePath: process.cwd()
}); });
service.probeServerGitAccess = async () => ({ ready: false, error: "deploy key missing", remoteSha: null }); service.probeServerGitAccess = async () => ({ ready: false, error: "deploy key missing", remoteSha: null });
@@ -1310,6 +1447,8 @@ test("server-pull preflight resolves Gitea SHA and reports every degraded capabi
assert.equal(result.sha, sha); assert.equal(result.sha, sha);
assert.equal(byId("local-branch").status, "warning"); assert.equal(byId("local-branch").status, "warning");
assert.equal(byId("local-clean").status, "warning"); assert.equal(byId("local-clean").status, "warning");
assert.equal(byId("gitea-deployment-files").status, "fail");
assert.match(byId("gitea-deployment-files").detail, /compose\.prod\.yml/);
assert.equal(byId("docker-runtime").status, "fail"); assert.equal(byId("docker-runtime").status, "fail");
assert.match(byId("docker-runtime").detail, /cannot query/i); assert.match(byId("docker-runtime").detail, /cannot query/i);
assert.equal(byId("compose-command").status, "fail"); assert.equal(byId("compose-command").status, "fail");
+78 -2
View File
@@ -6,16 +6,27 @@ import path from "node:path";
import { createRequire } from "node:module"; import { createRequire } from "node:module";
import { EventEmitter } from "node:events"; import { EventEmitter } from "node:events";
import { createHash } from "node:crypto"; import { createHash } from "node:crypto";
import { execFile } from "node:child_process"; import { execFile, spawn } from "node:child_process";
import { promisify } from "node:util"; import { promisify } from "node:util";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import { setTimeout as delay } from "node:timers/promises";
const require = createRequire(import.meta.url); const require = createRequire(import.meta.url);
const execFileAsync = promisify(execFile); const execFileAsync = promisify(execFile);
const { const {
UpdateService, UpdateService,
waitForUpdaterStarted, waitForUpdaterStarted,
windowsUpdaterSpawnOptions,
} = require("../src/main/update-service.cjs"); } = require("../src/main/update-service.cjs");
test("Windows updater uses a hidden non-detached PowerShell child", () => {
assert.deepEqual(windowsUpdaterSpawnOptions("C:\\updates"), {
detached: false,
stdio: "ignore",
windowsHide: true,
cwd: "C:\\updates",
});
});
test("update check pins version to an exact branch commit", async () => { test("update check pins version to an exact branch commit", async () => {
const temp = await mkdtemp(path.join(os.tmpdir(), "forgeflow-update-test-")); const temp = await mkdtemp(path.join(os.tmpdir(), "forgeflow-update-test-"));
const saved = []; const saved = [];
@@ -358,6 +369,70 @@ test("binary helper confirms startup through real Windows PowerShell", { skip: p
assert.match(await readFile(logPath, "utf8"), /Handshake-only verification completed successfully/); assert.match(await readFile(logPath, "utf8"), /Handshake-only verification completed successfully/);
await rm(temp, { recursive: true, force: true }); await rm(temp, { recursive: true, force: true });
}); });
test("binary helper confirms startup through the production Node spawn options", { skip: process.platform !== "win32" }, async () => {
const temp = await mkdtemp(path.join(os.tmpdir(), "forgeflow-binary-node-spawn-"));
const statusPath = path.join(temp, "status.json");
const logPath = path.join(temp, "helper.log");
const powershell = path.join(process.env.SystemRoot || process.env.WINDIR, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
const scriptPath = fileURLToPath(new URL("../scripts/apply-binary-update.ps1", import.meta.url));
const updateId = "binary-node-spawn";
await writeFile(statusPath, JSON.stringify({ state: "launching", updateId }));
const child = spawn(powershell, [
"-NoLogo", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", scriptPath,
"-BinaryPath", path.join(temp, "unused.exe"), "-ExpectedSha256", "0".repeat(64),
"-ExpectedVersion", "9.9.9", "-CurrentExecutable", path.join(temp, "unused-current.exe"),
"-Portable", "False", "-ParentPid", String(process.pid), "-LogPath", logPath,
"-StatusPath", statusPath, "-UpdateId", updateId, "-HandshakeOnly",
], windowsUpdaterSpawnOptions(temp));
const childState = { exited: false, code: null, error: null };
child.once("error", (error) => { childState.error = error; });
child.once("exit", (code) => { childState.exited = true; childState.code = code; });
const status = await waitForUpdaterStarted(statusPath, {
timeoutMs: 5000,
pollMs: 25,
childState,
expectedUpdateId: updateId,
logPath,
});
assert.equal(status.state, "started");
let log = "";
for (let attempt = 0; attempt < 40 && !log.includes("Handshake-only verification completed successfully"); attempt += 1) {
await delay(25);
log = await readFile(logPath, "utf8").catch(() => "");
}
assert.match(log, /Handshake-only verification completed successfully/);
if (child.exitCode === null) {
await new Promise((resolve, reject) => {
child.once("exit", resolve);
child.once("error", reject);
});
}
await rm(temp, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
});
test("binary helper verifies SHA-256 without PowerShell module autoloading", { skip: process.platform !== "win32" }, async () => {
const temp = await mkdtemp(path.join(os.tmpdir(), "forgeflow-binary-dotnet-sha-"));
const binaryPath = path.join(temp, "update.exe");
const currentPath = path.join(temp, "current.exe");
const statusPath = path.join(temp, "status.json");
const logPath = path.join(temp, "helper.log");
const bytes = Buffer.from("verified update bytes");
await writeFile(binaryPath, bytes);
await writeFile(currentPath, "current");
const expectedSha256 = createHash("sha256").update(bytes).digest("hex");
const powershell = path.join(process.env.SystemRoot || process.env.WINDIR, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
const scriptPath = fileURLToPath(new URL("../scripts/apply-binary-update.ps1", import.meta.url));
const { stderr } = await execFileAsync(powershell, [
"-NoLogo", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", scriptPath,
"-BinaryPath", binaryPath, "-ExpectedSha256", expectedSha256, "-ExpectedVersion", "9.9.9",
"-CurrentExecutable", currentPath, "-Portable", "False", "-ParentPid", String(process.pid),
"-LogPath", logPath, "-StatusPath", statusPath, "-UpdateId", "dotnet-sha", "-VerifyOnly",
], { windowsHide: true, env: { ...process.env, PSModulePath: "" } });
assert.equal(stderr, "");
assert.match(await readFile(logPath, "utf8"), /Verification-only SHA-256 check completed successfully/);
await rm(temp, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
});
test("early helper exit reports the helper log instead of only an exit code", async () => { test("early helper exit reports the helper log instead of only an exit code", async () => {
const temp = await mkdtemp( const temp = await mkdtemp(
path.join(os.tmpdir(), "forgeflow-update-log-tail-"), path.join(os.tmpdir(), "forgeflow-update-log-tail-"),
@@ -574,7 +649,7 @@ test("binary update helper verifies, waits, applies and records restart state",
"utf8", "utf8",
); );
for (const marker of [ for (const marker of [
"Get-FileHash", "Security.Cryptography.SHA256",
"Wait-Process", "Wait-Process",
'Write-UpdateState -State "started"', 'Write-UpdateState -State "started"',
'Write-UpdateState -State "waiting-for-exit"', 'Write-UpdateState -State "waiting-for-exit"',
@@ -588,4 +663,5 @@ test("binary update helper verifies, waits, applies and records restart state",
`missing binary updater marker: ${marker}`, `missing binary updater marker: ${marker}`,
); );
} }
assert.doesNotMatch(helper, /Get-FileHash/);
}); });