Skip to content

feat(s3): evaluate requiredCategories (spec v0.4 §4.3) — 0.2.2 - #52

Merged
ryandmonk merged 1 commit into
mainfrom
feat/required-categories-s3
Aug 7, 2026
Merged

feat(s3): evaluate requiredCategories (spec v0.4 §4.3) — 0.2.2#52
ryandmonk merged 1 commit into
mainfrom
feat/required-categories-s3

Conversation

@ryandmonk

Copy link
Copy Markdown
Contributor

S3 support for the dspack#36 rule-language amendment, driven by the T1 Build evidence (zero-control forms passing every gate).

  • RequiredCompositionRule gains requiredCategories?: {id, min?}[]; the evaluator resolves membership through the existing categoryIndex, local to each matching node's descendants — an interactive member elsewhere in the surface satisfies nothing, and the finding message states that explicitly for actionable repair feedback.
  • Findings carry rule id + owner-approved rationale through the standard S3 path.
  • Ten ratified pins (required-categories.test.ts): text-only FAIL, empty FAIL, input/textarea/select PASS, locality FAIL, min: 2 FAIL naming counts, AND across entries, requiredSubComponents unchanged, forbiddenCategories unchanged.
  • 129/129 green. Version → 0.2.2 for the tag-triggered OIDC release.

🤖 Generated with Claude Code

The category-OR the T1 Build evidence demanded: for every node matching the
rule's component, each requiredCategories entry must have >= min descendants
belonging to the category, membership resolved through the contract's
categories declarations exactly like forbiddenCategories, LOCAL to the
matching node's descendants — a member elsewhere in the surface satisfies
nothing, and the finding message says so explicitly.

Ten ratified pins in required-categories.test.ts: text-only form-control
FAILs carrying the owner-approved rationale verbatim; empty FAILs; input /
textarea / select each PASS; locality (interactive elsewhere does not
satisfy); min 2 with one found FAILs naming both numbers; multiple entries
keep AND semantics; requiredSubComponents unchanged; forbidden-composition
unchanged alongside.

129/129 green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 7, 2026 16:25
@ryandmonk
ryandmonk merged commit c5a7acf into main Aug 7, 2026
3 checks passed

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.

Pull request overview

Adds S3 lint support for the spec v0.4 §4.3 requiredCategories extension on required-composition rules, along with a dedicated test suite and a version bump to 0.2.2.

Changes:

  • Extend RequiredCompositionRule with requiredCategories?: { id, min? }[] and implement evaluation via categoryIndex(contract) scoped to each matching node’s descendants.
  • Add 10 “ratified pin” tests validating failure/pass/locality/min/AND semantics and rationale propagation.
  • Bump package version to 0.2.2.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/core/lint/rules.ts Implements requiredCategories evaluation for required-composition using contract category membership.
src/core/lint/required-categories.test.ts Adds a comprehensive vitest suite covering the new rule behavior and invariants.
src/core/contract.ts Extends the contract rule interface with the new requiredCategories field and semantics documentation.
package.json Version bump to 0.2.2.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/core/lint/rules.ts
Comment on lines +128 to +141
for (const requirement of rule.requiredCategories ?? []) {
const min = requirement.min ?? 1;
const found = descendants.filter((d) => (categories!.get(d.node.component) ?? []).includes(requirement.id)).length;
if (found < min) {
findings.push(
finding(
rule,
`Required category '${requirement.id}' (min ${min}) not found among descendants (found ${found}) — no descendant of this node is a '${requirement.id}' member; members elsewhere in the surface do not satisfy this rule.`,
locationOf(visited),
),
);
}
}

Comment thread src/core/contract.ts
Comment on lines +96 to +102
/**
* spec v0.4 §4.3 (2026-08-07 amendment, lifted from the §6 ceiling on the
* T1 Build evidence): categories from which at least `min` descendants must
* appear beneath each matching node. AND across entries, OR within a
* category's membership; LOCAL to the matching node's descendants.
*/
requiredCategories?: Array<{ id: string; min?: number }>;
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.

2 participants