feat: filter per-unit consumes by Unit kind with consumes[].kinds - #1132
vnlebaoduy wants to merge 1 commit into
Conversation
a5bb426 to
ad40218
Compare
|
Rebased onto Verified on the rebased head |
A per-unit stage can now mark one consume as applying to some Unit kinds only, the consumer-side twin of produces_kinds. The directive builder (resolveConsumes) drops the consume for a Unit of another kind and the upstream-coverage dispatcher stops threading it, so a backend Unit is no longer asked to cite a UI mockup it never read. No list, or an untagged Unit, keeps the consume. Schema: `kinds` is a non-empty inline list of UNIT_KINDS and is refused on a stage that is not `for_each: unit-of-work`, where it would be inert. The frontmatter parser accepts an inline list on a consume subkey, the emitter writes it back, the plugin contribution regex tolerates it, and graph compile carries it into stage-graph.json. No core stage declares `kinds` yet; awslabs#1003 can tag wireframes / mockups / interaction-spec once this lands. Refs awslabs#999, awslabs#1003
ad40218 to
556ab64
Compare
|
Rebased onto |
Summary
The engine piece from the review of #1003 (item 2): a per-unit stage can mark one consume as applying to some Unit kinds only.
produces_kindsalready prunes what a Unit must write; a consume had no kind axis, so a once-per-workflow artifact such as a UI mockup reached every Unit's directive andupstream-coverageasked a backend Unit to cite it — a falseSENSOR_FAILEDon correct output.Refs #999, #1003. No stage
consumes:changes here; #1003 can rebase onto this and tagwireframes/mockups/interaction-specwithkinds: [ui].Changes
core/tools/aidlc-stage-schema.ts—consumes[].kinds?: string[]: non-empty, every entry inUNIT_KINDS, and refused on a stage that is notfor_each: unit-of-work(the list would be silently inert).core/tools/aidlc-lib.ts—consumeAppliesToKind()besidefilterProducesByKind()(same semantics: no list or untagged Unit keeps the consume); the frontmatter parser accepts an inline[..]list on a consume subkey; the emitter writes it back.core/tools/aidlc-orchestrate.ts—resolveConsumesdrops a consume the Unit's kind is not listed for.core/tools/aidlc-sensor.ts— upstream-coverage threading reads the Unit from the fired file's<record>/construction/<unit>/<slug>/path and its kind from the unit DAG, then applies the same filter beforepresentConsumes. Stage-level per-unit layouts and untagged Units resolve to null and keep every consume.core/tools/aidlc-graph.ts,core/tools/aidlc-plugin.ts—Consume.kindscarried through compile; the contribution-seam consumes regex tolerates the subkey.core/aidlc-common/protocols/stage-definition.md,docs/reference/15-stage-definition.md— field row and a### consumes[].kindssection next toproduces_kinds.tests/unit/t338-consumes-kinds.test.ts— parse/emit round-trip, validator accept/reject,consumeAppliesToKind, and the two spawned surfaces against a copy of the shipped graph (AIDLC_STAGE_GRAPH) withwireframesgated to[ui]on functional-design: auiUnit's directive carries it, aserviceUnit's omits it, an untagged Unit keeps it; aserviceUnit'sfire upstream-coveragepasses on a deliverable that never cites wireframes while auiUnit's fails naming it — the backend-Unit fixture from the fix: Frontend mockups design artefacts are not flowing to the downstream stages (#999) #1003 review.tests/.coverage-registry.json,tests/.coverage-ratchet.json— regenerated (gen-coverage-registry.ts). Nine of the registry lines are pre-existing drift onmain(function:copilotStopEvidence), not from this change.No version bump, badge, or CHANGELOG entry, per the Release Metadata Policy.
User experience
Before: every per-unit stage input applies to every Unit; a stage author wanting a UI-only input had no way to say so, and declaring it made backend Units fail the advisory coverage sensor.
After:
kinds: [ui]on the consume. Nothing changes for existing stages — none declare it.Checklist
Test plan
Head
a5bb4264againstmain355903d6(2.8.2):The wiring is load-bearing: with
aidlc-orchestrate.tsandaidlc-sensor.tsreverted tomain, t338 fails exactly the two cases the review named — theserviceUnit's directive still carries wireframes, and itsfire upstream-coveragereports it unreferenced.Compile end to end: a copied shell whose functional-design declares
kinds: [ui]compiles andstage-graph.jsoncarries{"artifact":"wireframes","required":false,"kinds":["ui"]}; the same list on domain-design (not per-unit) fails compile withconsumes[0].kinds requires for_each: unit-of-work.Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.