Files
narratio/docs/roadmap/remediation.md

106 lines
5.8 KiB
Markdown

# Review remediation
Reviewed all ten implementation stages against committed baseline
`f04b6097b879bfa96cf188858988141c81933c77` and the agreed feature roadmap.
Also reviewed all seven ReleaseKit adoption stages against
`c893e1086a8ebf649b37723c7ddf9a8035f74c8d`. Item 1 records the configured-startup
finding and item 2 the ReleaseKit finding. Both findings are completed.
## 1. Make the pure-loader regression test detect accidental bootstrap
Status: completed. Priority: P2. Implementation stages: 2 and 6.
Completion: the test registers restoration of the original environment state,
unsets the variable, and uses `LookupEnv` to verify that pure loading leaves it
absent. Explicit bootstrap provides a positive control before the retained
prepared-source handoff assertions. The focused test passes normally and fails
at the purity assertion with bootstrap inserted through a temporary build
overlay. Full tests and configuration-package race tests pass. Production
loading behavior is unchanged.
Location: [pipeline_discovery_test.go](../../internal/config/pipeline_discovery_test.go#L99),
`TestPipelineSourceRetainsPreparedMainAndPureLoading`.
The original test set its credential variable to an empty string before calling
the ordinary library loader. ConfigKit's default bootstrap preserves existing
variables, including empty ones. Consequently, the environment assertion still
passed with bootstrap accidentally introduced into `LoadPipelineWithOptions`.
This was the only configuration-package test declaring a secrets directory, so
the intended guard against library-owned environment mutation was ineffective.
Confirmed with a temporary Go build overlay that inserted an actual
`LoadSecretsIntoEnvironmentFromConfig` call into `LoadPipelineWithOptions`:
the named regression test still passed. Repository source files were unchanged
by that diagnostic check. The production loader currently has the correct
pure-loading implementation; this finding concerns its regression coverage.
Required change: restore the test variable's original state during cleanup,
start the pure-loading assertion with the variable genuinely unset, and check
that it remains unset after loading. Keep the subsequent prepared-source
handoff check; an explicit native bootstrap can serve as a positive control that
the fixture would actually populate the variable. No production bootstrap or
loader behavior change is needed.
Validation: the focused test passes against current production code and fails
when an accidental bootstrap call is temporarily inserted via a scratch overlay.
Keep this as a small behavioral test rather than adding a permanent mutation-test
framework or retesting ConfigKit's complete secrets policy.
## 2. Allow literal environment values in workflow inspection tests
Status: completed. Priority: P2. Implementation stage: 4.
Completion: the test-only environment mapping now retains native values, and the
release wiring assertion inspects only the required token's `from_secret`.
Both workflow-step fixtures cover string/numeric literals alongside a secret
reference. The regression failed before the fix and passes afterward. A scratch
workflow with added literals passes; changing its required secret name still
fails the specific delivery assertion. Full tests and doccheck race tests pass.
Production code and CI configuration are unchanged.
Location: [doccheck_test.go](../../internal/doccheck/doccheck_test.go#L342),
`woodpeckerStep.Environment` and `TestReleaseWorkflowDelivery`.
The original test-only workflow model decoded every environment value into a
struct containing `from_secret`. Woodpecker also supports ordinary literal environment
values, as documented in its
[environment reference](https://woodpecker-ci.org/docs/usage/environment).
Consequently, adding a valid setting such as
`GOCACHE: /tmp/narratio-go-cache` made both
`TestWoodpeckerWorkflowDependencies` and `TestReleaseWorkflowDelivery` fail during
YAML decoding. This affected all workflows inspected by the shared helper, not
just the required release-token mapping. Before this change, unrelated
environment fields were ignored.
Reproduced in a disposable clone by adding only that literal under the release
step's `environment`. Both tests fail with `cannot unmarshal !!str ... into
struct { FromSecret string ... }`; the same focused tests pass on the unchanged
candidate. No production or workflow files in Narratio were changed by this
diagnostic.
This unintentionally strengthened the CI configuration contract: every inspected
environment value had to have an object shape compatible with a secret
reference, even though only the `RELEASEKIT_GITEA_TOKEN` mapping requires
inspection. The checked-in workflow worked, but normal CI configuration
changes could unnecessarily block the default suite and native release
validation.
Required change: retain environment values in a form that accepts native literal
and secret-reference values, such as YAML nodes or a small generic mapping.
Inspect the required token's `from_secret` separately. Keep general dependency
checks independent of unrelated environment contents; a general Woodpecker
schema or validator is unnecessary.
Validation: add focused coverage for mapping-shaped and sequence-shaped steps
containing both a literal value and a secret reference. Ordinary literal values
must decode successfully, while an incorrect required release-token mapping
must still fail its specific wiring assertion. Run `go test ./internal/doccheck`.
The review otherwise found the dependency, version accessor, profile, launcher,
native delivery template, removals, policy, and runbook aligned with the target.
The full race-enabled suite, vet, build, and tidy-diff checks passed. Native
ReleaseKit built all three declared binaries at the reviewed commit with Go
1.27.4 and passed its injected-version smoke check. No source tag, upstream push,
or live hosted delivery was attempted.