dsh-ris-ide 1.7.3 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +19 -7
  2. package/bin/proxy-janitor.mjs +106 -11
  3. package/bin/risd.mjs +287 -0
  4. package/bin/run-with-log.ps1 +43 -5
  5. package/lib/client.js +515 -1152
  6. package/lib/index.js +1124 -55
  7. package/lib/janitor.js +106 -15
  8. package/lib/proxy.js +86 -7
  9. package/lib/proxybridge-bundle.js +798 -0
  10. package/lib/redirector.js +484 -35
  11. package/lib/risd/build.js +91 -0
  12. package/lib/risd/debug.js +374 -0
  13. package/lib/risd/git.js +207 -0
  14. package/lib/risd/leases.js +124 -0
  15. package/lib/risd/lifecycle.js +148 -0
  16. package/lib/risd/log.js +59 -0
  17. package/lib/risd/ping.js +94 -0
  18. package/lib/risd/programs.js +348 -0
  19. package/lib/risd/server.js +1478 -0
  20. package/lib/risd/state.js +137 -0
  21. package/lib/risd/ui.js +1705 -0
  22. package/lib/risd/view.js +79 -0
  23. package/lib/risd-client.js +282 -0
  24. package/lib/standalone/window.html +14 -16
  25. package/lib/startup.js +114 -0
  26. package/package.json +4 -1
  27. package/test/client-build.test.mjs +113 -0
  28. package/test/client-viewer.test.mjs +166 -200
  29. package/test/dsh-origin.test.mjs +140 -0
  30. package/test/dsh-window-refresh.test.mjs +100 -0
  31. package/test/harness.test.mjs +9 -0
  32. package/test/host-noloop.test.mjs +74 -0
  33. package/test/host-tail.test.mjs +21 -4
  34. package/test/host-window.test.mjs +4 -4
  35. package/test/janitor.test.mjs +29 -1
  36. package/test/lifecycle.test.mjs +26 -5
  37. package/test/merge-owners.test.mjs +155 -0
  38. package/test/proxy-restart.test.mjs +37 -0
  39. package/test/proxy-window.test.mjs +45 -0
  40. package/test/proxy.test.mjs +41 -0
  41. package/test/proxybridge-bundle.test.mjs +687 -0
  42. package/test/redirector-bundle.test.mjs +391 -0
  43. package/test/redirector.test.mjs +59 -9
  44. package/test/risd-api.test.mjs +470 -0
  45. package/test/risd-bridge-degrade.test.mjs +101 -0
  46. package/test/risd-build.test.mjs +20 -0
  47. package/test/risd-cli-home.test.mjs +50 -0
  48. package/test/risd-client.test.mjs +130 -0
  49. package/test/risd-debug.test.mjs +261 -0
  50. package/test/risd-election.test.mjs +104 -0
  51. package/test/risd-engine.test.mjs +132 -0
  52. package/test/risd-entry.test.mjs +118 -0
  53. package/test/risd-git.test.mjs +109 -0
  54. package/test/risd-handoff.test.mjs +116 -0
  55. package/test/risd-heal.test.mjs +50 -0
  56. package/test/risd-helpers.mjs +108 -0
  57. package/test/risd-host-p2.test.mjs +147 -0
  58. package/test/risd-janitor-guard.test.mjs +46 -0
  59. package/test/risd-lease.test.mjs +83 -0
  60. package/test/risd-lifecycle.test.mjs +210 -0
  61. package/test/risd-log-follow.test.mjs +227 -0
  62. package/test/risd-mode.test.mjs +161 -0
  63. package/test/risd-ping.test.mjs +99 -0
  64. package/test/risd-programs.test.mjs +169 -0
  65. package/test/risd-review-p2.test.mjs +217 -0
  66. package/test/risd-shutdown.test.mjs +97 -0
  67. package/test/risd-teardown.test.mjs +87 -0
  68. package/test/risd-tools.test.mjs +211 -0
  69. package/test/risd-ui.test.mjs +445 -0
  70. package/test/risd-write.test.mjs +170 -0
  71. package/test/startup-reconcile.test.mjs +100 -0
  72. package/test/windows.test.mjs +37 -2
@@ -342,6 +342,21 @@ test('JSONC config files round-trip through the ONE shared file', () => {
342
342
  }
343
343
  })
344
344
 
345
+ test('merge: replaceAllRules makes the payload the whole table (m10585)', () => {
346
+ const stored = normalizeConfig({
347
+ socks: { host: 'h', port: 1080 },
348
+ rules: [
349
+ { id: 'user-1', program: 'java', hosts: '1.1.1.*', ports: '443', enabled: true },
350
+ { id: 'yds-old', program: 'git', hosts: '1.1.1.1', ports: '1521', enabled: true, source: 'yds' },
351
+ ],
352
+ })
353
+ const merged = mergeConfigs(stored, {
354
+ replaceAllRules: true,
355
+ rules: [{ id: 'yds-new', program: 'java', hosts: '2.2.2.*', ports: '*', enabled: true, source: 'yds' }],
356
+ })
357
+ assert.deepEqual(merged.rules.map((rule) => rule.id), ['yds-new'])
358
+ })
359
+
345
360
  test('merge: yds-owned rows are replaced wholesale, user rows survive', () => {
346
361
  const stored = normalizeConfig({
347
362
  socks: { host: 'h', port: 1080 },
@@ -871,3 +886,29 @@ test('a rule keeps its provider label for the dialog and the profile', () => {
871
886
  assert.equal(config.rules[0].label, 'YonCode java')
872
887
  assert.equal(config.rules[1].label, '', 'an unlabelled row stays empty, not undefined')
873
888
  })
889
+
890
+
891
+ test('a driven rule keeps its per-workspace owners across a config round trip', () => {
892
+ // yds writes one merged row per program with an `owners` map. Rebuilding rules
893
+ // from a fixed field list dropped it, after which `yds stop` could no longer
894
+ // withdraw only its own endpoints (review D-P0-1).
895
+ const owners = {
896
+ '/ws/a': { program: 'java', hosts: '10.0.0.1', ports: '*', enabled: true, shadow: false, direct: false },
897
+ '/ws/b': { program: 'java.exe', hosts: '10.0.0.2,10.0.0.3', ports: '*', enabled: true, shadow: true, direct: false },
898
+ }
899
+ const config = normalizeConfig({
900
+ socks: { host: '127.0.0.1', port: 1080 },
901
+ rules: [{
902
+ id: 'yds-java', label: 'yds java', program: 'java', hosts: '10.0.0.1,10.0.0.2,10.0.0.3', ports: '*',
903
+ enabled: true, shadow: false, direct: false, source: 'yds', workspace: '/ws/b', owners,
904
+ }],
905
+ })
906
+ const rule = config.rules.find((row) => row.id === 'yds-java')
907
+ assert.ok(rule, 'the driven row survives')
908
+ assert.deepEqual(Object.keys(rule.owners), ['/ws/a', '/ws/b'])
909
+ assert.equal(rule.owners['/ws/b'].hosts, '10.0.0.2,10.0.0.3')
910
+ assert.equal(rule.owners['/ws/b'].shadow, true)
911
+ // A row without owners must not gain an empty one.
912
+ const plain = normalizeConfig({ rules: [{ id: 'p', program: 'git', hosts: '*', ports: '*' }] })
913
+ assert.equal(plain.rules[0].owners, undefined)
914
+ })