Skip to content

Report a Malformed Registry Entry Rather Than Raise in Validate - #3941

Merged
ptr727 merged 3 commits into
developfrom
feature/validate-skip-malformed-secret-plan
Nov 8, 2026
Merged

ptr727 merged 3 commits into
developfrom
feature/validate-skip-malformed-secret-plan

Conversation

@ptr727

@ptr727 ptr727 commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Summary

spec/validate.py no longer raises on a malformed registry entry before it can report it. CodeRabbit raised this on the #3937 promotion.

  • secret_scope_errors passes a cataloged entry whose name cannot form a repository name field to secret_names.secret_plan. When that entry's requiredSecrets or publish was malformed, the plan raised TypeError or AttributeError. The validator then printed a traceback rather than the defect the per-entry checks had already listed. Such an entry is now skipped, and the skip reuses is_str_list.
  • The per-entry loop in main iterated publish bare, so a null or a number there raised before any error printed. It is now reported as publish must be an array of publish entries.

Verification

  • New tests cover each shape the skip drops on a dotted name: a null and a nested requiredSecrets, and a null and a non-object publish. A main-driven test covers a null and a numeric publish, and it fails without the guard.
  • The full suite passes, 3752 tests with 11 skipped. ruff, mypy, the prose gate and spec/validate.py are clean.
  • Three recorded local passes ran. The first two found an unguarded sibling site, a restated helper and untested guards, all fixed here. The third was clean.

🤖 Generated with Claude Code

ptr727 and others added 3 commits November 8, 2026 12:42
secret_scope_errors passed a dotted cataloged entry to secret_plan even
when its requiredSecrets or publish was malformed. The plan reads both
fields bare, so validate raised instead of listing the defect the
per-entry checks had already reported. Such an entry is now skipped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The per-entry loop iterated a registry entry's publish bare, so a null
or a number raised before any error printed. It is now reported as its
own error. The secret-scope skip reuses is_str_list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The dotted-entry subtests now also run a nested requiredSecrets element
and a null publish, so each skip guard is exercised.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727 ptr727 added bug Something isn't working script A defect in hub tooling comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses labels Nov 8, 2026
Copilot AI lite review requested due to automatic review settings November 8, 2026 20:56
@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ptr727

ptr727 commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 97f8f3834f79a959d9536752e4d74715cd3779a0, the content this pull request carries at that commit against develop, and it recorded 0 findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

An active moderate issue remains because unhashable publish targets can trigger a TypeError instead of being reported as malformed, requiring validation before planning and a regression test.

1 open issue
What changed in this PR

This pull request hardens registry validation so malformed requiredSecrets and publish declarations are reported instead of causing validation tracebacks, with regression coverage for these cases.

Changes:

  • Skip malformed secret declarations before building secret plans.
  • Report non-array publish declarations explicitly.
  • Add direct and end-to-end tests for malformed registry entries.

A remaining moderate issue allows an unhashable publish.target value to raise TypeError; the test documentation also needs a present-tense wording correction.

File Summary
spec/​validate.py Adds guards for malformed secret and publish declarations. One moderate issue remains for unhashable publish targets (3 votes).
tests/​test_spec_validate.py Adds regression coverage for malformed registry fields. One documentation nit requests present-tense wording (1 vote).

This pull request requires changes.

Review effort: Lite

Comment thread spec/validate.py Resolved
@codecov

codecov Bot commented Nov 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 54.54545% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.67%. Comparing base (9fcb0aa) to head (97f8f38).

Files with missing lines Patch % Lines
spec/validate.py 54.54% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3941      +/-   ##
===========================================
- Coverage    78.68%   78.67%   -0.02%     
===========================================
  Files           37       37              
  Lines        12611    12621      +10     
===========================================
+ Hits          9923     9929       +6     
- Misses        2688     2692       +4     
Flag Coverage Δ
python-3.13 78.67% <54.54%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727
ptr727 merged commit 73f9de8 into develop Nov 8, 2026
18 of 20 checks passed
@ptr727
ptr727 deleted the feature/validate-skip-malformed-secret-plan branch November 8, 2026 21:10
ptr727 added a commit that referenced this pull request Nov 8, 2026
…rets Directory (#3937)

## Summary

Promotes #3934 and #3941 to `main`.

- **`configure.sh apply` provisions a repository's secrets from the
host's `~/.secrets/` (#3934).** Each secret a cataloged repository owes
is read from `~/.secrets/`. It is set in every store its mechanism
names, with the value passed on stdin only.
- `spec/secrets.json` `secretScopes` gives each name a strict `fleet` or
`repository` scope, which picks the one file it is read from. A file at
the wrong scope aborts the run before any write.
- `check` asserts the names per store. Missing and refused files are
listed and make the run exit non-zero.
- An excluded entry, a slug its registry url does not name, and a
repository whose ground branch does not exist yet are each handled
without a wrong-target write.
- Name resolution moved into the stdlib-only `spec/secret_names.py`,
shared with `spec/audit.py`. `spec/resolve_secrets.py scaffold`
pre-creates every expected file as an empty mode `600` placeholder.
- CODESTYLE.md "Script and Utility File Names" defines a repository name
field for secret file names.
  - The hub declares the `host-secrets` type.

- **`spec/validate.py` reports a malformed registry entry rather than
raising (#3941).** A dotted cataloged entry with a malformed
`requiredSecrets` or `publish` is skipped before its secrets are
planned. A non-list `publish` is now its own error. CodeRabbit raised it
on this promotion.

## Verification

- #3934 merged after sixteen recorded local passes, the last one clean,
plus CodeRabbit and green CI including Windows.
- Live rollout from `develop`: `apply` ran on all 22 cataloged
repositories and set 148 secret values. A fresh `check` sweep found
every owed secret in both stores. `spec/audit.py` reports no missing or
forbidden secret anywhere, and the unclaimed ones left are tracked by
#3936 and #3902.

Closes #3932

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses script A defect in hub tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants