Record implementation review findings
This commit is contained in:
349
docs/roadmap/remediation.md
Normal file
349
docs/roadmap/remediation.md
Normal file
@@ -0,0 +1,349 @@
|
||||
# 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.
|
||||
|
||||
### 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 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 |
|
||||
| 12 | Start, dispatch reconciliation, observation and partial results | 2, 3, 4, 7, 8 |
|
||||
| 13 | Quiescence, ownership checks, partial deletion, resume and cleanup | 4, 5, 7 |
|
||||
| 14 | CLI/configuration mapping, reporting, exit classes and maintained workflow dispatch | 1, 6, 7 |
|
||||
| 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
|
||||
|
||||
**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.
|
||||
Reference in New Issue
Block a user