diff --git a/CURRENT-STATUS.md b/CURRENT-STATUS.md index 1b843315..33ce5a78 100644 --- a/CURRENT-STATUS.md +++ b/CURRENT-STATUS.md @@ -11,7 +11,7 @@ coordination branch. Detailed state belongs in each linked status file. |---|---|---|---|---|---| | `workflow-improvements` | 2026-08-09 | Improve the multiple-stream workflow from concrete dogfood findings during the recursive E2E cycle | active 2026-10-30; Pair Review Loop naming implemented and packaging verified for 0.3.0; mainline and release integration pending | `ws-workflow-improvements/v1` | [workstream status](engineering-docs/wip/2026-08-09-workflow-improvements/CURRENT-STATUS.md) | | `project-management` | 2026-08-09 | Maintain project-wide priorities, sequencing, dependencies, and lifecycle coordination | paused 2026-10-11 at owner direction; consent and forced configuration before RC work; remaining diagnostics/image scope and release cut decisions retained | `ws-project-management/coordination` | [workstream status](engineering-docs/wip/2026-08-09-project-management/CURRENT-STATUS.md) | -| `maintenance` | 2026-09-18 | Own the defects no open workstream covers, on `main` and on maintained release lines, and drive maintenance releases | active 2026-11-04; #335 merged; coverage-numbers slice, PR #336, awaits the owner's merge; 0.3.1 queue preserved | `ws-maintenance/coverage-in-pr`; `ws-maintenance/test-conventions` merged through #335 and closed; `release-0.3.0` closed and retained | [workstream status](engineering-docs/wip/2026-09-18-maintenance/CURRENT-STATUS.md) | +| `maintenance` | 2026-09-18 | Own the defects no open workstream covers, on `main` and on maintained release lines, and drive maintenance releases | active 2026-11-04; #335 and #336 merged; first legacy test move, PR #337, awaits the owner's merge; 0.3.1 queue preserved | `ws-maintenance/base-consent-test`; earlier slice branches merged and closed; `release-0.3.0` closed and retained | [workstream status](engineering-docs/wip/2026-09-18-maintenance/CURRENT-STATUS.md) | | `component-upgrades` | 2026-09-21 | Deliver component distribution channels, developer-owned version sets and proven upgrade rollback; Codex first | paused 2026-10-02; consent design ruled (D-0011 to D-0013), 0.2.16 consent slice next; R-UPGRADE-002 follow-up retained | `ws-component-upgrades/v1` | [workstream status](engineering-docs/wip/2026-09-21-component-upgrades/CURRENT-STATUS.md) | | `sample-projects` | 2026-08-14 | Provide realistic sample projects as submodules that demonstrate ordinary adopter development inside DevCapsule | integrating 2026-10-22; AI Learning published; PR #252 reviewed and ready for human merge | `ws-sample-projects/ai-learning` | [workstream status](engineering-docs/wip/2026-08-14-sample-projects/CURRENT-STATUS.md) | | `contained-display` | 2026-08-19 | Own the capsule supervisor core (container entry process, supervised children, explicit session end, headless mode) and the capsule's own display environment, closing the host-session credential exposure — supervisor first, display as its first consumer | active; **the contained display shipped in v0.2.12 on 2026-09-14** (recipe-9 base, contained desktop by default, X11 passthrough behind `host-x11`); the X11 credential bug is resolved; remaining threads are records and follow-ups (reconnect, WSL2 opener, sample locks) | `ws-contained-display/display-transport` | [workstream status](engineering-docs/wip/2026-08-19-contained-display/CURRENT-STATUS.md) | diff --git a/devcapsule-src/devcapsule/configuration/authorization.py b/devcapsule-src/devcapsule/configuration/authorization.py index 2d4f4845..3927bfaf 100644 --- a/devcapsule-src/devcapsule/configuration/authorization.py +++ b/devcapsule-src/devcapsule/configuration/authorization.py @@ -12,6 +12,19 @@ from .file_formats import AuthorizationScalar, ProjectConfigurationError, canonical_digest from .trust import BASE_CHANNEL, Channel, HomeTrust, channels_for +__all__ = [ + # The catalog of decisions a checkout carries, and its review. + "AuthorizationDeclaration", "AuthorizationChoice", "AuthorizationReview", "AuthorizedBaseSelection", + "authorization_declarations", "authorization_deny_value", "base_recovery_choices", + "review_authorizations", "resolved_checkout_authorizations", + "normalize_authorization_value", "render_authorization_value", + # What the platform lock says about the base, validated. + "immutable_registry_reference", "locked_base_reference", "locked_base_contract", "locked_base_build_mnemonic", + "authorized_base_selection", "authorized_base_reference", + # The curated V1 vocabularies. + "CURATED_HOST_RECOMMENDATIONS", "HOME_CAPABILITY_DEFAULTS", +] + OCI_REPOSITORY_COMPONENT_PATTERN = re.compile(r"^[a-z0-9]+(?:[._-][a-z0-9]+)*$") diff --git a/devcapsule-src/tests/test_base_contract.py b/devcapsule-src/tests/test_base_contract.py index 999d0c79..8ed112a5 100644 --- a/devcapsule-src/tests/test_base_contract.py +++ b/devcapsule-src/tests/test_base_contract.py @@ -119,16 +119,6 @@ def test_image_is_reconstructed_from_its_labels() -> None: BaseImage.from_labels("sha256:none", {}) -def test_consent_names_the_contract_and_the_recipe_source() -> None: - manifest = tomllib.loads(REPO_MANIFEST.read_text(encoding="utf-8")) - lock = tomllib.loads(REPO_LOCK.read_text(encoding="utf-8")) - declaration = authorization_declarations(manifest, lock)["base-image"] - assert declaration.description.startswith("Execute base ubuntu-24.04@11 at docker.io/") - assert "built by v0.3.0-rc6" in declaration.description - assert f"{REPOSITORY}/blob/v0.3.0-rc6/{RECIPE_SOURCE_PATH}" in declaration.description - assert declaration.display_value is not None and declaration.display_value.startswith("ubuntu-24.04@11 — ") - - def test_compatibility_report_names_the_rule_and_the_evidence() -> None: lock = tomllib.loads(REPO_LOCK.read_text(encoding="utf-8")) report = compatibility_report(lock) diff --git a/devcapsule-src/tests/unit/devcapsule/__init__.py b/devcapsule-src/tests/unit/devcapsule/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/devcapsule-src/tests/unit/devcapsule/configuration/__init__.py b/devcapsule-src/tests/unit/devcapsule/configuration/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/devcapsule-src/tests/unit/devcapsule/configuration/test_authorization.py b/devcapsule-src/tests/unit/devcapsule/configuration/test_authorization.py new file mode 100644 index 00000000..92f49bda --- /dev/null +++ b/devcapsule-src/tests/unit/devcapsule/configuration/test_authorization.py @@ -0,0 +1,69 @@ +"""Unit tests of ``devcapsule.configuration.authorization``: the decisions a checkout carries. + +Every lock here is built by the test. The base-image declaration is derived +from the lock, so each expected value is computed from the inputs the test +chose, never read from a run or from this repository's own lock. +""" +from __future__ import annotations + +from typing import Any + +from devcapsule.configuration.authorization import authorization_declarations +from devcapsule.configuration.file_formats import canonical_digest +from devcapsule.images.contract import LEGACY_RECIPE_SOURCE_PATH, RECIPE_SOURCE_PATH, REPOSITORY + +REFERENCE = "registry.example.test/devcapsule/base@sha256:" + "ab" * 32 +"""A digest-pinned reference, as a committed lock must carry.""" + + +def _lock(**base: Any) -> dict[str, Any]: + """A platform lock whose only content is the given base table.""" + return {"base": {"reference": REFERENCE, **base}, "components": {}} + + +def test_the_base_declaration_names_the_contract_the_reference_and_the_builders_recipe() -> None: + """Precondition: a lock recording the base's contract, build mnemonic and recipe source. + Action: build the declarations. Postcondition: the base-image declaration asks to + execute that contract at that reference, credits the builder, links the recipe at the + builder's tag, recommends the reference and digests this very lock.""" + lock = _lock(contract="ubuntu-24.04@11", **{"build-mnemonic": "v9.9.9-test", "recipe-source": RECIPE_SOURCE_PATH}) + + declaration = authorization_declarations({}, lock)["base-image"] + + assert declaration.description == ( + f"Execute base ubuntu-24.04@11 at {REFERENCE}, built by v9.9.9-test; " + f"recipe source: {REPOSITORY}/blob/v9.9.9-test/{RECIPE_SOURCE_PATH}." + ) + assert declaration.display_value == f"ubuntu-24.04@11 \u2014 {REFERENCE}" + assert declaration.recommended_value == REFERENCE + assert declaration.recommendation_digest == canonical_digest(lock) + + +def test_a_lock_without_a_builder_declares_the_contract_and_no_provenance() -> None: + """Precondition: a lock with the contract but no build mnemonic. Action: build the + declarations. Postcondition: the description is the contract at the reference and + nothing more, and the display value still shows the contract.""" + declaration = authorization_declarations({}, _lock(contract="ubuntu-24.04@11"))["base-image"] + + assert declaration.description == f"Execute base ubuntu-24.04@11 at {REFERENCE}." + assert declaration.display_value == f"ubuntu-24.04@11 \u2014 {REFERENCE}" + + +def test_a_lock_written_before_contracts_is_described_by_its_builder_and_the_legacy_recipe() -> None: + """Precondition: a lock with a build mnemonic but neither contract nor recipe source, + as locks predating recorded contracts are. Action: build the declarations. + Postcondition: the base is described as selected by the lock, credited to the builder, + with the recipe linked at its legacy path, and the display value shows the builder.""" + declaration = authorization_declarations({}, _lock(**{"build-mnemonic": "v0.2.7"}))["base-image"] + + assert declaration.description == ( + f"Execute the base at {REFERENCE}, selected by the platform lock, built by v0.2.7; " + f"recipe source: {REPOSITORY}/blob/v0.2.7/{LEGACY_RECIPE_SOURCE_PATH}." + ) + assert declaration.display_value == f"v0.2.7 \u2014 {REFERENCE}" + + +def test_a_lock_without_a_base_declares_no_base_image_decision() -> None: + """Precondition: a lock with no base table. Action: build the declarations. + Postcondition: there is no base-image declaration to answer.""" + assert "base-image" not in authorization_declarations({}, {"components": {}}) diff --git a/engineering-docs/wip/2026-09-18-maintenance/CURRENT-STATUS.md b/engineering-docs/wip/2026-09-18-maintenance/CURRENT-STATUS.md index d4d4ed18..9245b40f 100644 --- a/engineering-docs/wip/2026-09-18-maintenance/CURRENT-STATUS.md +++ b/engineering-docs/wip/2026-09-18-maintenance/CURRENT-STATUS.md @@ -4,7 +4,7 @@ Mnemonic: `maintenance` Start date: 2026-09-18 -State: active 2026-11-04; PR #335 merged at 650e2be3; coverage-numbers slice delivered for the owner's merge; 0.3.1 queue preserved +State: active 2026-11-04; #335 and #336 merged; first legacy test moved under the new rule, delivered for the owner's merge; 0.3.1 queue preserved Definition read: WORKFLOW.md@d2ccbbe43dfa, WORKFLOW-LOCAL.md@65501b3407db @@ -12,10 +12,27 @@ Integration target: `main` Delivery method: ordinary maintenance PRs to `main`; owner merges. No records-only PR. The 0.3.0 release is published; website production promotion remains owner-operated. -Branch association: `ws-maintenance/coverage-in-pr` from main 650e2be3; `ws-maintenance/test-conventions` merged through #335 and closed; `ws-maintenance/0.3.1-preparation` from main 31d44fa4; `release-0.3.0` closed after final publication and retained with its tags; `ws-maintenance/0.3.0-acceptance` merged through #332 and closed; earlier slice branches are historical +Branch association: `ws-maintenance/base-consent-test` from main 445469f1; `ws-maintenance/coverage-in-pr` merged through #336 and closed; `ws-maintenance/test-conventions` merged through #335 and closed; `ws-maintenance/0.3.1-preparation` from main 31d44fa4; `release-0.3.0` closed after final publication and retained with its tags; `ws-maintenance/0.3.0-acceptance` merged through #332 and closed; earlier slice branches are historical Requirements: `R-PRODUCT-006`, `R-COMPAT-001`, `R-PRODUCT-002`, `R-CONSOLE-001` +## The first legacy test moves — 2026-11-04 + +The owner had marked `test_consent_names_the_contract_and_the_recipe_source` +expected-to-fail with a note to rewrite or eliminate it, the rc6 string pin +dissected on 2026-11-03. Under *Unit Tests* rule 5 the fix is the move: the +test leaves `tests/test_base_contract.py`, and its unit, +`devcapsule.configuration.authorization`, gains the mirror file +`tests/unit/devcapsule/configuration/test_authorization.py` with four +triples over constructed locks: the full declaration with contract, builder +and recipe permalink; a lock without a builder; a lock predating recorded +contracts with the legacy recipe path; a lock without a base. Every expected +value is derived from the lock the test built. Rule 4 applies to the unit: +the module now declares `__all__`. Checker: 110 legacy files, 1523 tests, +4 files follow the convention, 0 breaches. Delivered as +[PR #337](https://github.com/ccozianu/devcapsule/pull/337). The xfail stays uncommitted in +the owner's checkout until this merges and is dropped at the next sync. + ## Coverage numbers in the pull request — 2026-11-04 The owner merged #335 at 650e2be3 and asked for the next slice from the