Skip to content
This repository was archived by the owner on May 25, 2026. It is now read-only.

feat(ci): schema-drift CI gate against live GitLab (DOT-559)#112

Merged
ichoosetoaccept merged 1 commit into
detailobsessedfrom
port/dot-559-schema-drift-ci
May 15, 2026
Merged

feat(ci): schema-drift CI gate against live GitLab (DOT-559)#112
ichoosetoaccept merged 1 commit into
detailobsessedfrom
port/dot-559-schema-drift-ci

Conversation

@ichoosetoaccept

@ichoosetoaccept ichoosetoaccept commented May 15, 2026

Copy link
Copy Markdown
Member

Closes Phase 4 of the response-schemas initiative (DOT-555). Adds a
weekly GitHub Actions workflow plus a standalone Bun script that calls
every response-schema-bearing GitLab REST endpoint and parses each
response against its declared Zod schema with .parse() (strict).
Phase 1 deliberately made runtime parsing lenient (.safeParse + log +
pass-through) so users aren't blocked by minor drift; this is the
strict counterpart that catches API drift in CI.

The script auto-discovers fixture IDs from list endpoints — no
per-endpoint env var sprawl. Re-uses loadConfig() and GitLabClient
from the runtime. Required env vars: GITLAB_API_URL,
GITLAB_PERSONAL_ACCESS_TOKEN, GITLAB_PROJECT_ID.

Note

Add schema-drift CI gate that validates live GitLab responses against Zod schemas

  • Adds scripts/check-schema-drift.ts, a Bun CLI that calls live GitLab REST endpoints (projects, merge requests, commits, issues, pipelines, users, repository tree) and strictly validates responses with Zod .parse(), exiting non-zero on any mismatch.
  • Adds .github/workflows/schema-drift.yml, a weekly cron workflow (Mondays 06:00 UTC) and workflow_dispatch trigger that runs the drift check using repo secrets for GitLab credentials.
  • Adds a drift script to package.json for running the same check locally via bun run drift.
  • Updates README.md with troubleshooting guidance for schema validation warnings and instructions for running the drift check manually.
  • Fetch logic includes retry with backoff for transient 5xx and network errors, but schema mismatches are never retried — they are the intended failure signal.

🖇️ Linked Issues

Completes DOT-559, the Phase 4 subtask of DOT-555 (Introduce Zod response schemas as a token-efficiency primitive).

Macroscope summarized 8e00818.

@ichoosetoaccept

ichoosetoaccept commented May 15, 2026

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-559

DOT-555

@macroscopeapp

macroscopeapp Bot commented May 15, 2026

Copy link
Copy Markdown

Approvability

Verdict: Approved

This PR adds CI-only infrastructure (a scheduled workflow and validation script) for detecting schema drift against live GitLab APIs. No production runtime code is modified - the changes are purely testing/validation tooling.

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

@ichoosetoaccept ichoosetoaccept force-pushed the port/dot-559-schema-drift-ci branch from 21ee699 to c657401 Compare May 15, 2026 16:05
Closes Phase 4 of the response-schemas initiative (DOT-555). Adds a
weekly GitHub Actions workflow plus a standalone Bun script that calls
every response-schema-bearing GitLab REST endpoint and parses each
response against its declared Zod schema with .parse() (strict).
Phase 1 deliberately made runtime parsing lenient (.safeParse + log +
pass-through) so users aren't blocked by minor drift; this is the
strict counterpart that catches API drift in CI.

The script auto-discovers fixture IDs from list endpoints — no
per-endpoint env var sprawl. Re-uses loadConfig() and GitLabClient
from the runtime. Required env vars: GITLAB_API_URL,
GITLAB_PERSONAL_ACCESS_TOKEN, GITLAB_PROJECT_ID.
@ichoosetoaccept ichoosetoaccept force-pushed the port/dot-559-schema-drift-ci branch from c657401 to 8e00818 Compare May 15, 2026 16:43
@ichoosetoaccept

Copy link
Copy Markdown
Member Author

@macroscopeapp review

@ichoosetoaccept ichoosetoaccept merged commit fe19784 into detailobsessed May 15, 2026
4 checks passed
@ichoosetoaccept ichoosetoaccept deleted the port/dot-559-schema-drift-ci branch May 15, 2026 16:51
github-actions Bot pushed a commit that referenced this pull request May 15, 2026
# [2.33.0](v2.32.0...v2.33.0) (2026-05-15)

### Features

* **ci:** schema-drift CI gate against live GitLab (DOT-559) ([#112](#112)) ([fe19784](fe19784))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.33.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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