Skip to content

update-shape.py: the no-shape refusal names the kind's manifest validator - #52

Merged
brettheap merged 1 commit into
mainfrom
fix/family-validator-remediation
Sep 5, 2026
Merged

brettheap merged 1 commit into
mainfrom
fix/family-validator-remediation

Conversation

@brettheap

@brettheap brettheap commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Lane: xfactory-1 (xFactory-1)
Claim: #48 (comment)

Closes #48

What

rewrite_manifest's update-manifest-no-shape refusal (raised when the root's
manifest has no shape: block) hard-coded its remediation to name
validate-manifest.py. On a FAMILY root that script does not exist — the
family validator is scripts/validate-family.py — so the remediation sent
the operator to the wrong tool. rewrite_manifest's docstring had the same
project-specific assumption baked in.

Fix shape chosen: an explicit manifest_validator: str attribute on Kind
(the "preferred shape" from the issue), rather than falling back to
kind.validators[-1]. Kind has exactly two construction sites
(PROJECT_KIND, FAMILY_KIND), so the attribute adds one argument to each
with no ripple elsewhere. It is set to "scripts/validate-manifest.py" for
PROJECT_KIND and "scripts/validate-family.py" for FAMILY_KIND, and the
refusal now reads f"Remediation: \{Path(kind.manifest_validator).name}`
requires one; add it, or re-scaffold."The docstring at the top ofrewrite_manifestnow reads "The two fields the kind's manifest validator checks, insideshape:`."

Changed lines: update-shape.py — the Kind.__init__ signature and both
Kind(...) construction call sites (PROJECT_KIND, FAMILY_KIND), the
rewrite_manifest docstring, and the update-manifest-no-shape remediation
string.

Tests

Added one test per kind, following the existing Refusal-assertion pattern
(run_script(UPDATE, "apply", …), then assert on returncode and
result.stderr) already used throughout tests/test_update_shape.py and
tests/test_family.py:

  • tests/test_update_shape.py::test_apply_with_no_shape_block_names_this_kinds_own_manifest_validator
    — on a PROJECT fixture with the shape: block stripped from project.yaml,
    apply refuses with code update-manifest-no-shape, the remediation names
    validate-manifest.py, and does not name validate-family.py.
  • tests/test_family.py::test_update_shape_with_no_shape_block_names_the_family_validator
    — the mirror case on a FAMILY fixture with shape: stripped from
    family.yaml: the remediation names validate-family.py and not
    validate-manifest.py.

Both also assert the refused apply left contracts/shape-pin.yaml untouched
(the established "a refused apply writes nothing at all" invariant). The
strip_shape_block helper lives in tests/test_update_shape.py and is
imported into tests/test_family.py, matching the existing cross-file import
precedent (test_neutral_pin_validator.py importing from
test_scaffold_pin_and_reuse.py).

Full suite: python3 -m pytest tests -q → 498 passed (496 baseline + 2
new tests).

🤖 Generated with Claude Code

https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T

Summary by Sourcery

Use each root kind’s own manifest validator when explaining how to fix manifests without a shape block.

Bug Fixes:

  • Report the correct kind-specific manifest validator in no-shape refusal remediation for project and family roots.

Enhancements:

  • Associate each root kind with its manifest validator and use that association in manifest documentation and refusal messages.

Tests:

  • Add project and family coverage confirming kind-specific validator names and that refused updates leave shape pins unchanged.

…ator

On a family root the "no `shape:` block" remediation sent the operator to
validate-manifest.py, which a family root does not carry; its validator
is validate-family.py. Kind now names its manifest validator and the
refusal (and rewrite_manifest's docstring) use it. Test: the refusal
names validate-family.py on a family root and validate-manifest.py on a
project root.

Closes #48

Lane: xFactory-1
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_015WekBEXf55Xv64psGe5t3T
Copilot AI lite review requested due to automatic review settings September 5, 2026 18:46

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 19 hours and 6 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR replaces the hard-coded no-shape remediation with an explicit validator configured per root kind, updates the related documentation, and adds project/family regression tests confirming correct messaging and refusal atomicity.

Sequence diagram for kind-specific no-shape refusal

sequenceDiagram
    actor Operator
    participant UpdateShape as update-shape.py
    participant Kind
    participant Manifest

    Operator->>UpdateShape: run_script(UPDATE, apply, ...)
    UpdateShape->>Kind: root_kind(root)
    UpdateShape->>Manifest: rewrite_manifest(text, commit, tree, kind)
    alt shape block absent
        Manifest-->>UpdateShape: Refusal(update-manifest-no-shape)
        UpdateShape-->>Operator: stderr names kind.manifest_validator
        UpdateShape-->>Operator: no files written
    end
Loading

File-Level Changes

Change Details Files
Make the manifest validator an explicit property of each root kind and use it when constructing no-shape remediation.
  • Add a required manifest_validator field to Kind.
  • Configure project and family kinds with their respective validator scripts.
  • Update rewrite_manifest documentation and derive the remediation filename from the selected kind.
update-shape.py
Add regression coverage ensuring each root directs operators to its own manifest validator without modifying files on refusal.
  • Add a shared helper to remove the manifest shape: block.
  • Test project remediation names validate-manifest.py and excludes the family validator.
  • Test family remediation names validate-family.py and excludes the project validator.
  • Verify the shape pin remains unchanged after each refused apply.
tests/test_update_shape.py
tests/test_family.py

Assessment against linked issues

Issue Objective Addressed Explanation
#48 Make the no-shape:-block remediation name the manifest validator actually used by the root kind, specifically validate-family.py for family roots and validate-manifest.py for project roots. ✅
#48 Remove the project-specific validate-manifest.py assumption from rewrite_manifest's documentation. ✅
#48 Add regression coverage verifying the correct remediation validator is reported for both family and project roots. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sonarqubecloud

sonarqubecloud Bot commented Sep 5, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is narrowly scoped, correct per the issue description, and is covered by new targeted tests for both root kinds.

Pull request overview

This PR fixes a misleading update-shape.py apply refusal remediation message when a root manifest lacks a shape: block by making the remediation name the correct kind-specific manifest validator (project vs family), and updates tests to lock in the behavior.

Changes:

  • Add an explicit manifest_validator attribute to Kind, set appropriately for PROJECT_KIND and FAMILY_KIND.
  • Update rewrite_manifest docstring and the update-manifest-no-shape refusal remediation to reference the kind’s validator name.
  • Add project and family tests asserting the correct validator is named and that a refused apply does not modify contracts/shape-pin.yaml.
File summaries
File Description
update-shape.py Adds Kind.manifest_validator and uses it for no-shape: remediation text and docstring wording.
tests/test_update_shape.py Adds a helper to strip shape: and a project-root test asserting remediation names validate-manifest.py.
tests/test_family.py Imports the shared helper and adds a family-root test asserting remediation names validate-family.py.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane xFactory-1, 2026-09-05T18:48:50Z) LANDED — squash e9c4827b on main 2026-09-05T18:48:38Z, on Brett Heap's word "merge it when green". Upstream tool only; no shape-estate re-sync owed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update-shape.py apply: the no-shape:-block remediation names validate-manifest.py on a FAMILY root (should be the kind's validator, validate-family.py)

2 participants