fix(scope): default DAG visibility to the project's visibility for project scopes - #240
Merged
Merged
Conversation
…oject scopes When a repo is scoped to an org project (`roar scope use <org>/<project>`), roar always defaulted the registered DAG's visibility to private, even when the project itself is public. Users had to pass `--public` to get a public DAG, but `--public` bypasses the project scope and drops org attribution. Fix (narrow, backward-compatible): capture the project's visibility from the GLaaS access-context when `roar scope use` resolves a project, persist it in the `[treqs]` binding, expose it via `RepoScope.visibility`, and default a project-scoped DAG to the project's own visibility. - scope_config: add optional `RepoScope.visibility`; read it from `[treqs]`. - scope use: resolve+persist the project's `visibility` in the binding. - publish_auth `_scope_visibility`: project scope -> "public" only when the bound project is public; otherwise still "private". - publish_intent `resolve_publish_intent`: project scope defaults public only when `scope.visibility == "public"`. Explicit `--public`/`--private`/`--anonymous` still win, private/unknown projects still default private, non-project scopes are unchanged, and a binding without `visibility` behaves exactly as before. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
christophergeyer
pushed a commit
that referenced
this pull request
Jul 27, 2026
This was referenced Jul 27, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
When a repo is scoped to an org project (
roar scope use <org>/<project>), roar always defaulted the registered DAG's visibility to private — even when the project itself is public. To get a public DAG under a public project, users had to pass--public, but--publicbypasses the project scope entirely and loses org attribution (owner_id/project_id). So there was no way to register a public, org-attributed DAG for a public project.Two spots hardcoded
project → privateand never consulted the project's actual visibility:roar/publish_auth.py_scope_visibility(...)roar/cli/publish_intent.pyresolve_publish_intent(...)The project's visibility is available from the GLaaS access-context (
projects_by_owner[].visibility, already shown byroar scope list), butroar scope usenever captured it andRepoScopehad novisibilityfield.The fix (narrow, backward-compatible)
A DAG registered under a project scope now defaults to the project's own visibility:
roar/scope_config.py: added optionalRepoScope.visibility; read from the[treqs]binding.roar scope use: resolves the project'svisibilityfrom the same access-context sourceroar scope listuses and persistsvisibility = "..."into the[treqs]binding._scope_visibility: a project scope returns"public"only when the bound project is public; otherwise still"private".resolve_publish_intent: a project scope defaults public only whenscope.visibility == "public".Only public projects change behavior. A public project now yields a public, org-attributed DAG (owner_id/project_id preserved in
scope_request).Unchanged
--public/--private/--anonymousstill win (a--privateon a public project still registers private).public/private/anonymous/unset) are untouched.[treqs]binding withoutvisibilitybehaves exactly as before (private default).Tests
Added/extended unit tests in
tests/unit/:test_scope_config.py:load_repo_scopereadsvisibility; defaultsNonewhen absent;roar scope usepersists public/private project visibility.test_publish_intent.py: project scope public → public intent; private/unset → private; explicit--privateoverrides a public project.test_publish_auth_context.py: public project →scope_request.visibility == "public"with owner_id/project_id preserved.All
tests/unit(1145 tests) pass.🤖 Generated with Claude Code