Repository navigation
generate: require Debian codename, strict Debian incremental restore; map Plan 0007 R1–R5 - #67
Merged
Merged
Conversation
… map Plan 0007 R1–R5 Finish core Plan 0007's R1–R5 in repogen. Most of it already landed in #62/#64/#66. This closes the remaining gaps: the generic `--codename stable` default, the Debian incremental restore fallbacks, and a README map from each R item to its code and tests. Work-item: w-request-r-20261002-ac50b8 Reviewed-by: github-copilot/gpt-6-sol
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Merged
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Finish core Plan 0007's R1–R5 in repogen. Most of it already landed in #62/#64/#66. This closes the remaining gaps: the generic
--codename stabledefault, the Debian incremental restore fallbacks, and a README map from each R item to its code and tests.Reviewed by github-copilot/gpt-6-sol.
Review
approve after 1 round: Both prior blockers are resolved: invalid or negative Size now fails parsing, and Lstat catches dangling index symlinks. The decoded-byte comparison and new tests support the stated strict-restore behavior. No owner/person process narration was found in changed documents. Package and CLI tests and go vet passed; the full local suite could not complete because integration tests need to write under a read-only workspace. Host checks do not establish that the PR CI is green; a passing PR workflow run is still needed for that acceptance criterion.
Approved plan
Repogen R1–R5 completion Implementation Plan
Goal: Every R1–R5 item of core Plan 0007 (https://github.com/frostyard/core/blob/main/docs/plans/0007-support-suites-in-repogen.md, table lines 172–176) is implemented and tested in repogen, or is explicitly mapped to existing code and tests.
Architecture: Repogen ADR-0013 already splits generic
generatefrom a strict production path (validate-production,internal/generator/deb/production_restore.go,pool.go,production_transaction.go,internal/objectstore/r2,reconcile-production, which accepts onlytrixie). This change closes the last two code gaps, both in the generic Debian path that Plan 0007 names (internal/cli/generate.go,internal/generator/deb/parser.go), and adds a README map.Tech Stack: Go, cobra, logrus.
Verification:
git diff --check,sh -c 'test -z "$(git ls-files "*.go" | xargs -r gofmt -l)"',go test ./...,go vet ./...Global Constraints
generatecommand able to emit arbitrary codenames for non-Frostyard use (ADR-0013). Production strictness stays in the production path.Assumptions
validate-production,internal/cli/production.gorejectsstable); R3 strict signed restore and explicit initialize; R4 digest-aware conditional-create pool; R5 transaction, R2 adapter and read-back. The evidence is at 841aa82, wherego test ./...passes.generate --codenamedefaults tostable. Fix: remove the default, and when Debian packages are scanned, require an explicit--codename. A non-empty--suitemust equal--codename. Genericgeneratestill allows a localstablecodename, because it cannot reach R2 (publish-to-r2 refuses deb and thestablesuite since publish-to-r2: refuse the stable suite and drop the implicit stable default #66; reconcile-production accepts only trixie). If the approver wants genericgenerateto refusestablefor Debian too, that is a one-line addition in Task 1.generatefalls back to a non-incremental run (dropping existing packages) on any parse error, and debParseExistingMetadataskips an arch whose Packages/Packages.gz is corrupt. Fix, Debian only: fall back only when no metadata exists at all. Fail when an index exists but is unreadable, when one arch is good and another is corrupt, and when a stanza is malformed.validate-production --operation initialize|reconcile). Generic incremental stays unsigned-capable, per ADR-0013.Review Focus
generategiven only sysext/rpm input and no--codename: must succeed as before. Test in Task 1.generategiven a .deb and no--codename: must fail before the output dir is created. Test in Task 1.Task 1: R2 – no implicit codename for Debian in generic generate
Files:
internal/cli/generate.go(flag at line 66;validateConfiglines 88–124)internal/cli/generate_test.goInterfaces: Produces
validateConfigbehaviour only. No new exported names.internal/cli/generate_test.go:TestGenerateDebianRequiresExplicitCodename: copy a fixture .deb fromtest/fixturesinto a temp input dir (find one withls test/fixtures; if none exists, build one the waytest/integration_test.godoes). RunNewGenerateCmd()with only--input-dir/--output-dir. Expect an error containing--codename is required for Debian, and expect the output dir not to exist.TestGenerateDebianRejectsSuiteDifferentFromCodename:--codename trixie --suite stablegives an error containing--suite must equal --codename.TestGenerateSysextNeedsNoCodename: a sysext.rawinput (as in the existing sysext test) with--base-urland no--codenamesucceeds.go test ./internal/cli -run 'TestGenerate(Debian|SysextNeeds)'. Expect the Debian tests to FAIL."", with help text "Codename for Debian repos (required when Debian packages are present)". AddhasDebianPackages(inputDir string) (bool, error), which scans withscanner.NewFileSystemScanner().Scan(context.Background(), inputDir)and checks forscanner.TypeDeb(use the scanner's real type constant). InvalidateConfig, when Debian packages are present: trim spaces; an empty codename returnsRepoGenError{Type: models.ErrInvalidConfig, Err: fmt.Errorf("--codename is required for Debian repositories")}. Keep the existing behaviour that an empty suite becomes the codename; otherwise, if suite != codename, return--suite must equal --codename. Do this before any output is written.generatewithout--codename. Grep forNewGenerateCmdand"generate"ininternal/andtest/;test/integration_test.goalready passes--codename testing. Rungo test ./.... Expect PASS.Task 2: R3 – strict Debian incremental restore
Files:
internal/generator/deb/parser.go:235-369,internal/cli/generate.go:236-245,internal/generator/generator.go(sentinel)internal/generator/deb/parser_test.go(create),internal/cli/generate_test.goInterfaces: Produces
var ErrNoExistingMetadata = errors.New("no existing repository metadata")in packagegenerator. DebParseExistingMetadatawraps it (fmt.Errorf("...: %w", generator.ErrNoExistingMetadata)) only when no Packages or Packages.gz exists for any arch/component. Check for an import cycle first: deb imports generator? Ifgeneratorimportsdeb, put the sentinel ininternal/models/errors.goasmodels.ErrNoExistingMetadatainstead and use it consistently.parser_test.go:errors.Ismatches to the sentinel;Packagesholdsgarbage without colon\n\nwhile all is valid: the error namesbinary-amd64and is NOT the sentinel;FilenameorSHA256errors.go test ./internal/generator/deb -run ParseExisting. Expect FAIL.os.StatPackages and then Packages.gz. If neither exists, skip that arch. If one exists, any parse error returnsfmt.Errorf("parse %s: %w", path, err). If no index file is found anywhere, return the sentinel. InparsePackagesReader, inside a stanza, a non-empty line that is notKey: valueand not a continuation line (leading space/tab) is an error. At stanza end, a stanza missing Package, Version, Architecture, Filename or SHA256 is an error.generate.go, forpkgType == scanner.TypeDeb, fall back to non-incremental only whenerrors.Is(err, <sentinel>). Any other error returnsRepoGenError{Type: models.ErrPackageParse, Err: fmt.Errorf("incremental deb restore: %w", err)}before any output is written. Leave non-deb types exactly as they are.TestGenerateIncrementalDebianFailsOnCorruptArchWithoutMutationininternal/cli/generate_test.go: generate a deb repo with--codename testing --arch all,amd64, snapshot the tree (with the existingsnapshotGenerateTreehelper), corruptdists/testing/main/binary-amd64/Packagesand re-snapshot, rerun with--incremental, and expect an error and the tree unchanged. AddTestGenerateIncrementalDebianInitializesEmptyOutput, which expects success.go test ./.... Expect PASS.Task 3: R1 – document the canary subset and the evidence map
Files: Modify
README.md(the "Frostyard Production Validation" section, lines ~70–215), anddocs/specs/production-r2-reconciliation.mdonly if a link is needed.Step 1: At the top of that README section, add a subsection "Plan 0007 canary subset (R1–R5)". It states: core ADR-0048 and Plan 0007 govern; R1–R5 alone gate the single trixie canary, and R6–R10 gate closure expansion; one codename per transaction; component
mainonly; shared immutablepool/main; fixed Origin/Label; noValid-Until(asserted inproduction_restore.goand the transaction tests); strict reconcile versus explicit initialize; the Debian publisher is separate from sysext and the composite action. It says the canary is not yet published and needs separate authorization.Step 2: Add a table with columns item | code | tests:
docs/org-adrs.md.internal/cli/production.go,internal/production/config.go, generic codename requirement /TestValidateProductionCommandRejectsInputBeforeOutputMutation,TestValidateProductionDebianPackage,TestGenerateDebianRequiresExplicitCodename.production_restore.go,parser.go/TestRestoreProductionStateFailsClosedWithoutChangingPriorBytes,TestVerifyProductionInitializationRequiresAuthoritativeAbsence,TestValidateProductionInitializeRequiresAbsentTarget, the Task 2 tests.pool.go,internal/utils/package_identity.go/ theTestSharedPoolFakeS3*tests (ETag ignored, conditional create, collision fails).production_transaction.go,internal/objectstore/r2,reconcile_production.go/TestProductionTransactionPublishesScopedObjectsWithInReleaseLast,TestProductionTransactionFailureInjectionNeverExposesIncompleteGeneration,TestProductionTransactionPreservesStableTreeByteForByte,TestProductionTransactionRealGPGVAndAPTFixture,TestPublicationStoreRejectsEveryOutOfScopePathBeforeIO.stablerejection, reconcile-production being trixie-only, andscripts/validate-publish-target.sh(publish-to-r2: refuse the stable suite and drop the implicit stable default #66).Before listing any test name, check that it exists with
grep -rn "func <Name>" internal.Step 3: Correct any README text that says
generatedefaults tostable, or that it falls back silently.Step 4: Run the verification commands from the header, plus
node scripts/check-docs.mjsif that script exists.PR summary must state
generate.go/parser.go, but signed verification and initialize live in the production path.Plan approved by owner:odrade (standing grant approve-plans in lucilla).
Work item: w-request-r-20261002-ac50b8