Skip to content

refactor: ⚙️scope parsing updated to a more consistent and easier to understand format - #322

Merged
tmeckel merged 13 commits into
masterfrom
refator/scope-parsing
Aug 9, 2026
Merged

refactor: ⚙️scope parsing updated to a more consistent and easier to understand format#322
tmeckel merged 13 commits into
masterfrom
refator/scope-parsing

Conversation

@tmeckel

@tmeckel tmeckel commented Aug 9, 2026

Copy link
Copy Markdown
Owner

No description provided.

tmeckel added 8 commits August 9, 2026 19:27
Add graphify-out/ to .gitignore so the locally generated knowledge graph (graph.json, graph.html, wiki, manifests) is not committed. These artifacts are regenerated by graphify on demand and must remain local working state.
…c ORG: scope parser

Rewrite internal/cmd/util/scope.Parse to use an explicit ORG: organization marker and a leading-slash no-project marker instead of the ambiguous validPrefixes/prefixLen heuristics.

Key changes:
- Add DisallowProject and DisallowTargets options; MaxTargets==0 now means unbounded.
- Structured wrappers no longer classify a bare segment as organization (only ParseOrganizationArg keeps bare ORG for org-only commands).
- Legacy organization/slash forms are rejected with ORG: guidance where structurally detectable; ambiguous forms follow canonical project-first interpretation.

Tests rewritten to full Path equality covering every wrapper mode, markers, unbounded targets, malformed colons, default-org resolution, and legacy rejection/reinterpretation.
…PO grammar

Replace legacy [ORGANIZATION/]PROJECT/REPO regexes with a splitName tokenizer that mirrors the shared scope parser: explicit ORG: prefix, restored organization-name validation, and rejection of legacy slash forms with ORG: guidance. Preserve URL/SSH parsing, hostname validation, and slash-delimited FullName display.

Add a testdata organization fixture for the git: name-routing case. Consolidate splitName tests into public-API coverage (ProjectFromName/RepositoryFromName).
Resolve pre-existing lint blockers so make lint passes with golangci-lint 2.12.2. All changes are behavior-preserving:

- Replace unsafe.Pointer endianness probe with binary.NativeEndian.
- Narrow test file opens with nolint justification (paths derive from t.TempDir()).
- Eliminate int->int32 overflow by using rand.Intn.
- Use typed context keys instead of string keys.
- Drop always-nil error return and unused params/fields.
- Move test-only cache helpers into _test.go so they are excluded under run.tests=false.
Update all command Use/Long/Example/argument strings and call sites to the new [ORG:]PROJECT/... forms and the /TARGET no-project marker. Affected command groups: boards iteration, pipelines, projects, teams, graph users, service endpoints, security groups/permissions/namespaces, and repositories.

Notable adjustments:
- Commands now route through the deterministic parser and the ParseProjectScope/ParsePoolAgentTargetWithDefaultOrganization wrappers.
- Composed scopes (graph user list) use ORG:PROJECT.
- No-project modes (pool/agent, namespace) use the / marker with DisallowProject.
- Normalize optional organization notation to [ORG:] across command help.
Add black-box and table-driven tests covering explicit/default organization routing, no-project markers, legacy slash rejection and project-first reinterpretation, and parser-mode errors across the migrated command groups: boards, pipelines, projects, teams, graph users, service endpoints, security groups/permissions/namespaces, and repositories.

New test files added for previously untested parsers and commands: ParseSubjectTarget, parseNamespaceTarget, and several group/serviceendpoint commands.
Regenerate docs/ via make docs to reflect canonical [ORG:] scope notation across all migrated commands, and expand AGENTS.md commit & PR guidelines with topological batching, test-after-prod ordering, and agent git restrictions.
@tmeckel tmeckel self-assigned this Aug 9, 2026
@tmeckel
tmeckel merged commit 1326de1 into master Aug 9, 2026
4 checks passed
@tmeckel
tmeckel deleted the refator/scope-parsing branch August 9, 2026 20:22
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.

1 participant