Skip to content

Commit 04624a3

Browse files
187 fix catalog validation errors (#190) #minor
* fix: Display validation errors from catalog API responses The error handling now detects and displays the violations array format returned by validation endpoints. Previously, these errors showed as "Unknown error - No details" because the code only handled the standard message/details format. Closes #187 Co-Authored-By: Claude Opus 4.5 <[email protected]> * add: document staging-to-main release PR process in CLAUDE.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: sync HISTORY.md to staging after release to prevent merge conflicts After a release, HISTORY.md is updated on main but staging doesn't get the update. This causes merge conflicts when feature branches (created from main) are merged to staging. This fix adds a step to the publish workflow that syncs HISTORY.md from main to staging after each release. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: avoid ARG_MAX limit by using GitHub expressions instead of env var The GITHUB_CONTEXT env var containing toJson(github) was too large when merging many commits, causing "Argument list too long" error. Fixed by accessing pusher.name and pusher.email directly via GitHub expressions instead of passing the entire context as an environment variable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
1 parent f8d55bd commit 04624a3

File tree

3 files changed

+46
-11
lines changed

3 files changed

+46
-11
lines changed

.github/workflows/publish.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,30 @@ jobs:
6666
git push
6767
fi
6868
69+
- name: Sync HISTORY.md to staging
70+
run: |
71+
# Sync the HISTORY.md update to staging to prevent merge conflicts
72+
# when feature branches (created from main) are merged to staging
73+
git fetch origin staging
74+
git checkout staging
75+
git checkout main -- HISTORY.md
76+
if git diff --exit-code HISTORY.md; then
77+
echo "staging HISTORY.md already up to date"
78+
else
79+
git add HISTORY.md
80+
git commit -m "chore: sync HISTORY.md from main"
81+
git push origin staging
82+
fi
83+
git checkout main
84+
6985
- name: Git details about version
7086
id: git-details
71-
env:
72-
GITHUB_CONTEXT: ${{ toJson(github) }}
7387
run: |
7488
version=$(git describe --tags --abbrev=0)
7589
echo "VERSION=${version}" >> $GITHUB_ENV
7690
echo "VERSION=${version}" >> $GITHUB_OUTPUT
77-
pusher=$(echo "$GITHUB_CONTEXT" | jq -r ".event.pusher.name")
78-
email=$(echo "$GITHUB_CONTEXT" | jq -r ".event.pusher.email")
79-
echo "PUSHER=${pusher}" >> $GITHUB_OUTPUT
80-
echo "EMAIL=${email}" >> $GITHUB_OUTPUT
91+
echo "PUSHER=${{ github.event.pusher.name }}" >> $GITHUB_OUTPUT
92+
echo "EMAIL=${{ github.event.pusher.email }}" >> $GITHUB_OUTPUT
8193
echo "URL=https://pypi.org/project/cortexapps-cli/${version}/" >> $GITHUB_OUTPUT
8294
8395
- name: Publish

CLAUDE.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,18 @@ Use the GitHub-recommended format: `<issue-number>-<short-description>`
141141

142142
### Release Workflow
143143
1. Create feature branch for changes
144-
2. Merge to `staging` branch for testing
145-
3. Merge `staging` to `main` to trigger release
146-
4. Version bumping:
144+
2. Create PR to merge feature branch to `staging` for testing
145+
3. Create PR to merge `staging` to `main` to trigger release:
146+
```bash
147+
gh pr create --base main --head staging --title "Release X.Y.Z: Description #patch|#minor|#major"
148+
```
149+
- Include version number and brief description in title
150+
- Use `#patch`, `#minor`, or `#major` in the title to control version bump
151+
- List all changes in the PR body
152+
4. Version bumping (based on hashtag in PR title or commit message):
147153
- Default: Patch version bump
148-
- `#minor` in commit message: Minor version bump
149-
- `#major` in commit message: Major version bump
154+
- `#minor`: Minor version bump
155+
- `#major`: Major version bump
150156
5. Release publishes to:
151157
- PyPI
152158
- Docker Hub (`cortexapp/cli:VERSION` and `cortexapp/cli:latest`)

cortexapps_cli/cortex_client.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,23 @@ def request(self, method, endpoint, params={}, headers={}, data=None, raw_body=F
149149
# try to parse the error message
150150
error = response.json()
151151
status = response.status_code
152+
153+
# Check for validation error format with violations array
154+
if 'violations' in error and isinstance(error['violations'], list):
155+
print(f'[red][bold]HTTP Error {status}[/bold][/red]: Validation failed')
156+
for violation in error['violations']:
157+
title = violation.get('title', 'Validation Error')
158+
description = violation.get('description', 'No description')
159+
violation_type = violation.get('violationType', '')
160+
pointer = violation.get('pointer', '')
161+
print(f' [yellow]{title}[/yellow]: {description}')
162+
if pointer:
163+
print(f' [dim]Location: {pointer}[/dim]')
164+
if violation_type:
165+
print(f' [dim]Type: {violation_type}[/dim]')
166+
raise typer.Exit(code=1)
167+
168+
# Standard error format with message/details
152169
message = error.get('message', 'Unknown error')
153170
details = error.get('details', 'No details')
154171
request_id = error.get('requestId', 'No request ID')

0 commit comments

Comments
 (0)