Skip to content
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
ichoosetoaccept merged 5 commits into
detailobsessedfrom
port/dot-558-slim-fields-phase3
May 15, 2026
Merged

feat(schemas): schema-driven slim fields on commits (DOT-558)#110
ichoosetoaccept merged 5 commits into
detailobsessedfrom
port/dot-558-slim-fields-phase3

Conversation

@ichoosetoaccept

@ichoosetoaccept ichoosetoaccept commented May 15, 2026

Copy link
Copy Markdown
Member

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.

  • 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.

feat(schemas): schema-driven slim fields on issues (DOT-558)

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.

feat(schemas): schema-driven slim fields on pipelines (DOT-558)

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.

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.

  • 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).

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, and get_project

  • Adds <Resource>SlimShape, GitLab<Resource>SlimSchema, and <RESOURCE>_SLIM_FIELDS exports to src/schemas/commits.ts, src/schemas/issues.ts, src/schemas/pipelines.ts, and src/schemas/projects.ts.
  • get_commit, get_issue, get_pipeline, and get_project now return a slim field set by default and accept an optional fields parameter (including fields="all") to control projection.
  • Removes hand-maintained LIST_*_DEFAULT_FIELDS constants from the tool files, replacing them with the schema-derived *_SLIM_FIELDS constants.
  • For get_project, include_secrets: true implies fields="all" unless the caller passes an explicit fields override; redact-then-project ordering is preserved and runners_token is never included in PROJECT_SLIM_FIELDS.
  • Behavioral Change: get_commit, get_issue, get_pipeline, and get_project previously 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.

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).
@ichoosetoaccept

Copy link
Copy Markdown
Member Author

This change is part of the following stack:

Change managed by git-spice.

@linear-code

linear-code Bot commented May 15, 2026

Copy link
Copy Markdown

DOT-558

@macroscopeapp

macroscopeapp Bot commented May 15, 2026

Copy link
Copy Markdown

Approvability

Verdict: 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 fields: 'all'.

You can customize Macroscope's approvability policy. Learn more.

@ichoosetoaccept
ichoosetoaccept merged commit c912b64 into detailobsessed May 15, 2026
4 checks passed
@ichoosetoaccept
ichoosetoaccept deleted the port/dot-558-slim-fields-phase3 branch May 15, 2026 13:48
github-actions Bot pushed a commit that referenced this pull request May 15, 2026
# [2.31.0](v2.30.0...v2.31.0) (2026-05-15)

### Features

* **schemas:** schema-driven slim fields on commits (DOT-558) ([#110](#110)) ([c912b64](c912b64)), closes [#109](#109)
@github-actions

Copy link
Copy Markdown

🎉 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.
github-actions Bot pushed a commit that referenced this pull request May 15, 2026
# [2.32.0](v2.31.0...v2.32.0) (2026-05-15)

### Features

* **schemas:** schema-driven slim fields on users (Phase 3b, DOT-560) ([#111](#111)) ([6ea1953](6ea1953)), closes [#109](#109) [#110](#110)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant