Skip to content

fix(scope): default DAG visibility to the project's visibility for project scopes - #240

Merged
christophergeyer merged 2 commits into
rc/0.4.1from
cg/project-scope-visibility
Jul 21, 2026
Merged

fix(scope): default DAG visibility to the project's visibility for project scopes#240
christophergeyer merged 2 commits into
rc/0.4.1from
cg/project-scope-visibility

Conversation

@christophergeyer

Copy link
Copy Markdown
Member

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 --public bypasses 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 → private and never consulted the project's actual visibility:

  • roar/publish_auth.py _scope_visibility(...)
  • roar/cli/publish_intent.py resolve_publish_intent(...)

The project's visibility is available from the GLaaS access-context (projects_by_owner[].visibility, already shown by roar scope list), but roar scope use never captured it and RepoScope had no visibility field.

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 optional RepoScope.visibility; read from the [treqs] binding.
  • roar scope use: resolves the project's visibility from the same access-context source roar scope list uses and persists visibility = "..." 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 when scope.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

  • Explicit --public / --private / --anonymous still win (a --private on a public project still registers private).
  • Private/unknown-visibility projects still default to private.
  • Non-project scopes (public/private/anonymous/unset) are untouched.
  • A legacy [treqs] binding without visibility behaves exactly as before (private default).

Tests

Added/extended unit tests in tests/unit/:

  • test_scope_config.py: load_repo_scope reads visibility; defaults None when absent; roar scope use persists public/private project visibility.
  • test_publish_intent.py: project scope public → public intent; private/unset → private; explicit --private overrides 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

chrisgeyertreqs and others added 2 commits July 21, 2026 20:48
…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
christophergeyer merged commit 2fa73da into rc/0.4.1 Jul 21, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants