Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A Go CLI tool (`gorp`) and library (`pkg/gorp`) for [ReportPortal](https://repor
| `internal/commands/` | CLI command implementations (see below) |
| `pkg/gorp/` | Hand-written public library (see below) |
| `pkg/openapi/` | **Generated** OpenAPI client — never edit manually |
| `scripts/` | OpenAPI spec preprocessing filter (`openapi-preprocess.jq`, run through the `jq` Docker image), short-name type aliases template (`openapi-compat/`) |
| `scripts/` | OpenAPI spec preprocessing filter (`openapi-preprocess.jq`, run through the `jq` Docker image), short-name type aliases template (`openapi-compat/compat.go.tmpl`) and the tool that fills its v5.2.2 block (`openapi-compat/v5names.go`) |
| `Taskfile.yml` | Task runner for build, test, lint, fmt, OpenAPI codegen |
| `.claude/skills/reportportal/` | Skill for CLI/library reporting workflows (`start-launch`, `test2json`, quality gates, etc.). `.cursor/skills/reportportal/SKILL.md` symlinks to it — same file, don't edit both |

Expand Down Expand Up @@ -124,6 +124,7 @@ The suite skips itself when no credentials are configured.
- `report test2json` parses `go test -json` output (see `internal/commands/report.go`'s `testEvent` struct). As of **Go 1.27**, `test2json` annotates `"action":"output"` events with an `OutputType` field (`"frame"`, `"error"`, `"error-continue"`, or blank) and `"action":"fail"` events with `FailedBuild` when the failure was a build failure. The repo's `testEvent` struct captures both fields; `logLevelForOutputType` promotes `error`/`error-continue` output to `ERROR`-level RP logs, and `shouldMergeOutput` merges `error-continue` (or, for pre-1.27 streams with no `OutputType`, tab-indented) chunks into the previous log entry. `FailedBuild` is parsed but not currently acted on. See `report.go` and `report_log_test.go` for the full logic and test coverage. **Note:** despite the pre-existing fields (`time`, `action`, etc.) being tagged with lowercase `json:"..."` names while `OutputType`/`FailedBuild` use exact-case tags, `encoding/json.Unmarshal`'s case-insensitive fallback makes both work correctly against the real (PascalCase) `go test -json` wire format — this is a cosmetic inconsistency, not a bug.
- `Statuses.Canceled` (Go identifier, American spelling) serializes to the string `"CANCELLED"` (British spelling, matching the ReportPortal API) — don't "fix" the string value to match the identifier.
- Generated types use long fully-qualified names (`ComEpamReportportal...`); short names (`StartLaunchRQ`, `PageMetadata`, …) are type aliases kept for backward compatibility in `scripts/openapi-compat/compat.go.tmpl`, which `task generate-openapi-client` copies to `pkg/openapi/compat.go`. If a regenerated spec renames a type, `go build` fails in `compat.go` — fix the template. An alias must point to the type with the same meaning, not just one that compiles: e.g. `LaunchResource` is the reporting model, while launch list/get endpoints return `LaunchViewModel` / `PageLaunchViewModel`.
- The block between `BEGIN v5.2.2 names` / `END v5.2.2 names` in `compat.go.tmpl` restores the model names `pkg/openapi` exported at tag v5.2.2. It is generated: `go run scripts/openapi-compat/v5names.go -old <v5.2.2 pkg/openapi> -write -test pkg/gorp/openapi_compat_v5_test.go` (the file header has the full command and the mapping rule). An alias is emitted only when exactly one schema key in `reportportal-api-docs.json` has that class name (or, for a name without a key, when every field that used it now uses one and the same type) and the v5.2.2 JSON fields are still present. `pkg/gorp/openapi_compat_v5_test.go` is the generated compile-level check of those names and their field types; after a regeneration that reshapes a type, rerun the tool instead of editing the block or the test by hand, and review the diff: a rerun removes a name from the block and from the test together, so a shrinking block is a break for v5 callers that the test no longer catches.

## What NOT to do

Expand Down
Loading
Loading