src-auth-perms-sync 0.3.1__tar.gz → 0.5.0__tar.gz

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 (186) hide show
  1. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.gitignore +2 -0
  2. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/AGENTS.md +43 -13
  3. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/PKG-INFO +42 -7
  4. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/README.md +40 -5
  5. src_auth_perms_sync-0.5.0/dev/PLAN.md +458 -0
  6. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/dev/TODO.md +22 -15
  7. src_auth_perms_sync-0.5.0/dev/engineering-requests.md +781 -0
  8. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/dev/hooks/pre-commit +1 -5
  9. src_auth_perms_sync-0.5.0/dev/memory-analysis/memory-efficiency.md +177 -0
  10. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/pyproject.toml +2 -2
  11. src_auth_perms_sync-0.5.0/src/src_auth_perms_sync/__init__.py +36 -0
  12. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/cli.py +305 -115
  13. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/orgs/sync.py +39 -50
  14. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/apply.py +18 -16
  15. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/command.py +198 -170
  16. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/full_set.py +157 -177
  17. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/queries.py +46 -5
  18. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/restore.py +133 -171
  19. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/snapshot.py +205 -35
  20. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/sourcegraph.py +123 -4
  21. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/workflow.py +51 -64
  22. src_auth_perms_sync-0.5.0/src/src_auth_perms_sync/shared/backups.py +159 -0
  23. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/shared/run_context.py +10 -2
  24. src_auth_perms_sync-0.5.0/tests/README.md +161 -0
  25. src_auth_perms_sync-0.5.0/tests/__init__.py +12 -0
  26. src_auth_perms_sync-0.5.0/tests/e2e/__init__.py +11 -0
  27. src_auth_perms_sync-0.5.0/tests/e2e/case_runner.py +891 -0
  28. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/add-users-by-email-and-list/after.json +84 -0
  29. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/add-users-by-email-and-list/before.json +79 -0
  30. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/add-users-by-email-and-list/maps.yaml +11 -0
  31. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/add-users-preserves-existing/after.json +83 -0
  32. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/add-users-preserves-existing/before.json +81 -0
  33. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/add-users-preserves-existing/maps.yaml +10 -0
  34. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/and-filters-intersect/after.json +102 -0
  35. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/and-filters-intersect/before.json +100 -0
  36. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/and-filters-intersect/maps.yaml +11 -0
  37. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/empty-maps-noop/before.json +47 -0
  38. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/empty-maps-noop/maps.yaml +1 -0
  39. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-dry-run/before.json +89 -0
  40. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-dry-run/maps.yaml +16 -0
  41. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-preserves-pending/after.json +74 -0
  42. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-preserves-pending/before.json +74 -0
  43. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-preserves-pending/maps.yaml +8 -0
  44. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-removes-stale-grant/after.json +74 -0
  45. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-removes-stale-grant/before.json +74 -0
  46. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-removes-stale-grant/maps.yaml +9 -0
  47. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-unions/after.json +96 -0
  48. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-unions/before.json +95 -0
  49. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-unions/maps.yaml +16 -0
  50. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-with-backup/after.json +77 -0
  51. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-with-backup/before.json +77 -0
  52. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-with-backup/maps.yaml +9 -0
  53. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/get-full-snapshot/before.json +47 -0
  54. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/get-repos-without-explicit-perms/before.json +53 -0
  55. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/get-user-grants/before.json +47 -0
  56. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-bad-regex/before.json +47 -0
  57. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-bad-regex/maps.yaml +8 -0
  58. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-missing-repos-section/before.json +47 -0
  59. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-missing-repos-section/maps.yaml +5 -0
  60. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-restore-wrong-schema-version/before.json +47 -0
  61. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-restore-wrong-schema-version/snapshot.json +21 -0
  62. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-created-after-date/before.json +45 -0
  63. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-created-after-date/maps.yaml +8 -0
  64. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-repos-created-after-date/before.json +45 -0
  65. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-repos-created-after-date/maps.yaml +8 -0
  66. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-unknown-repo/before.json +45 -0
  67. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-unknown-repo/maps.yaml +8 -0
  68. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-unknown-user/before.json +45 -0
  69. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-unknown-user/maps.yaml +8 -0
  70. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-unknown-selector-field/before.json +47 -0
  71. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-unknown-selector-field/maps.yaml +8 -0
  72. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/match-provider-and-host-fields/after.json +141 -0
  73. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/match-provider-and-host-fields/before.json +135 -0
  74. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/match-provider-and-host-fields/maps.yaml +13 -0
  75. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/no-match-noop/before.json +47 -0
  76. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/no-match-noop/maps.yaml +8 -0
  77. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/regex-filters-scope/after.json +96 -0
  78. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/regex-filters-scope/before.json +90 -0
  79. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/regex-filters-scope/maps.yaml +8 -0
  80. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-applies-snapshot/after.json +69 -0
  81. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-applies-snapshot/before.json +69 -0
  82. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-applies-snapshot/snapshot.json +30 -0
  83. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-dry-run-noop/before.json +69 -0
  84. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-dry-run-noop/snapshot.json +30 -0
  85. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-missing-file/before.json +48 -0
  86. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-restores-pending/after.json +57 -0
  87. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-restores-pending/before.json +57 -0
  88. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-restores-pending/snapshot.json +30 -0
  89. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/saml-group-filter/after.json +139 -0
  90. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/saml-group-filter/before.json +135 -0
  91. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/saml-group-filter/maps.yaml +9 -0
  92. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/saml-group-live/after.json +180 -0
  93. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/saml-group-live/before.json +174 -0
  94. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/saml-group-live/maps.yaml +10 -0
  95. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-created-after-sync-saml-orgs-dry-run/maps.yaml +8 -0
  96. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-created-after-temp-user/after.json +41 -0
  97. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-created-after-temp-user/before.json +39 -0
  98. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-created-after-temp-user/maps.yaml +8 -0
  99. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-full-sync-saml-orgs-dry-run/maps.yaml +8 -0
  100. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-created-after/after.json +69 -0
  101. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-created-after/before.json +66 -0
  102. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-created-after/maps.yaml +10 -0
  103. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-created-after-noop/before.json +48 -0
  104. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-created-after-noop/maps.yaml +8 -0
  105. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-created-after-sync-saml-orgs-dry-run/maps.yaml +8 -0
  106. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-filter/after.json +71 -0
  107. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-filter/before.json +70 -0
  108. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-filter/maps.yaml +10 -0
  109. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-sync-saml-orgs-dry-run/maps.yaml +8 -0
  110. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-without-explicit-perms/after.json +71 -0
  111. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-without-explicit-perms/before.json +68 -0
  112. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-without-explicit-perms/maps.yaml +10 -0
  113. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-without-perms-sync-saml-orgs-dry-run/maps.yaml +8 -0
  114. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-created-after/after.json +84 -0
  115. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-created-after/before.json +79 -0
  116. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-created-after/maps.yaml +9 -0
  117. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-created-after-noop/before.json +48 -0
  118. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-created-after-noop/maps.yaml +8 -0
  119. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-sync-saml-orgs-dry-run/maps.yaml +8 -0
  120. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-explicit-perms/after.json +97 -0
  121. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-explicit-perms/before.json +94 -0
  122. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-explicit-perms/maps.yaml +10 -0
  123. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-explicit-perms-default-batch/after.json +98 -0
  124. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-explicit-perms-default-batch/before.json +95 -0
  125. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-explicit-perms-default-batch/maps.yaml +10 -0
  126. src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-perms-sync-saml-orgs-dry-run/maps.yaml +8 -0
  127. src_auth_perms_sync-0.5.0/tests/e2e/test_local_cases.py +135 -0
  128. src_auth_perms_sync-0.5.0/tests/integration/__init__.py +11 -0
  129. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/integration/test_cli_entrypoint.py +25 -1
  130. src_auth_perms_sync-0.5.0/tests/run.py +3854 -0
  131. src_auth_perms_sync-0.5.0/tests/setup.py +471 -0
  132. src_auth_perms_sync-0.5.0/tests/setup.yaml +56 -0
  133. src_auth_perms_sync-0.5.0/tests/tests.yaml +1074 -0
  134. src_auth_perms_sync-0.5.0/tests/unit/__init__.py +11 -0
  135. src_auth_perms_sync-0.5.0/tests/unit/test_backups.py +297 -0
  136. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_cli_config.py +230 -61
  137. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_command_additive.py +46 -32
  138. src_auth_perms_sync-0.5.0/tests/unit/test_command_files.py +241 -0
  139. src_auth_perms_sync-0.5.0/tests/unit/test_module_api.py +119 -0
  140. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_permissions_sourcegraph.py +97 -0
  141. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_restore.py +76 -1
  142. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_snapshot.py +217 -14
  143. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/uv.lock +24 -24
  144. src_auth_perms_sync-0.3.1/dev/memory-efficiency.md +0 -380
  145. src_auth_perms_sync-0.3.1/dev/test-end-to-end.py +0 -3047
  146. src_auth_perms_sync-0.3.1/src/src_auth_perms_sync/__init__.py +0 -11
  147. src_auth_perms_sync-0.3.1/src/src_auth_perms_sync/shared/backups.py +0 -112
  148. src_auth_perms_sync-0.3.1/tests/__init__.py +0 -1
  149. src_auth_perms_sync-0.3.1/tests/integration/__init__.py +0 -1
  150. src_auth_perms_sync-0.3.1/tests/unit/__init__.py +0 -1
  151. src_auth_perms_sync-0.3.1/tests/unit/test_backups.py +0 -83
  152. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.env.example +0 -0
  153. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.github/CODEOWNERS +0 -0
  154. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.github/workflows/ci.yml +0 -0
  155. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.github/workflows/release.yml +0 -0
  156. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.github/workflows/validate.yml +0 -0
  157. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.markdownlint-cli2.yaml +0 -0
  158. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.python-version +0 -0
  159. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/LICENSE +0 -0
  160. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/SECURITY.md +0 -0
  161. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/dev/audit-dead-code.md +0 -0
  162. {src_auth_perms_sync-0.3.1/dev → src_auth_perms_sync-0.5.0/dev/memory-analysis}/mapping-efficiency.md +0 -0
  163. {src_auth_perms_sync-0.3.1/dev → src_auth_perms_sync-0.5.0/dev/memory-analysis}/memory-efficiency-analyze.py +0 -0
  164. {src_auth_perms_sync-0.3.1/dev → src_auth_perms_sync-0.5.0/dev/memory-analysis}/memory-efficiency-generate.py +0 -0
  165. {src_auth_perms_sync-0.3.1/dev → src_auth_perms_sync-0.5.0/dev/memory-analysis}/memory-efficiency-monitor-sourcegraph.sh +0 -0
  166. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/dev/update-python-versions.md +0 -0
  167. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/maps-example.yaml +0 -0
  168. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/renovate.json +0 -0
  169. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/__main__.py +0 -0
  170. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/orgs/__init__.py +0 -0
  171. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/orgs/command.py +0 -0
  172. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/orgs/queries.py +0 -0
  173. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/orgs/types.py +0 -0
  174. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/__init__.py +0 -0
  175. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/mapping.py +0 -0
  176. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/maps.py +0 -0
  177. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/types.py +0 -0
  178. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/shared/__init__.py +0 -0
  179. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/shared/queries.py +0 -0
  180. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/shared/saml_groups.py +0 -0
  181. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/shared/site_config.py +0 -0
  182. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/shared/sourcegraph.py +0 -0
  183. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/shared/types.py +0 -0
  184. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_apply.py +0 -0
  185. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_maps.py +0 -0
  186. {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_saml_groups.py +0 -0
@@ -12,6 +12,7 @@ __pycache__
12
12
  *.py[cod]
13
13
  *.py[oc]
14
14
  *.swp
15
+ *.tsv
15
16
  *.yaml
16
17
  build/
17
18
  dist/
@@ -24,3 +25,4 @@ wheels/
24
25
  !.env.example
25
26
  !.markdownlint-cli2.yaml
26
27
  !maps-example.yaml
28
+ !tests/**/*.yaml
@@ -1,5 +1,10 @@
1
1
  # AGENTS.md
2
2
 
3
+ ## Reference materials
4
+
5
+ - GraphQL schema and database migrations (changes to SQL schema) are available in
6
+ <https://github.com/sourcegraph/artifacts>
7
+
3
8
  ## Linting
4
9
 
5
10
  ```bash
@@ -26,21 +31,40 @@ uv run src-auth-perms-sync --help
26
31
 
27
32
  ## Testing
28
33
 
29
- - First run a dry-run (default behaviour, without `--apply` flag) against a Sourcegraph instance
34
+ All testing runs through one entrypoint: `tests/run.py`. Output goes to the
35
+ console and to a per-run log file under `logs/`. Each level runs only its
36
+ own checks.
30
37
 
31
38
  ```bash
32
- uv run src-auth-perms-sync [--get]
33
- uv run src-auth-perms-sync --set maps.yaml --full
34
- uv run src-auth-perms-sync --restore backups/<source>/<run>/before.json
39
+ # Fast, no network (also what the pre-commit hook runs):
40
+ # lint, format, pyright, unit + fixture tests, CLI rejection matrix,
41
+ # randomized permission invariants
42
+ uv run tests/run.py
43
+
44
+ # End-to-end runs against the .env test instance with independent GraphQL
45
+ # read-back verification, and a wheel install smoke test
46
+ uv run tests/run.py --live
47
+
48
+ # Run a subset: comma-delimited test names, substring match
49
+ uv run tests/run.py --live full-overwrite-unions
50
+ uv run tests/run.py --live wheel,baseline
51
+
52
+ # Repeated timed runs with Jaeger trace retention, RSS sampling,
53
+ # optional kubectl load monitoring, and baseline comparison
54
+ uv run tests/run.py --performance --repeat 3
55
+ uv run tests/run.py --performance --baseline-command "uvx src-auth-perms-sync@latest" \
56
+ --fail-on-memory-regression-percent 10
57
+
58
+ # Regenerate fixture goldens after editing tests/e2e/fixtures/ cases
59
+ uv run tests/run.py --update-golden
35
60
  ```
36
61
 
37
- - Read the output, and evaluate the expected changes
38
- - If the expected changes look correct
39
- - Run with the `--apply` flag against the test instance
40
- - Read and evaluate the output for expected changes
41
- - Run with the `--restore` flag against the test instance
42
- - Always inspect the before / after snapshots in
43
- `src-auth-perms-sync-runs/<endpoint>/backups/` afterward to confirm the diff matches what you expected
62
+ - Fixture cases live in `tests/e2e/fixtures/<case>/` — see the README there
63
+ for the format. Add cases there to cover new mapping behaviors.
64
+ - For manual verification against a real instance, dry-run first (no
65
+ `--apply`), read the planned changes, then `--apply` on a scratch instance
66
+ and inspect the before/after snapshots under
67
+ `src-auth-perms-sync-runs/<endpoint>/runs/`.
44
68
 
45
69
  ## Release process
46
70
 
@@ -177,10 +201,16 @@ organization sync maps SAML groups to Sourcegraph org membership. Read
177
201
  CLI lives in `src/src_auth_perms_sync/`; invoke with `uv run src-auth-perms-sync`.
178
202
  Strict pyright covers the package. Root modules are entrypoints only:
179
203
 
180
- - `cli.py` — `main()`, arg parsing, owns the CLI description.
204
+ - `cli.py` — `main()`, arg parsing, owns the CLI description. Module
205
+ wrappers (`Get`/`Set`/`Restore`/`SyncSamlOrgs`) return result dataclasses
206
+ and never install logging handlers; only `main()` runs CLI-mode logging.
181
207
  - `shared/` — cross-workflow helpers: Sourcegraph auth-provider/user list
182
208
  helpers, shared GraphQL operations and TypedDicts, site-config validation,
183
- and SAML group parsing.
209
+ and SAML group parsing. `shared/backups.py` defines `RunPaths`: every
210
+ filesystem path for one run, resolved once at the edge
211
+ (`resolve_run_paths`) and threaded explicitly — never recompute paths
212
+ from cwd or globals below the edge, and honor `run_paths.write_files`
213
+ (False under `--no-files`) before any disk write.
184
214
 
185
215
  Business workflows live in packages:
186
216
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: src-auth-perms-sync
3
- Version: 0.3.1
3
+ Version: 0.5.0
4
4
  Summary: Set Sourcegraph permissions from authentication provider data
5
5
  Project-URL: Homepage, https://github.com/sourcegraph/src-auth-perms-sync
6
6
  Project-URL: Issues, https://github.com/sourcegraph/src-auth-perms-sync/issues
@@ -18,7 +18,7 @@ Classifier: Typing :: Typed
18
18
  Requires-Python: >=3.11
19
19
  Requires-Dist: json5>=0.14.0
20
20
  Requires-Dist: pyyaml>=6.0.3
21
- Requires-Dist: src-py-lib[otel]==0.2.1
21
+ Requires-Dist: src-py-lib[otel]==0.3.0
22
22
  Description-Content-Type: text/markdown
23
23
 
24
24
  # src-auth-perms-sync
@@ -160,14 +160,44 @@ config = src.Config(
160
160
  apply=False, # Dry run (default), set to True to make changes
161
161
  )
162
162
 
163
- succeeded = src.Set(config)
163
+ result = src.Set(config) # truthy on success; result.paths has run artifacts
164
+
165
+ # Discovery returns the auth provider and code host data in memory, so you
166
+ # can assemble mapping rules without re-parsing the generated YAML files:
167
+ get_result = src.Get(config)
168
+ for provider in get_result.auth_providers:
169
+ ...
170
+ for code_host in get_result.code_hosts:
171
+ ...
164
172
 
165
173
  # Other command wrappers:
166
- # succeeded = src.Get(config)
167
- # succeeded = src.Restore(config)
168
- # succeeded = src.SyncSamlOrgs(config)
174
+ # result = src.Restore(config)
175
+ # result = src.SyncSamlOrgs(config)
176
+ ```
177
+
178
+ Module mode never touches your `logging` handlers or the root logger — your
179
+ application's logging config stays in charge. To see progress messages:
180
+
181
+ ```python
182
+ import logging
183
+
184
+ logging.basicConfig(level=logging.INFO) # or your own handlers
185
+ logging.getLogger("src_auth_perms_sync").setLevel(logging.INFO)
186
+ logging.getLogger("src_py_lib").setLevel(logging.INFO)
169
187
  ```
170
188
 
189
+ To receive structured wide events programmatically, pass an event sink:
190
+
191
+ ```python
192
+ events = src.InMemoryEventSink()
193
+ src.Get(config, event_sink=events) # or src.CallbackEventSink(my_function)
194
+ ```
195
+
196
+ To run fully disk-free (no generated YAML, snapshots, or log file), set
197
+ `no_files=True`. Combined with `apply=True` this also requires
198
+ `no_backup=True`, because skipping files gives up the before/after
199
+ snapshots that make `--apply` reversible.
200
+
171
201
  ## Inputs
172
202
 
173
203
  - Environment variables (CLI), or src.Config args (Python import)
@@ -177,7 +207,12 @@ succeeded = src.Set(config)
177
207
 
178
208
  - YAML maps file
179
209
  - By default: `src-auth-perms-sync-runs/<src_endpoint>/maps.yaml`
180
- - Or pass `--maps-path ./path/to/maps.yaml`
210
+ - Or pass `--maps-path ./path/to/maps.yaml` (works for both `get` and `set`,
211
+ so the maps file can live outside the generated artifacts tree)
212
+ - `--artifacts-dir DIR` moves the whole artifacts tree (generated YAML,
213
+ snapshots, logs); the default is `./src-auth-perms-sync-runs`
214
+ - `--no-files` writes nothing to disk; with `--apply` it also requires
215
+ `--no-backup`
181
216
  - A list of mapping rules
182
217
  - Each mapping rule takes
183
218
  - A map of filters for users
@@ -137,14 +137,44 @@ config = src.Config(
137
137
  apply=False, # Dry run (default), set to True to make changes
138
138
  )
139
139
 
140
- succeeded = src.Set(config)
140
+ result = src.Set(config) # truthy on success; result.paths has run artifacts
141
+
142
+ # Discovery returns the auth provider and code host data in memory, so you
143
+ # can assemble mapping rules without re-parsing the generated YAML files:
144
+ get_result = src.Get(config)
145
+ for provider in get_result.auth_providers:
146
+ ...
147
+ for code_host in get_result.code_hosts:
148
+ ...
141
149
 
142
150
  # Other command wrappers:
143
- # succeeded = src.Get(config)
144
- # succeeded = src.Restore(config)
145
- # succeeded = src.SyncSamlOrgs(config)
151
+ # result = src.Restore(config)
152
+ # result = src.SyncSamlOrgs(config)
153
+ ```
154
+
155
+ Module mode never touches your `logging` handlers or the root logger — your
156
+ application's logging config stays in charge. To see progress messages:
157
+
158
+ ```python
159
+ import logging
160
+
161
+ logging.basicConfig(level=logging.INFO) # or your own handlers
162
+ logging.getLogger("src_auth_perms_sync").setLevel(logging.INFO)
163
+ logging.getLogger("src_py_lib").setLevel(logging.INFO)
146
164
  ```
147
165
 
166
+ To receive structured wide events programmatically, pass an event sink:
167
+
168
+ ```python
169
+ events = src.InMemoryEventSink()
170
+ src.Get(config, event_sink=events) # or src.CallbackEventSink(my_function)
171
+ ```
172
+
173
+ To run fully disk-free (no generated YAML, snapshots, or log file), set
174
+ `no_files=True`. Combined with `apply=True` this also requires
175
+ `no_backup=True`, because skipping files gives up the before/after
176
+ snapshots that make `--apply` reversible.
177
+
148
178
  ## Inputs
149
179
 
150
180
  - Environment variables (CLI), or src.Config args (Python import)
@@ -154,7 +184,12 @@ succeeded = src.Set(config)
154
184
 
155
185
  - YAML maps file
156
186
  - By default: `src-auth-perms-sync-runs/<src_endpoint>/maps.yaml`
157
- - Or pass `--maps-path ./path/to/maps.yaml`
187
+ - Or pass `--maps-path ./path/to/maps.yaml` (works for both `get` and `set`,
188
+ so the maps file can live outside the generated artifacts tree)
189
+ - `--artifacts-dir DIR` moves the whole artifacts tree (generated YAML,
190
+ snapshots, logs); the default is `./src-auth-perms-sync-runs`
191
+ - `--no-files` writes nothing to disk; with `--apply` it also requires
192
+ `--no-backup`
158
193
  - A list of mapping rules
159
194
  - Each mapping rule takes
160
195
  - A map of filters for users