fix: Update baseline references to use 'origin/development' for consistency across scripts and tests

This commit is contained in:
GitHub Actions
2026-02-18 17:36:52 +00:00
parent 983ec7a42e
commit b4b076039f
4 changed files with 21 additions and 11 deletions

View File

@@ -46,7 +46,7 @@ type reportJSON struct {
func main() {
repoRootFlag := flag.String("repo-root", ".", "Repository root path")
baselineFlag := flag.String("baseline", "origin/main...HEAD", "Git diff baseline")
baselineFlag := flag.String("baseline", "origin/development...HEAD", "Git diff baseline")
backendCoverageFlag := flag.String("backend-coverage", "backend/coverage.txt", "Backend Go coverage profile")
frontendCoverageFlag := flag.String("frontend-coverage", "frontend/coverage/lcov.info", "Frontend LCOV coverage report")
jsonOutFlag := flag.String("json-out", "test-results/local-patch-report.json", "Path to JSON output report")

View File

@@ -240,7 +240,7 @@ func TestGitDiffAndWriters(t *testing.T) {
}
report := reportJSON{
Baseline: "origin/main...HEAD",
Baseline: "origin/development...HEAD",
GeneratedAt: "2026-02-17T00:00:00Z",
Mode: "warn",
Thresholds: thresholdJSON{Overall: 90, Backend: 85, Frontend: 85},
@@ -271,7 +271,7 @@ func TestGitDiffAndWriters(t *testing.T) {
if err != nil {
t.Fatalf("read json file: %v", err)
}
if !strings.Contains(string(jsonBytes), "\"baseline\": \"origin/main...HEAD\"") {
if !strings.Contains(string(jsonBytes), "\"baseline\": \"origin/development...HEAD\"") {
t.Fatalf("unexpected json content: %s", string(jsonBytes))
}
@@ -392,7 +392,7 @@ func TestWriteJSONReturnsErrorWhenPathIsDirectory(t *testing.T) {
func TestWriteMarkdownReturnsErrorWhenPathIsDirectory(t *testing.T) {
dir := t.TempDir()
report := reportJSON{
Baseline: "origin/main...HEAD",
Baseline: "origin/development...HEAD",
GeneratedAt: "2026-02-17T00:00:00Z",
Mode: "warn",
Thresholds: thresholdJSON{Overall: 90, Backend: 85, Frontend: 85},
@@ -581,7 +581,7 @@ func TestMain_WarnsForInvalidThresholdEnv(t *testing.T) {
func TestWriteMarkdownIncludesArtifactsSection(t *testing.T) {
report := reportJSON{
Baseline: "origin/main...HEAD",
Baseline: "origin/development...HEAD",
GeneratedAt: "2026-02-17T00:00:00Z",
Mode: "warn",
Thresholds: thresholdJSON{Overall: 90, Backend: 85, Frontend: 85},
@@ -707,7 +707,7 @@ func TestAssertFileExistsErrorMessageIncludesLabel(t *testing.T) {
func TestWriteJSONContentIncludesTrailingNewline(t *testing.T) {
path := filepath.Join(t.TempDir(), "out.json")
report := reportJSON{Baseline: "origin/main...HEAD", GeneratedAt: "2026-02-17T00:00:00Z", Mode: "warn"}
report := reportJSON{Baseline: "origin/development...HEAD", GeneratedAt: "2026-02-17T00:00:00Z", Mode: "warn"}
if err := writeJSON(path, report); err != nil {
t.Fatalf("writeJSON: %v", err)
}
@@ -841,7 +841,7 @@ func TestMainStderrForMissingFrontendCoverage(t *testing.T) {
func TestWriteMarkdownWithoutWarningsOrFiles(t *testing.T) {
report := reportJSON{
Baseline: "origin/main...HEAD",
Baseline: "origin/development...HEAD",
GeneratedAt: "2026-02-17T00:00:00Z",
Mode: "warn",
Thresholds: thresholdJSON{Overall: 90, Backend: 85, Frontend: 85},
@@ -1026,7 +1026,7 @@ func TestMainProcessHelperWithMalformedArgsExitsNonZero(t *testing.T) {
func TestWriteMarkdownContainsSummaryTable(t *testing.T) {
report := reportJSON{
Baseline: "origin/main...HEAD",
Baseline: "origin/development...HEAD",
GeneratedAt: "2026-02-17T00:00:00Z",
Mode: "warn",
Thresholds: thresholdJSON{Overall: 90, Backend: 85, Frontend: 85},

View File

@@ -27,7 +27,7 @@ Validate that local patch-report workflow is executed in Definition of Done (DoD
- [ ] `test-results/local-patch-report.md`
- [ ] `test-results/local-patch-report.json`
- [ ] Confirm JSON includes:
- [ ] `baseline = origin/main...HEAD`
- [ ] `baseline = origin/development...HEAD` (or `development...HEAD` when remote ref is unavailable)
- [ ] `mode = warn`
- [ ] `overall`, `backend`, `frontend` coverage blocks
- [ ] `files_needing_coverage` list

View File

@@ -2,7 +2,7 @@
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
BASELINE="${CHARON_PATCH_BASELINE:-origin/main...HEAD}"
BASELINE="${CHARON_PATCH_BASELINE:-}"
BACKEND_COVERAGE_FILE="$ROOT_DIR/backend/coverage.txt"
FRONTEND_COVERAGE_FILE="$ROOT_DIR/frontend/coverage/lcov.info"
JSON_OUT="$ROOT_DIR/test-results/local-patch-report.json"
@@ -62,6 +62,16 @@ if ! command -v go >/dev/null 2>&1; then
exit 1
fi
if [[ -z "$BASELINE" ]]; then
if git -C "$ROOT_DIR" rev-parse --verify --quiet "origin/development^{commit}" >/dev/null; then
BASELINE="origin/development...HEAD"
elif git -C "$ROOT_DIR" rev-parse --verify --quiet "development^{commit}" >/dev/null; then
BASELINE="development...HEAD"
else
BASELINE="origin/development...HEAD"
fi
fi
if [[ ! -f "$BACKEND_COVERAGE_FILE" ]]; then
write_preflight_artifacts "backend coverage input missing at $BACKEND_COVERAGE_FILE"
echo "Error: backend coverage input missing at $BACKEND_COVERAGE_FILE" >&2
@@ -80,7 +90,7 @@ if [[ "$BASELINE" == *"..."* ]]; then
fi
if [[ -n "$BASE_REF" ]] && ! git -C "$ROOT_DIR" rev-parse --verify --quiet "${BASE_REF}^{commit}" >/dev/null; then
echo "Error: baseline base ref '$BASE_REF' is not available locally. Set CHARON_PATCH_BASELINE to a valid range and retry." >&2
echo "Error: baseline base ref '$BASE_REF' is not available locally. Set CHARON_PATCH_BASELINE to a valid range and retry (default attempts origin/development, then development)." >&2
exit 1
fi