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.
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.gitignore +2 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/AGENTS.md +43 -13
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/PKG-INFO +42 -7
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/README.md +40 -5
- src_auth_perms_sync-0.5.0/dev/PLAN.md +458 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/dev/TODO.md +22 -15
- src_auth_perms_sync-0.5.0/dev/engineering-requests.md +781 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/dev/hooks/pre-commit +1 -5
- src_auth_perms_sync-0.5.0/dev/memory-analysis/memory-efficiency.md +177 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/pyproject.toml +2 -2
- src_auth_perms_sync-0.5.0/src/src_auth_perms_sync/__init__.py +36 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/cli.py +305 -115
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/orgs/sync.py +39 -50
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/apply.py +18 -16
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/command.py +198 -170
- {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
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/queries.py +46 -5
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/restore.py +133 -171
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/snapshot.py +205 -35
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/sourcegraph.py +123 -4
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/workflow.py +51 -64
- src_auth_perms_sync-0.5.0/src/src_auth_perms_sync/shared/backups.py +159 -0
- {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
- src_auth_perms_sync-0.5.0/tests/README.md +161 -0
- src_auth_perms_sync-0.5.0/tests/__init__.py +12 -0
- src_auth_perms_sync-0.5.0/tests/e2e/__init__.py +11 -0
- src_auth_perms_sync-0.5.0/tests/e2e/case_runner.py +891 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/add-users-by-email-and-list/after.json +84 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/add-users-by-email-and-list/before.json +79 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/add-users-by-email-and-list/maps.yaml +11 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/add-users-preserves-existing/after.json +83 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/add-users-preserves-existing/before.json +81 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/add-users-preserves-existing/maps.yaml +10 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/and-filters-intersect/after.json +102 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/and-filters-intersect/before.json +100 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/and-filters-intersect/maps.yaml +11 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/empty-maps-noop/before.json +47 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/empty-maps-noop/maps.yaml +1 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-dry-run/before.json +89 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-dry-run/maps.yaml +16 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-preserves-pending/after.json +74 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-preserves-pending/before.json +74 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-preserves-pending/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-removes-stale-grant/after.json +74 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-removes-stale-grant/before.json +74 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-removes-stale-grant/maps.yaml +9 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-unions/after.json +96 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-unions/before.json +95 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-unions/maps.yaml +16 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-with-backup/after.json +77 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-with-backup/before.json +77 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/full-overwrite-with-backup/maps.yaml +9 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/get-full-snapshot/before.json +47 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/get-repos-without-explicit-perms/before.json +53 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/get-user-grants/before.json +47 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-bad-regex/before.json +47 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-bad-regex/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-missing-repos-section/before.json +47 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-missing-repos-section/maps.yaml +5 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-restore-wrong-schema-version/before.json +47 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-restore-wrong-schema-version/snapshot.json +21 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-created-after-date/before.json +45 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-created-after-date/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-repos-created-after-date/before.json +45 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-repos-created-after-date/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-unknown-repo/before.json +45 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-unknown-repo/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-unknown-user/before.json +45 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-set-unknown-user/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-unknown-selector-field/before.json +47 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/invalid-unknown-selector-field/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/match-provider-and-host-fields/after.json +141 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/match-provider-and-host-fields/before.json +135 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/match-provider-and-host-fields/maps.yaml +13 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/no-match-noop/before.json +47 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/no-match-noop/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/regex-filters-scope/after.json +96 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/regex-filters-scope/before.json +90 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/regex-filters-scope/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-applies-snapshot/after.json +69 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-applies-snapshot/before.json +69 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-applies-snapshot/snapshot.json +30 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-dry-run-noop/before.json +69 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-dry-run-noop/snapshot.json +30 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-missing-file/before.json +48 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-restores-pending/after.json +57 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-restores-pending/before.json +57 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/restore-restores-pending/snapshot.json +30 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/saml-group-filter/after.json +139 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/saml-group-filter/before.json +135 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/saml-group-filter/maps.yaml +9 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/saml-group-live/after.json +180 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/saml-group-live/before.json +174 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/saml-group-live/maps.yaml +10 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-created-after-sync-saml-orgs-dry-run/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-created-after-temp-user/after.json +41 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-created-after-temp-user/before.json +39 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-created-after-temp-user/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-full-sync-saml-orgs-dry-run/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-created-after/after.json +69 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-created-after/before.json +66 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-created-after/maps.yaml +10 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-created-after-noop/before.json +48 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-created-after-noop/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-created-after-sync-saml-orgs-dry-run/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-filter/after.json +71 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-filter/before.json +70 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-filter/maps.yaml +10 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-sync-saml-orgs-dry-run/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-without-explicit-perms/after.json +71 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-without-explicit-perms/before.json +68 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-without-explicit-perms/maps.yaml +10 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-repos-without-perms-sync-saml-orgs-dry-run/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-created-after/after.json +84 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-created-after/before.json +79 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-created-after/maps.yaml +9 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-created-after-noop/before.json +48 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-created-after-noop/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-sync-saml-orgs-dry-run/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-explicit-perms/after.json +97 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-explicit-perms/before.json +94 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-explicit-perms/maps.yaml +10 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-explicit-perms-default-batch/after.json +98 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-explicit-perms-default-batch/before.json +95 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-explicit-perms-default-batch/maps.yaml +10 -0
- src_auth_perms_sync-0.5.0/tests/e2e/fixtures/set-users-without-perms-sync-saml-orgs-dry-run/maps.yaml +8 -0
- src_auth_perms_sync-0.5.0/tests/e2e/test_local_cases.py +135 -0
- src_auth_perms_sync-0.5.0/tests/integration/__init__.py +11 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/integration/test_cli_entrypoint.py +25 -1
- src_auth_perms_sync-0.5.0/tests/run.py +3854 -0
- src_auth_perms_sync-0.5.0/tests/setup.py +471 -0
- src_auth_perms_sync-0.5.0/tests/setup.yaml +56 -0
- src_auth_perms_sync-0.5.0/tests/tests.yaml +1074 -0
- src_auth_perms_sync-0.5.0/tests/unit/__init__.py +11 -0
- src_auth_perms_sync-0.5.0/tests/unit/test_backups.py +297 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_cli_config.py +230 -61
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_command_additive.py +46 -32
- src_auth_perms_sync-0.5.0/tests/unit/test_command_files.py +241 -0
- src_auth_perms_sync-0.5.0/tests/unit/test_module_api.py +119 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_permissions_sourcegraph.py +97 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_restore.py +76 -1
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_snapshot.py +217 -14
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/uv.lock +24 -24
- src_auth_perms_sync-0.3.1/dev/memory-efficiency.md +0 -380
- src_auth_perms_sync-0.3.1/dev/test-end-to-end.py +0 -3047
- src_auth_perms_sync-0.3.1/src/src_auth_perms_sync/__init__.py +0 -11
- src_auth_perms_sync-0.3.1/src/src_auth_perms_sync/shared/backups.py +0 -112
- src_auth_perms_sync-0.3.1/tests/__init__.py +0 -1
- src_auth_perms_sync-0.3.1/tests/integration/__init__.py +0 -1
- src_auth_perms_sync-0.3.1/tests/unit/__init__.py +0 -1
- src_auth_perms_sync-0.3.1/tests/unit/test_backups.py +0 -83
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.env.example +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.github/CODEOWNERS +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.github/workflows/ci.yml +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.github/workflows/release.yml +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.github/workflows/validate.yml +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.markdownlint-cli2.yaml +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/.python-version +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/LICENSE +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/SECURITY.md +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/dev/audit-dead-code.md +0 -0
- {src_auth_perms_sync-0.3.1/dev → src_auth_perms_sync-0.5.0/dev/memory-analysis}/mapping-efficiency.md +0 -0
- {src_auth_perms_sync-0.3.1/dev → src_auth_perms_sync-0.5.0/dev/memory-analysis}/memory-efficiency-analyze.py +0 -0
- {src_auth_perms_sync-0.3.1/dev → src_auth_perms_sync-0.5.0/dev/memory-analysis}/memory-efficiency-generate.py +0 -0
- {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
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/dev/update-python-versions.md +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/maps-example.yaml +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/renovate.json +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/__main__.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/orgs/__init__.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/orgs/command.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/orgs/queries.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/orgs/types.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/__init__.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/mapping.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/maps.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/permissions/types.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/shared/__init__.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/shared/queries.py +0 -0
- {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
- {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
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/shared/sourcegraph.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/src/src_auth_perms_sync/shared/types.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_apply.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_maps.py +0 -0
- {src_auth_perms_sync-0.3.1 → src_auth_perms_sync-0.5.0}/tests/unit/test_saml_groups.py +0 -0
|
@@ -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
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
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
|
+
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.
|
|
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
|
-
|
|
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
|
-
#
|
|
167
|
-
#
|
|
168
|
-
|
|
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
|
-
|
|
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
|
-
#
|
|
144
|
-
#
|
|
145
|
-
|
|
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
|