564 lines
31 KiB
Markdown
564 lines
31 KiB
Markdown
# Implementation review remediation
|
||
|
||
## Scope and evidence
|
||
|
||
Reviewed commit `dd9e177` against every stage of
|
||
[the implementation plan](implementation.md), the
|
||
[feature roadmap](next-release.md), and the adopted facade, source-identity,
|
||
delivery, and rehearsal decisions. The architecture is substantially present;
|
||
the findings below identify remaining correctness and integration gaps.
|
||
|
||
Baseline verification passed with Go 1.27.4:
|
||
|
||
- The complete offline `go test ./...` suite.
|
||
- `go run ./internal/apicheck`.
|
||
- Race tests for `internal/rehearsal`, `internal/readiness`,
|
||
`internal/woodpecker`, `internal/git`, and `internal/gitea`.
|
||
|
||
Temporary Go test overlays reused existing local Git and HTTP fixtures to
|
||
substantiate findings 1–5, 7, and 8. Their expected-behavior assertions fail
|
||
against the reviewed implementation. The overlays changed no repository files;
|
||
production code and permanent tests remain unchanged by this review.
|
||
|
||
A follow-up integration audit reviewed Stages 1–15 in order at `67c8363`.
|
||
Production code remains identical to `dd9e177`, so the successful baseline
|
||
checks above still apply. Additional temporary-overlay probes reproduced
|
||
findings 10 and 11 using candidate checking, tagged CI dispatch, and a real
|
||
native build. A separate local selector-map probe also reproduced finding 10.
|
||
Existing focused CLI tests for calendar delivery, diagnostic delivery, build
|
||
readiness, and selector mapping pass. These probes used no external services;
|
||
their expected-behavior assertions fail on the identified integration gaps.
|
||
|
||
An algorithmic audit at `fad1567` reviewed Stages 1–15 in order against the
|
||
same production baseline. Findings 12–14 identify avoidable membership scans,
|
||
package-input enumeration, and log buffering. Their bounds follow from the
|
||
implemented loops, Git arguments, and the local Go 1.27.4 standard library;
|
||
no workload measurements or benchmarks were needed. Existing offline tests for
|
||
release identity, version contracts, readiness, Woodpecker, and rehearsal pass.
|
||
The review preserves the selected sequential polling, complete pagination,
|
||
record snapshots, and in-job content comparison, together with the resource
|
||
work explicitly deferred in [the earlier assessment](deferred-resources.md).
|
||
|
||
### Stage coverage
|
||
|
||
| Stage | Evidence reviewed | Related findings |
|
||
| --- | --- | --- |
|
||
| 1 | Profile selection, null/omitted defaults, physical directory resolution, facade-owned source types | 1 |
|
||
| 2 | Version grammars, module-major rules, source tag prefixes, diagnostic identity generation | 3, 10 |
|
||
| 3 | Committed candidate capture, Go capability selection, scoped file inputs and callbacks, exact source publication | 1 |
|
||
| 4 | Working and committed build/delivery identities, managed/prebuilt verification, tagged preparation | 6, 10 |
|
||
| 5 | Publication record versions and exact bytes, receipt schema 2, explicit recovery and durable entry points | — |
|
||
| 6 | Local file and CI variable selection, migration errors, operation-specific credential loading | 1 |
|
||
| 7 | Readiness defaults, narrowing, offline scope, input readers and error aggregation | 1, 2, 3, 11, 13 |
|
||
| 8 | Source-only pin, host installer, local/CI selection and recovery fixtures | — |
|
||
| 9 | Committed profiles, tag manifests, identity binding, private record lifecycle | 4, 6 |
|
||
| 10 | Woodpecker API pagination/correlation and diagnostic Git/forge effects | 4, 5, 6, 8 |
|
||
| 11 | Shared builds/uploads, in-job read-back, framed verification evidence | 6, 7, 10, 14 |
|
||
| 12 | Start, dispatch reconciliation, observation and partial results | 2, 3, 4, 7, 8, 11, 12, 13, 14 |
|
||
| 13 | Quiescence, ownership checks, partial deletion, resume and cleanup | 4, 5, 7, 12 |
|
||
| 14 | CLI/configuration mapping, reporting, exit classes and maintained workflow dispatch | 1, 6, 7, 10 |
|
||
| 15 | Assembled fixtures, canonical references and migration guidance | 9; regression gaps identified below |
|
||
|
||
Pending cleanup while CI remains active or unobservable is selected behavior.
|
||
The placeholder example pin and the absence of a newly published ReleaseKit
|
||
version are also consistent with the revised plan. Remediation should preserve
|
||
these boundaries and ordinary production-release immutability.
|
||
|
||
## 1. Readiness accepts configurations that the selected operations reject
|
||
|
||
**Completed:** Readiness shares candidate and selector configuration checks
|
||
with execution, requires the rehearsal CI declaration, and preserves narrower
|
||
delivery scope. CLI regression cases, affected internal suites, and the compiled
|
||
API/dependency check pass.
|
||
|
||
**Priority:** P2. **Stages:** 1, 3, 6, 7, 14.
|
||
|
||
**Relevant code:** [CLI readiness mapping](../../cmd/releasekit/readiness.go),
|
||
`runValidate`; [facade readiness](../../readiness.go), `Validate`; and
|
||
[shared readiness](../../internal/readiness/readiness.go), `Run`.
|
||
Execution performs additional checks in
|
||
[`Start`](../../internal/rehearsal/coordinator.go),
|
||
[`DiagnosticFromAttempt`](../../internal/releaseidentity/diagnostic.go), and
|
||
[`validation.Run`](../../internal/validation/validation.go).
|
||
|
||
Three locally verifiable configuration failures currently produce a successful
|
||
readiness result:
|
||
|
||
- `validate --operation rehearsal --offline` accepts a delivery configuration
|
||
with only local credentials. `test` requires the committed CI credential
|
||
declaration and rejects the same selection before dispatch.
|
||
- The same readiness command accepts `rehearsal.selector: "invalid/selector"`;
|
||
diagnostic identity construction rejects it.
|
||
- Default offline readiness accepts `source: {}` together with
|
||
`validation.go.race: true`. Candidate publication rejects that Go execution
|
||
selection because Go capability is disabled. Full vet and compile-target
|
||
selections have the same missing validation path.
|
||
|
||
The CLI does not convey selector or candidate validation selections to the
|
||
readiness facade. Its credential metadata also supplies no failed declaration
|
||
check when the CI declaration is absent. A CI declaration's existence and shape
|
||
are available locally, separately from the job-secret injection that correctly
|
||
remains unchecked on a workstation.
|
||
|
||
**Recommended remediation:** share the relevant operation-specific configuration
|
||
checks with execution and carry the necessary declaration/selector/validation
|
||
facts into readiness. Report independent configuration findings with status 2.
|
||
Keep narrower operation selection meaningful: ordinary local delivery readiness
|
||
continues to work without Woodpecker or CI credentials, and unrelated Go suite
|
||
settings need not block a delivery-only investigation. Actual CI secret values
|
||
remain job evidence.
|
||
|
||
**Regression coverage:** add the three failing cases above, online/offline
|
||
rehearsal declaration checks, and a valid local-only delivery case. Update the
|
||
existing `TestValidateRehearsalObservesWoodpeckerWithSeparateLocalCredential`
|
||
fixture, which currently asserts success with a missing CI declaration, so its
|
||
access-observation assertions use a complete rehearsal configuration.
|
||
|
||
## 2. Committed readiness turns local required files into committed inputs
|
||
|
||
**Priority:** P2. **Stages:** 7, 12.
|
||
|
||
**Relevant code:** [`Run`](../../internal/readiness/readiness.go), required-file
|
||
handling at lines 120–158; [`Start`](../../internal/rehearsal/coordinator.go)
|
||
passes the captured commit and `RequiredFiles`; and
|
||
[`startRehearsal`](../../cmd/releasekit/rehearsal.go) supplies the profile's
|
||
`readiness.required_files`.
|
||
|
||
When `request.Commit` is set, every repository-relative required file, and every
|
||
absolute required file within the checkout, is read from Git instead of the
|
||
local filesystem. Consequently an available, readable, ignored file such as
|
||
`.releasekit/ssh-key` passes ordinary readiness but fails rehearsal readiness as
|
||
missing from the commit. Conversely a committed required file can pass that
|
||
check even when its local copy is unavailable to native authentication.
|
||
|
||
This inadvertently requires local operator inputs inside the checkout to be
|
||
committed. The selected purpose of `readiness.required_files` includes local SSH
|
||
keys; capturing source and build inputs does not make those keys source content.
|
||
Changing the spelling to an absolute path within the same checkout does not
|
||
avoid the restriction.
|
||
|
||
**Recommended remediation:** inspect explicitly declared local required files
|
||
through the filesystem in both working and rehearsal readiness. Continue
|
||
reading source/module/build inputs from the captured commit for rehearsal.
|
||
Keep tokens and keys outside the committed input set; no new configuration
|
||
mechanism is needed merely to distinguish these existing responsibilities.
|
||
|
||
**Regression coverage:** an ignored local required key, in relative and absolute
|
||
forms, succeeds during rehearsal readiness; a missing local key fails even if a
|
||
same-named committed blob exists. Retain committed Go/module/main-package tests.
|
||
Adjust the required-file assertions in
|
||
`TestCommittedReadinessUsesCapturedModuleAndMainPackage`, which currently encode
|
||
the unintended committed-file requirement.
|
||
|
||
## 3. Readiness rejects a module major supported by production identity
|
||
|
||
**Priority:** P2. **Stages:** 2, 7, 12.
|
||
|
||
**Relevant code:** `inspectSourceConfiguration` in
|
||
[shared readiness](../../internal/readiness/readiness.go), lines 281–309.
|
||
|
||
To validate a module selection without a caller-supplied version, readiness
|
||
constructs a synthetic version from `module.SplitPathVersion` output using
|
||
`strings.TrimLeft(major, "/.") + ".0.0"`. That transformation does not preserve
|
||
all major-suffix forms already supported by the production identity resolver.
|
||
|
||
For example, `gopkg.in/fixture.v2-unstable` is accepted by the existing module
|
||
identity implementation with the stable version `v2.0.0`. Readiness instead
|
||
constructs `v2-unstable.0.0` and reports an invalid SemVer identifier. A local
|
||
probe confirmed that production identity resolution succeeds while readiness
|
||
fails the same source selection. The `-unstable` spelling here is part of the
|
||
module path, not a requested prerelease identifier.
|
||
|
||
**Recommended remediation:** validate normalized source/version policy directly
|
||
without inventing a release identifier where possible. Where major-version
|
||
reasoning is needed, reuse the existing Go module suffix handling rather than
|
||
reimplementing it with punctuation trimming. Keep readiness independent of a
|
||
selected release version and preserve currently supported Go module paths.
|
||
|
||
**Regression coverage:** working and committed readiness for the supported
|
||
`gopkg.in` unstable-major form, alongside ordinary unsuffixed, `/vN`, and
|
||
`gopkg.in` major suffixes. Tests need no real module download or publication.
|
||
|
||
## 4. A definitively rejected push strands cleanup waiting for nonexistent CI
|
||
|
||
**Priority:** P2. **Stages:** 9, 10, 12, 13.
|
||
|
||
**Relevant code:** [`Start`](../../internal/rehearsal/coordinator.go), lines
|
||
206–215; [diagnostic Git push](../../internal/git/diagnostic.go); and
|
||
[`cleanup` and `quiescent`](../../internal/rehearsal/cleanup.go).
|
||
|
||
Every push error is saved as `push: "unknown"` unless a subsequent query finds
|
||
the exact intended tag. Known rejection and confirmed absence receive no
|
||
distinct outcome. Cleanup then requires a terminal matching CI pipeline for
|
||
that attempt.
|
||
|
||
A temporary bare remote with a rejecting `pre-receive` hook reproduced this:
|
||
the remote tag is absent, the record says `unknown`, and cleanup returns
|
||
`pending: no matching CI pipeline has reached completion`. Repeated cleanup
|
||
cannot complete because that rejected push triggered no pipeline. The local
|
||
diagnostic tag remains, and the command reports uncertainty instead of the known
|
||
dispatch failure.
|
||
|
||
**Recommended remediation:** retain Git write evidence sufficient to distinguish
|
||
definite rejection or failure before dispatch from an ambiguous transport
|
||
outcome. Record the reconciled state before returning. An established
|
||
non-dispatch permits owned local cleanup without requiring a CI run. Preserve
|
||
unknown status for genuinely ambiguous writes; do not infer quiescence merely
|
||
from a timeout or an empty CI search.
|
||
|
||
**Regression coverage:** a rejecting receive hook, failure before the push is
|
||
issued, accepted push with a lost acknowledgment, and unavailable observation.
|
||
Verify that known non-dispatch removes only owned local resources and preserves
|
||
the original push error, while uncertain dispatch retains recovery evidence.
|
||
|
||
## 5. An already-absent tag prevents cleanup of its known hosted page
|
||
|
||
**Priority:** P2. **Stages:** 10, 13.
|
||
|
||
**Relevant code:** [`cleanup`](../../internal/rehearsal/cleanup.go) accepts an
|
||
absent remote tag, but `deleteRecordedPage` subsequently requires
|
||
`TagCommit` to succeed before deleting the page.
|
||
|
||
If the recorded diagnostic tag has already been removed while its hosted page
|
||
remains, cleanup establishes quiescence and confirms the tag's absence, then
|
||
fails the page's tag lookup. A probe with an explicitly recorded page ID,
|
||
matching title/body/tag, and an absent remote tag returned `cleanup: "unknown"`
|
||
with zero page deletions. The owned page remains indefinitely.
|
||
This is a viable Gitea state: native Git tag deletion leaves the release row
|
||
and its attachments intact, as described in
|
||
[Gitea's account of push-driven tag deletion](https://github.com/go-gitea/gitea/security/advisories/GHSA-vvqw-mjq8-x248).
|
||
|
||
The selected partial-cleanup contract treats already-absent resources as
|
||
cleaned. Requiring the tag to remain available adds a prerequisite that defeats
|
||
recovery for this partial state.
|
||
|
||
**Recommended remediation:** distinguish a conflicting tag from an already-absent
|
||
tag. Permit deletion of a known recorded page when its stable ID and other
|
||
ownership evidence match and the tag is confirmed absent. Keep uncertainty or
|
||
conflict when ownership cannot be established, especially when adopting a page
|
||
whose creation response was lost. Recovery should not recreate a tag to satisfy
|
||
this check.
|
||
|
||
**Regression coverage:** absent remote tag with a matching recorded page;
|
||
already-absent page/tag; and conflicting page ID, contents, or live tag target.
|
||
Retain deletion ordering and CI-quiescence protection.
|
||
|
||
## 6. Diagnostic CI delivery bypasses the orchestration facade
|
||
|
||
**Priority:** P2. **Stages:** 4, 9–11, 14.
|
||
|
||
**Relevant code:** [`runDiagnosticDelivery`](../../cmd/releasekit/diagnostic.go)
|
||
constructs `gitea.NewBackend`, sequences preflight/dependency preparation,
|
||
assembles internal build requests, and calls `internal/delivery.Deliver`
|
||
directly. In [the root facade](../../rehearsal.go), `recoverRehearsal` also
|
||
reconstructs the destination with `ForgeGitea` rather than a recorded selection.
|
||
[Attempt records](../../internal/rehearsal/record.go) store forge coordinates
|
||
but omit the forge selector.
|
||
|
||
The shared build/upload engine is reused, but the supported facade does not own
|
||
the assembled diagnostic CI operation. This diverges from the selected boundary
|
||
in which reusable orchestration and backend construction belong behind the
|
||
facade and the CLI owns configuration, credentials, reporting, and exits. It
|
||
also embeds Gitea assumptions in new generic paths instead of carrying the
|
||
explicit destination selection through recovery.
|
||
|
||
The duplicated CLI branch already has an observable classification difference:
|
||
its binary preflight failures and final delivery errors return status 1
|
||
unconditionally, whereas ordinary `ci-deliver` uses the established preflight
|
||
and uncertain-delivery exit mappings.
|
||
|
||
**Recommended remediation:** provide a cohesive supported facade route for the
|
||
diagnostic CI operation, using shared backend selection and resolved delivery
|
||
coordination. Keep implementation types private and leave report framing in the
|
||
CLI. Carry the selected forge in attempt evidence and reconstruct it through the
|
||
same backend factory during recovery. Preserve existing credential/error
|
||
classification across production and diagnostic invocations. Additional forge
|
||
implementations or public adapter interfaces are outside this remediation.
|
||
|
||
**Regression coverage:** exercise diagnostic CI delivery through the facade,
|
||
protect the CLI's orchestration/dependency boundary, retain explicit destination
|
||
selection through record/recovery, and compare rejected credentials and uncertain
|
||
writes across ordinary and diagnostic CI exit mapping.
|
||
|
||
## 7. Safe job diagnostics disappear from public and CLI results
|
||
|
||
**Priority:** P2. **Stages:** 11–14.
|
||
|
||
**Relevant code:** [`observe`](../../internal/rehearsal/coordinator.go) saves
|
||
`JobEvidence`; [`outcomeFromAttempt`](../../internal/rehearsal/cleanup.go)
|
||
constructs recovery outcomes; [`publicRehearsalOutcome`](../../rehearsal.go)
|
||
copies only `Outcome.Diagnostics`; and
|
||
[`writeRehearsalReport`](../../cmd/releasekit/rehearsal.go) renders that slice.
|
||
|
||
The job deliberately emits safe phase messages such as `prepare build
|
||
dependencies` or `delivery credential unavailable`. Those messages survive in
|
||
the private `JobEvidence.Diagnostics` field, but no path projects them into
|
||
`Outcome.Diagnostics`. The public result and its CLI document therefore omit
|
||
the available explanation and commonly retain only the generic error that CI
|
||
delivery did not complete successfully.
|
||
|
||
A saved-attempt probe retained a job diagnostic in the record but produced an
|
||
empty recovered diagnostic slice. Automatic cleanup also reconstructs an outcome,
|
||
so fixing only transient observation output would still lose the messages.
|
||
|
||
**Recommended remediation:** project the saved safe job diagnostics into the
|
||
public outcome consistently after observation, automatic cleanup, and explicit
|
||
recovery. Preserve their job/attempt context. Continue omitting raw logs and
|
||
token-bearing error bodies; the producer's existing safe phase messages supply
|
||
the missing information.
|
||
|
||
**Regression coverage:** CI credential, dependency preparation, and build failures
|
||
retain their safe explanation through start/cleanup and saved resume, in both
|
||
human and JSON reports. Keep secret-redaction assertions.
|
||
|
||
## 8. Pagination assumes a stable snapshot of live CI history
|
||
|
||
**Priority:** P2. **Stages:** 10, 12, 13.
|
||
|
||
**Relevant code:**
|
||
[`MatchingPipelines`](../../internal/woodpecker/client.go), especially its
|
||
unconditional error for a repeated pipeline ID across pages.
|
||
|
||
The [Woodpecker API](https://woodpecker-ci.org/api) exposes page-based listing.
|
||
The implementation treats overlap between pages as a malformed response.
|
||
With offset pagination, an insertion ahead of the current page can legitimately
|
||
shift a previously observed item onto the next page. A run being restarted or
|
||
new matching CI activity can therefore turn observation or cleanup into a
|
||
remote-verification failure despite readable, valid pipeline identities.
|
||
|
||
A local HTTP probe supplied 50 items on each of the first two pages with one
|
||
overlapping ID, then the remaining item. Instead of collecting the 100 distinct
|
||
identities, the adapter returned `pagination repeated a pipeline` and discarded
|
||
the accumulated matches. The assumption that live pages form a stable snapshot
|
||
is an additional requirement on the external service.
|
||
|
||
**Recommended remediation:** deduplicate consistent repeated identities while
|
||
continuing pagination and checking complete ref/commit identity. Handle genuine
|
||
non-progress or inconsistent identity as observation problems without declaring
|
||
ordinary overlap malformed. Preserve cancellation and uncertain-state handling;
|
||
no new history-size limit or snapshot guarantee is needed. Status progression
|
||
between duplicate observations is normal; consistency checks should concern
|
||
identity rather than requiring identical mutable status fields.
|
||
|
||
**Regression coverage:** overlapping pages during insertion, consistent
|
||
duplicates, conflicting identity, unrelated runs, cancellation, and actual
|
||
non-progress. Retain exact matching and complete-page traversal.
|
||
|
||
## 9. Canonical references retain obsolete unconditional module assumptions
|
||
|
||
**Priority:** P3. **Stage:** 15.
|
||
|
||
**Relevant documentation:** [configuration](../config.md), the paragraphs
|
||
describing the standard `check`/`publish` suite and the final component of a
|
||
`ci-deliver` tag; and [the internal inventory](../internal/overview.md), the
|
||
candidate, release-identity, and version-contract responsibility descriptions.
|
||
|
||
The configuration reference still says `check` and `publish` run a Go suite
|
||
unconditionally and that a `ci-deliver` tag ends in a stable semantic version.
|
||
Other sections correctly describe source-only and calendar behavior, and the
|
||
implementation also accepts diagnostic tags. The inventory still describes
|
||
general identity/version packages as semantic/stable-version-only components.
|
||
|
||
These contradictions leave consumer and implementation guidance short of the
|
||
Stage 15 target and can be read as restrictions on the newly supported source
|
||
release formats and repositories.
|
||
|
||
**Recommended remediation:** qualify Go execution by selected capability,
|
||
describe production tag components through the selected format, link diagnostic
|
||
dispatch to its separate identity contract, and refresh the affected package
|
||
descriptions. Keep the intentionally SemVer-based policy for releases of
|
||
ReleaseKit itself unchanged.
|
||
|
||
**Verification:** compare the revised references with existing source-only,
|
||
calendar, and diagnostic fixtures; review local links and prose whitespace.
|
||
|
||
## 10. Diagnostic dispatch intercepts valid production tag prefixes
|
||
|
||
**Priority:** P2. **Stages:** 2, 4, 11, 14.
|
||
|
||
**Relevant code:** `runCIDelivery` in the
|
||
[CLI dispatcher](../../cmd/releasekit/main.go), `runDiagnosticDelivery` in
|
||
[diagnostic delivery](../../cmd/releasekit/diagnostic.go), and the diagnostic
|
||
branches in the [maintained selector](../../examples/multi-module/select-module.sh)
|
||
and [single-product workflow](../../examples/woodpecker/tag-delivery.yml).
|
||
|
||
Production identity permits valid physical source directories and product tag
|
||
prefixes beneath `releasekit-test`. For example, a source profile with
|
||
`source.tag_prefix: "releasekit-test/product"` and date versions resolves the
|
||
production tag `releasekit-test/product/2026-12-01`. Candidate checking accepts
|
||
that selection and its ordinary release note. A second probe reproduced the
|
||
same dispatch failure for a legacy nested Go module producing
|
||
`releasekit-test/product/v1.2.3`.
|
||
|
||
The new CI dispatcher classifies every tag starting with `releasekit-test/` as
|
||
diagnostic, before loading its production selection. An annotated production
|
||
tag from the example therefore fails with `diagnostic annotation has an invalid
|
||
marker` instead of reaching ordinary delivery. The maintained selector makes
|
||
the same prefix-only choice and rejects the tag as an invalid diagnostic
|
||
attempt, even when a production mapping row matches it. This introduces a
|
||
restriction that the production resolver and configuration contract do not
|
||
establish. Single-product workflow guards also classify this entire prefix as
|
||
diagnostic and can reject a production prefix as an unknown selector before
|
||
bootstrap.
|
||
|
||
**Recommended remediation:** distinguish diagnostic refs by their complete
|
||
selected spelling, including the selector and 32-character lowercase hexadecimal
|
||
attempt component, and apply consistent classification in CLI and bootstrap
|
||
dispatch. Production identifiers contain version separators and can be
|
||
distinguished from diagnostic attempt IDs. Route production refs through their
|
||
production selection; retain full manifest/profile verification before
|
||
diagnostic effects. This can preserve existing production prefixes without
|
||
introducing a reserved-prefix prohibition.
|
||
|
||
**Regression coverage:** a source-only calendar production tag with this
|
||
prefix, a legacy nested module production tag, and their normal selector/CI
|
||
delivery paths. Retain valid diagnostic dispatch and malformed/foreign manifest
|
||
rejection. Assert that production identity and CI routing agree.
|
||
|
||
## 11. Readiness treats supported Go package patterns as literal directories
|
||
|
||
**Priority:** P2. **Stages:** 7, 12.
|
||
|
||
**Relevant code:** `inspectBuild` and `localMainPackage` in
|
||
[working readiness](../../internal/readiness/readiness.go),
|
||
`inspectCommittedBuild` in
|
||
[committed readiness](../../internal/readiness/committed.go), and the existing
|
||
[builder](../../internal/build/build.go), which passes `MainPackage` to Go.
|
||
[`Start`](../../internal/rehearsal/coordinator.go) runs committed readiness
|
||
before recording or dispatching a rehearsal.
|
||
|
||
The builder accepts Go package patterns when Go resolves them to one main
|
||
package. A local fixture with `build.main_package: "./..."`, one root main
|
||
package, and a native target built and passed its version smoke check through
|
||
the existing CLI. Offline build readiness then failed the same configuration
|
||
with `stat <source>/...: no such file or directory` and status 2.
|
||
|
||
Readiness recognizes the leading `./` as a local package directory and treats
|
||
the pattern literally. Module-qualified patterns take the same path after
|
||
conversion to a relative spelling. Committed readiness likewise resolves the
|
||
pattern as a literal destination, so the mandatory rehearsal preflight prevents
|
||
these otherwise buildable profiles from reaching their existing CI build path.
|
||
|
||
**Recommended remediation:** distinguish literal package-directory inputs from
|
||
package patterns before filesystem or committed-tree inspection. Preserve the
|
||
builder's existing accepted inputs. For patterns that require Go resolution,
|
||
report that resolution/build execution remains unchecked, consistently with
|
||
other inputs requiring execution, or resolve them through a shared offline
|
||
inspection path. Keep readily inspectable literal-directory checks and the
|
||
selected boundary against builds or dependency downloads during readiness.
|
||
|
||
**Regression coverage:** successful working and committed readiness for a
|
||
single-main `./...` fixture and a module-qualified equivalent, plus rehearsal
|
||
preflight reaching dispatch with that profile. Pair at least one case with an
|
||
actual shared-builder success. Retain failures for missing literal directories
|
||
and keep pattern-resolution limits explicit rather than certifying a future
|
||
build.
|
||
|
||
## 12. CI run bookkeeping performs quadratic membership scans
|
||
|
||
**Priority:** P3. **Stages:** 12, 13.
|
||
|
||
**Relevant code:** `observe` and `containsID` in the
|
||
[rehearsal coordinator](../../internal/rehearsal/coordinator.go), and
|
||
`quiescent` in [cleanup](../../internal/rehearsal/cleanup.go).
|
||
|
||
Each pass iterates matching pipelines and calls `containsID` on the growing
|
||
`attempt.PipelineIDs` slice. With `R` distinct runs and no recorded IDs, a
|
||
complete pass makes `R(R-1)/2` unsuccessful ID comparisons while inserting
|
||
them. A complete subsequent pass over the same recorded runs makes
|
||
`R(R+1)/2` comparisons. Thus local membership
|
||
bookkeeping takes O(R²) time per observation or quiescence pass, independently
|
||
of the required linear API traversal and workflow inspection. Repeated polling
|
||
repeats this cost; reruns increase `R` for the same saved attempt.
|
||
|
||
**Recommended remediation:** build a transient map from recorded pipeline ID
|
||
to its recorded number once per operation, update it as new runs are observed,
|
||
and use it for membership checks. Rebuild it from the saved slices on recovery.
|
||
Keep the slices as the ordered encoded evidence and preserve ID/number
|
||
consistency checks. Expected membership work becomes O(R) per pass with O(R)
|
||
additional indexing space; the overall evidence already occupies O(R) space.
|
||
This change preserves complete matching-run observation and the selected
|
||
cleanup quiescence rules.
|
||
|
||
**Regression coverage:** initial and repeated observations of several paginated
|
||
runs, newly discovered reruns, ordered ID/number evidence after recovery, and
|
||
missing or mismatched previously observed runs. Preserve existing active-run
|
||
and deletion guards. Verify the loop uses indexed membership; elapsed-time
|
||
thresholds are unnecessary.
|
||
|
||
## 13. Package readiness enumerates more metadata than its check needs
|
||
|
||
**Priority:** P3. **Stages:** 7, 12.
|
||
|
||
**Relevant code:** `inspectCommittedBuild` in
|
||
[committed readiness](../../internal/readiness/committed.go),
|
||
[`git.ReadTree`](../../internal/git/source.go), and `inspectBuild` in
|
||
[working readiness](../../internal/readiness/readiness.go).
|
||
|
||
Both readers need to establish that the selected literal package directory
|
||
contains a readable non-test Go input. The current implementations do extra
|
||
work before they can return the first acceptable input:
|
||
|
||
- Committed readiness calls `git.ReadTree`, which runs recursive
|
||
`ls-tree -r --full-tree` for the entire commit, then filters entries by the
|
||
resolved package directory. For `N` repository entries and `G` immediate
|
||
package entries, metadata enumeration and allocation are O(N), even when
|
||
`G` stays small as unrelated repository content grows. This runs during
|
||
rehearsal preflight as well as committed input inspection.
|
||
- Working readiness uses `os.ReadDir(path)`. That helper reads all `G` entries
|
||
and sorts them before inspection, adding worst-case O(G log G) sorting and
|
||
O(G) metadata space. This existence/readability check requires neither a
|
||
complete sorted list nor a particular successful filename.
|
||
|
||
**Recommended remediation:** after resolving the committed directory, list
|
||
that directory's immediate entries through the Git boundary, using its tree
|
||
object or a literal directory selection. Preserve captured-commit and symlink
|
||
resolution semantics. Metadata work can then depend on O(G), plus the existing
|
||
path-resolution cost, instead of the entire repository. For working inputs,
|
||
iterate an open directory with batched `File.ReadDir` calls and stop on a
|
||
readable input; this gives O(G) worst-case scanning with bounded batch storage.
|
||
Actual source-blob reading costs are separate from these metadata bounds.
|
||
Coordinate this refactor with finding 11 so package patterns retain their
|
||
supported interpretation.
|
||
|
||
**Regression coverage:** root and nested literal packages, a small package
|
||
beside unrelated committed subtrees, readable and unreadable input candidates,
|
||
symlinked inputs, and no eligible Go files. Retain the tests that distinguish
|
||
committed inputs from a changed working checkout. Confirm scoped Git listing
|
||
and unsorted directory iteration by reviewing their respective boundaries;
|
||
no runtime threshold or public directory-size limit is needed.
|
||
|
||
## 14. Result parsing buffers ordinary log lines that it discards
|
||
|
||
**Priority:** P3. **Stages:** 11, 12.
|
||
|
||
**Relevant code:** `ReadResult` in the
|
||
[rehearsal result parser](../../internal/rehearsal/result.go).
|
||
|
||
The parser uses `bufio.Reader.ReadString('\n')` for every log line before
|
||
checking `ResultPrefix`. `ReadString` accumulates and copies all fragments of
|
||
an arbitrarily long line. An ordinary CI output line therefore requires memory
|
||
proportional to its entire length even though the parser immediately discards
|
||
it. The existing long/chunked-log test demonstrates that these lines are valid
|
||
inputs but does not constrain their buffering strategy.
|
||
|
||
For `L` bytes in the longest ordinary line and `E` bytes of retained or candidate
|
||
result evidence, peak parser storage includes O(L + E). Large single-line
|
||
diagnostics can dominate memory even when the actual rehearsal result is small.
|
||
Processing time is already linear in the total log bytes.
|
||
|
||
**Recommended remediation:** inspect the fixed prefix at each line start and
|
||
consume ordinary lines through reusable `ReadSlice` fragments, discarding them
|
||
as they arrive. Accumulate only candidate result lines for the existing JSON
|
||
decoder and canonical comparison. This reduces buffering to O(B + E), where
|
||
`B` is the reader buffer, while retaining linear processing time and support
|
||
for arbitrarily long result lines. Preserve framing across reads, final lines
|
||
without a newline, CRLF handling, identity checks, equivalent retransmission,
|
||
and conflicting-result rejection.
|
||
|
||
**Regression coverage:** retain the current long/chunked-log and result-conflict
|
||
cases; exercise long ordinary lines before and between results, partial prefixes
|
||
across reader fragments, and final unterminated lines. Review that discarded
|
||
fragments are not accumulated. This needs neither a new log-line limit nor
|
||
workload measurements.
|