detached 87e6700

refactor(workflow): unexport the matrix configuration limit error

commit
87e67008ceaf535d628b223f4e88b17431c8a774
author
brice · · 2026-10-12 19:23 UTC
committer
brice · · 2026-10-18 14:59 UTC
parent
98ea59f
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
4 files · +10 -10
M workflow/PORTING.md +1 -1
@@ -78,7 +78,7 @@ code.
7878 message of the commit the tag points at. Only the head commit counts.
7979 - [ ] **`ExpandMatrix`** (recorded: the unknown exclude key, once per
8080 offending entry, and the 256 limit message, see
81- `ConfigurationLimitError`; matrix-edge-values, matrix-over-256): order of the product (first key slowest), include
81+ `configurationLimitError`; matrix-edge-values, matrix-over-256): order of the product (first key slowest), include
8282 semantics (added to every matching combination, never overwriting
8383 original values, later includes overwrite earlier added values, a
8484 non-matching include is a new combination, match by vector keys only),
@@ -78,7 +78,7 @@ code.
78 message of the commit the tag points at. Only the head commit counts.78 message of the commit the tag points at. Only the head commit counts.
79 - [ ] **`ExpandMatrix`** (recorded: the unknown exclude key, once per79 - [ ] **`ExpandMatrix`** (recorded: the unknown exclude key, once per
80 offending entry, and the 256 limit message, see80 offending entry, and the 256 limit message, see
81- `ConfigurationLimitError`; matrix-edge-values, matrix-over-256): order of the product (first key slowest), include81+ `configurationLimitError`; matrix-edge-values, matrix-over-256): order of the product (first key slowest), include
82 semantics (added to every matching combination, never overwriting82 semantics (added to every matching combination, never overwriting
83 original values, later includes overwrite earlier added values, a83 original values, later includes overwrite earlier added values, a
84 non-matching include is a new combination, match by vector keys only),84 non-matching include is a new combination, match by vector keys only),
M workflow/matrix.go +5 -5
@@ -62,7 +62,7 @@ func (c MatrixCombo) DisplayName(base string) string {
6262 // mentions no vector key matches all), without overwriting the original
6363 // values; an entry that matches no combination becomes a combination of
6464 // its own;
65-// - more than 256 jobs is a [*ConfigurationLimitError]. A strategy without a
65+// - more than 256 jobs is a a limit error. A strategy without a
6666 // matrix gives a single combination.
6767 //
6868 // The work is bounded: the product of the vectors may not exceed
@@ -158,19 +158,19 @@ func (m message) Error() string { return string(m) }
158158 // the exclusions; this limit keeps the work bounded, see [MaxMatrixProduct].
159159 var errProductTooBig = fmt.Errorf("matrix too large: the cross product of the vectors exceeds %d combinations", MaxMatrixProduct)
160160
161-// ConfigurationLimitError is returned when a matrix produces more than
161+// configurationLimitError is returned when a matrix produces more than
162162 // [MaxMatrixJobs] configurations. Its text is GitHub's (recorded by
163163 // matrix-over-256): "Strategy for job 'too-many' produced 272 configurations
164164 // which exceeds the maximum of 256 configurations". Job is empty when the
165165 // matrix was expanded without a job, see [Job.EvaluateStrategy].
166-type ConfigurationLimitError struct {
166+type configurationLimitError struct {
167167 // Job is the id of the job.
168168 Job string
169169 // Count is the number of configurations the matrix produces.
170170 Count int
171171 }
172172
173-func (e *ConfigurationLimitError) Error() string {
173+func (e *configurationLimitError) Error() string {
174174 subject := "Strategy"
175175 if e.Job != "" {
176176 subject = fmt.Sprintf("Strategy for job '%s'", e.Job)
@@ -319,7 +319,7 @@ func expand(ctx context.Context, vecs []vector, includes, excludes []*expr.Dicti
319319 combos = append(combos, b.combo())
320320 }
321321 if total > MaxMatrixJobs {
322- return nil, false, &ConfigurationLimitError{Count: total}
322+ return nil, false, &configurationLimitError{Count: total}
323323 }
324324 if len(combos) == 0 {
325325 if len(vecs) == 0 && len(includes) == 0 && len(excludes) == 0 {
@@ -62,7 +62,7 @@ func (c MatrixCombo) DisplayName(base string) string {
62 // mentions no vector key matches all), without overwriting the original62 // mentions no vector key matches all), without overwriting the original
63 // values; an entry that matches no combination becomes a combination of63 // values; an entry that matches no combination becomes a combination of
64 // its own;64 // its own;
65-// - more than 256 jobs is a [*ConfigurationLimitError]. A strategy without a65+// - more than 256 jobs is a a limit error. A strategy without a
66 // matrix gives a single combination.66 // matrix gives a single combination.
67 //67 //
68 // The work is bounded: the product of the vectors may not exceed68 // The work is bounded: the product of the vectors may not exceed
@@ -158,19 +158,19 @@ func (m message) Error() string { return string(m) }
158 // the exclusions; this limit keeps the work bounded, see [MaxMatrixProduct].158 // the exclusions; this limit keeps the work bounded, see [MaxMatrixProduct].
159 var errProductTooBig = fmt.Errorf("matrix too large: the cross product of the vectors exceeds %d combinations", MaxMatrixProduct)159 var errProductTooBig = fmt.Errorf("matrix too large: the cross product of the vectors exceeds %d combinations", MaxMatrixProduct)
160 160
161-// ConfigurationLimitError is returned when a matrix produces more than161+// configurationLimitError is returned when a matrix produces more than
162 // [MaxMatrixJobs] configurations. Its text is GitHub's (recorded by162 // [MaxMatrixJobs] configurations. Its text is GitHub's (recorded by
163 // matrix-over-256): "Strategy for job 'too-many' produced 272 configurations163 // matrix-over-256): "Strategy for job 'too-many' produced 272 configurations
164 // which exceeds the maximum of 256 configurations". Job is empty when the164 // which exceeds the maximum of 256 configurations". Job is empty when the
165 // matrix was expanded without a job, see [Job.EvaluateStrategy].165 // matrix was expanded without a job, see [Job.EvaluateStrategy].
166-type ConfigurationLimitError struct {166+type configurationLimitError struct {
167 // Job is the id of the job.167 // Job is the id of the job.
168 Job string168 Job string
169 // Count is the number of configurations the matrix produces.169 // Count is the number of configurations the matrix produces.
170 Count int170 Count int
171 }171 }
172 172
173-func (e *ConfigurationLimitError) Error() string {173+func (e *configurationLimitError) Error() string {
174 subject := "Strategy"174 subject := "Strategy"
175 if e.Job != "" {175 if e.Job != "" {
176 subject = fmt.Sprintf("Strategy for job '%s'", e.Job)176 subject = fmt.Sprintf("Strategy for job '%s'", e.Job)
@@ -319,7 +319,7 @@ func expand(ctx context.Context, vecs []vector, includes, excludes []*expr.Dicti
319 combos = append(combos, b.combo())319 combos = append(combos, b.combo())
320 }320 }
321 if total > MaxMatrixJobs {321 if total > MaxMatrixJobs {
322- return nil, false, &ConfigurationLimitError{Count: total}322+ return nil, false, &configurationLimitError{Count: total}
323 }323 }
324 if len(combos) == 0 {324 if len(combos) == 0 {
325 if len(vecs) == 0 && len(includes) == 0 && len(excludes) == 0 {325 if len(vecs) == 0 && len(includes) == 0 && len(excludes) == 0 {
M workflow/matrix_test.go +2 -2
@@ -321,7 +321,7 @@ func TestMatrixProductCap(t *testing.T) {
321321 }
322322 // 2^16 is allowed by the cap (and fails on the job limit), 2^16+1 is refused outright.
323323 _, err := ExpandMatrix(ctxbg, jsonValue(t, `{"matrix": {"a": `+vec(MaxMatrixProduct/2)+`, "b": `+vec(2)+`, "c": `+vec(1)+`}}`))
324- var limit *ConfigurationLimitError
324+ var limit *configurationLimitError
325325 if !errors.As(err, &limit) || limit.Count != MaxMatrixProduct {
326326 t.Errorf("err = %v", err)
327327 }
@@ -425,7 +425,7 @@ jobs:
425425 if err == nil || err.Error() != want {
426426 t.Errorf("err = %v, want %q", err, want)
427427 }
428- var limit *ConfigurationLimitError
428+ var limit *configurationLimitError
429429 if !errors.As(err, &limit) || limit.Job != "too-many" || limit.Count != 272 {
430430 t.Errorf("err = %#v", err)
431431 }
@@ -321,7 +321,7 @@ func TestMatrixProductCap(t *testing.T) {
321 }321 }
322 // 2^16 is allowed by the cap (and fails on the job limit), 2^16+1 is refused outright.322 // 2^16 is allowed by the cap (and fails on the job limit), 2^16+1 is refused outright.
323 _, err := ExpandMatrix(ctxbg, jsonValue(t, `{"matrix": {"a": `+vec(MaxMatrixProduct/2)+`, "b": `+vec(2)+`, "c": `+vec(1)+`}}`))323 _, err := ExpandMatrix(ctxbg, jsonValue(t, `{"matrix": {"a": `+vec(MaxMatrixProduct/2)+`, "b": `+vec(2)+`, "c": `+vec(1)+`}}`))
324- var limit *ConfigurationLimitError324+ var limit *configurationLimitError
325 if !errors.As(err, &limit) || limit.Count != MaxMatrixProduct {325 if !errors.As(err, &limit) || limit.Count != MaxMatrixProduct {
326 t.Errorf("err = %v", err)326 t.Errorf("err = %v", err)
327 }327 }
@@ -425,7 +425,7 @@ jobs:
425 if err == nil || err.Error() != want {425 if err == nil || err.Error() != want {
426 t.Errorf("err = %v, want %q", err, want)426 t.Errorf("err = %v, want %q", err, want)
427 }427 }
428- var limit *ConfigurationLimitError428+ var limit *configurationLimitError
429 if !errors.As(err, &limit) || limit.Job != "too-many" || limit.Count != 272 {429 if !errors.As(err, &limit) || limit.Job != "too-many" || limit.Count != 272 {
430 t.Errorf("err = %#v", err)430 t.Errorf("err = %#v", err)
431 }431 }
M workflow/strategy.go +2 -2
@@ -135,9 +135,9 @@ func (j *Job) EvaluateStrategy(ctx context.Context, env template.Env) (*Strategy
135135 return nil, err
136136 }
137137 st, err := ParseStrategy(ctx, v)
138- var limit *ConfigurationLimitError
138+ var limit *configurationLimitError
139139 if errors.As(err, &limit) {
140- return nil, &ConfigurationLimitError{Job: j.ID, Count: limit.Count}
140+ return nil, &configurationLimitError{Job: j.ID, Count: limit.Count}
141141 }
142142 return st, err
143143 }
@@ -135,9 +135,9 @@ func (j *Job) EvaluateStrategy(ctx context.Context, env template.Env) (*Strategy
135 return nil, err135 return nil, err
136 }136 }
137 st, err := ParseStrategy(ctx, v)137 st, err := ParseStrategy(ctx, v)
138- var limit *ConfigurationLimitError138+ var limit *configurationLimitError
139 if errors.As(err, &limit) {139 if errors.As(err, &limit) {
140- return nil, &ConfigurationLimitError{Job: j.ID, Count: limit.Count}140+ return nil, &configurationLimitError{Job: j.ID, Count: limit.Count}
141 }141 }
142 return st, err142 return st, err
143 }143 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 3

↑↓ moveenter openesc close