This repository was archived by the owner on May 25, 2026. It is now read-only.
feat(schemas): schema-driven slim fields on commits (DOT-558) - #110
Merged
Conversation
Phase 3 of the response-schema initiative (DOT-555), replicating the merge-request pattern (PR #109) on the commits domain. - src/schemas/commits.ts: export CommitSlimShape (source of truth), GitLabCommitSlimSchema (.pick view), COMMIT_SLIM_FIELDS (allow-list). - src/tools/commits.ts: drop hand-maintained LIST_COMMITS_DEFAULT_FIELDS; list_commits now consumes COMMIT_SLIM_FIELDS; get_commit gains a fields param + parseGitLabResponse + projectField call. get_commit_diff is out of scope (diff shape, not a resource). - Tests: slim-schema parse, projectField allow-list, token-budget regression, and handler tests for get_commit default / fields:'all' / custom pick.
Same recipe as the commits commit on this branch. - src/schemas/issues.ts: export IssueSlimShape, GitLabIssueSlimSchema, ISSUE_SLIM_FIELDS. - src/tools/issues.ts: drop LIST_ISSUES_DEFAULT_FIELDS; list_issues and my_issues now consume ISSUE_SLIM_FIELDS; get_issue gains a fields param + projectField call (it already parsed via GitLabIssueSchema). - Tests: slim-schema parse + token-budget regression + handler tests for get_issue.
Same recipe as the prior commits. - src/schemas/pipelines.ts: export PipelineSlimShape, GitLabPipelineSlimSchema, PIPELINE_SLIM_FIELDS. - src/tools/pipelines.ts: drop LIST_PIPELINES_DEFAULT_FIELDS; list_pipelines now consumes PIPELINE_SLIM_FIELDS; get_pipeline gains a fields param + parseGitLabResponse + projectField call (Phase 1 hadn't wrapped its response in parseGitLabResponse either, so this brings it in line with the get_issue / get_merge_request pattern). - Tests: slim-schema parse + token-budget regression + handler tests for get_pipeline.
Same recipe as the prior commits, with one extra wrinkle: get_project has an existing include_secrets flag that gates runners_token. The slim default never includes runners_token; redaction still runs before projection; include_secrets: true implies fields: 'all' (the existing list-endpoint behavior) so callers actually see the token they asked for unless they pass an explicit fields override. - src/schemas/projects.ts: export ProjectSlimShape (no runners_token — privacy guardrail asserted in tests), GitLabProjectSlimSchema, PROJECT_SLIM_FIELDS. - src/tools/projects.ts: drop LIST_PROJECTS_DEFAULT_FIELDS; list_projects + list_group_projects + get_project all consume PROJECT_SLIM_FIELDS. get_project now also parses via GitLabProjectSchema before redact-then-project. - Tests: slim-schema parse, projectField allow-list with privacy guardrail (PROJECT_SLIM_FIELDS does NOT contain runners_token), token-budget regression, and handler tests for get_project covering default / fields:'all' / include_secrets:true / custom pick (the include_secrets test verifies the secret is actually visible).
…n (DOT-558) Extends the Field Projection section's currently-applied list to include get_project, get_issue, get_pipeline, get_commit alongside get_merge_request (added in Phase 2).
Member
Author
|
This change is part of the following stack: Change managed by git-spice. |
ApprovabilityVerdict: Approved Consolidates field projection constants into schema files and extends the existing slim-field pattern to get_* endpoints. Well-tested, follows established patterns, and provides opt-out via You can customize Macroscope's approvability policy. Learn more. |
|
🎉 This PR is included in version 2.31.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
ichoosetoaccept
added a commit
that referenced
this pull request
May 15, 2026
…#111) Sibling of DOT-558 (Phase 3a). Extends the schema-driven slim-fields pattern (canonical: PR #109, PR #110) to the users domain — the one piece Phase 3a deferred because the slim shape needed a privacy-aware design pass. Slim shape: identity-only — id, username, name, state, avatar_url, web_url, bot. Seven fields. Always safe to expose for any user. Privacy-sensitive fields (email, last_sign_in_at, is_admin, two_factor_enabled, confirmed_at, current_sign_in_at, private_profile, last_activity_on, theme_id, color_scheme_id, projects_limit, external) are excluded by default; opt back in via fields:'all' or explicit pick. A dedicated test pins the privacy guardrail so future expansions of UserSlimShape can't accidentally leak those fields. Phase-1 gaps closed along the way: - src/schemas/users.ts: GitLabUserListSchema didn't exist; add it. - src/tools/users.ts: get_users and search_users were never wrapped with parseGitLabResponse; wrap them now (a prerequisite for typed slim defaults to project from). Wires four user-returning tools with fields + projection: - get_current_user (already parse-wrapped, just adds fields+project) - get_user (already parse-wrapped, just adds fields+project) - get_users (newly parse-wrapped, per-username map slimmed element-wise) - search_users (newly parse-wrapped, list slimmed) Out of scope: list_events, get_project_events, upload_markdown, download_attachment, health_check — they live in users.ts for organizational convenience but don't return user-shaped data. Tests: - tests/schemas/users.test.ts: slim-schema parse, USER_SLIM_FIELDS allow-list invariant, projectField allow-list at runtime, **privacy guardrail** (USER_SLIM_FIELDS does NOT contain email / is_admin / two_factor_enabled / etc.), separate test that projectField actually drops those fields on a populated current-user fixture, GitLabUserListSchema parse, token-budget regression. - tests/users.test.ts: default / fields:'all' / custom-pick handler tests for each of the four tools (12+ cases). get_current_user and get_user tests specifically verify privacy fields absent by default and present under fields:'all'. search_users test confirms `fields` is not forwarded to GitLab as a query string. README "Field Projection" section extended to list the four user endpoints.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
feat(schemas): schema-driven slim fields on commits (DOT-558)
Phase 3 of the response-schema initiative (DOT-555), replicating the
merge-request pattern (PR #109) on the commits domain.
GitLabCommitSlimSchema (.pick view), COMMIT_SLIM_FIELDS (allow-list).
list_commits now consumes COMMIT_SLIM_FIELDS; get_commit gains a fields
param + parseGitLabResponse + projectField call. get_commit_diff is
out of scope (diff shape, not a resource).
regression, and handler tests for get_commit default / fields:'all' /
custom pick.
feat(schemas): schema-driven slim fields on issues (DOT-558)
Same recipe as the commits commit on this branch.
ISSUE_SLIM_FIELDS.
my_issues now consume ISSUE_SLIM_FIELDS; get_issue gains a fields
param + projectField call (it already parsed via GitLabIssueSchema).
for get_issue.
feat(schemas): schema-driven slim fields on pipelines (DOT-558)
Same recipe as the prior commits.
GitLabPipelineSlimSchema, PIPELINE_SLIM_FIELDS.
list_pipelines now consumes PIPELINE_SLIM_FIELDS; get_pipeline gains
a fields param + parseGitLabResponse + projectField call (Phase 1
hadn't wrapped its response in parseGitLabResponse either, so this
brings it in line with the get_issue / get_merge_request pattern).
for get_pipeline.
feat(schemas): schema-driven slim fields on projects (DOT-558)
Same recipe as the prior commits, with one extra wrinkle: get_project
has an existing include_secrets flag that gates runners_token. The
slim default never includes runners_token; redaction still runs before
projection; include_secrets: true implies fields: 'all' (the existing
list-endpoint behavior) so callers actually see the token they asked
for unless they pass an explicit fields override.
privacy guardrail asserted in tests), GitLabProjectSlimSchema,
PROJECT_SLIM_FIELDS.
list_projects + list_group_projects + get_project all consume
PROJECT_SLIM_FIELDS. get_project now also parses via
GitLabProjectSchema before redact-then-project.
guardrail (PROJECT_SLIM_FIELDS does NOT contain runners_token),
token-budget regression, and handler tests for get_project covering
default / fields:'all' / include_secrets:true / custom pick (the
include_secrets test verifies the secret is actually visible).
docs(readme): list new singular get_* endpoints under Field Projection (DOT-558)
Extends the Field Projection section's currently-applied list to
include get_project, get_issue, get_pipeline, get_commit alongside
get_merge_request (added in Phase 2).
Note
Add schema-driven slim field projection to
get_commit,get_issue,get_pipeline, andget_project<Resource>SlimShape,GitLab<Resource>SlimSchema, and<RESOURCE>_SLIM_FIELDSexports tosrc/schemas/commits.ts,src/schemas/issues.ts,src/schemas/pipelines.ts, andsrc/schemas/projects.ts.get_commit,get_issue,get_pipeline, andget_projectnow return a slim field set by default and accept an optionalfieldsparameter (includingfields="all") to control projection.LIST_*_DEFAULT_FIELDSconstants from the tool files, replacing them with the schema-derived*_SLIM_FIELDSconstants.get_project,include_secrets: trueimpliesfields="all"unless the caller passes an explicitfieldsoverride; redact-then-project ordering is preserved andrunners_tokenis never included inPROJECT_SLIM_FIELDS.get_commit,get_issue,get_pipeline, andget_projectpreviously returned the full unprojected GitLab API payload; they now return only slim fields by default.🖇️ Linked Issues
Completes DOT-558, which tracks extending the Phase-2 schema-driven slim-fields pattern to the commits, issues, pipelines, and projects domains, as part of the broader DOT-555 token-efficiency initiative.
Macroscope summarized 6089b33.