fix(build): fail fast on a non-PascalCase entity id (unenforced contract)#203
Open
agjs wants to merge 2 commits into
Open
fix(build): fail fast on a non-PascalCase entity id (unenforced contract)#203agjs wants to merge 2 commits into
agjs wants to merge 2 commits into
Conversation
…ng generation downstream The approved-plan build path fed slice.entity.id straight into toCamelCase/wireResource/ reachability/i18n keys with NO validation: the planner is only PROMPTED for PascalCase and the plan validator (isEntitySpec) checks merely non-empty, so a malformed id like "Purchase Order" passed and broke generation opaquely deep downstream (worse in headless, where no human reviews the plan). The resource-planner path already enforces this exact contract via isResourceId — the approved-plan path just missed it. Add invalidEntityIds (reuses isResourceId) + a fail-fast throw in runBoringstackBuild before any generation, surfaced cleanly by headless-build's top-level catch. Pure helper unit-tested; integration test asserts the throw. No gate/status-contract change; single script caller.
…fect Panel advisory: the throw test would still pass if generate/generateUi/baseline ran before validation, so it didn't protect the fail-fast guarantee. Spy the generators + assert zero calls, zero baseline captures, and no model send on the invalid-id path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The approved-plan build path fed
slice.entity.idstraight intotoCamelCase→ generated file paths (features/<camel>/…), the<camel>Routesmount identifier, i18n keys, and test ids — with no validation. The planner is only prompted for PascalCase and the plan validator (isEntitySpec) checks merely non-empty, so a malformed id like"Purchase Order"passed validation and then broke generation opaquely deep downstream (worse in headless builds, where no human reviews the plan). The resource-planner path already enforces this exact contract viaisResourceId— the approved-plan path just missed it.Fix
invalidEntityIds(slices)in plan-resources.ts — pure, reuses the existingisResourceId(/^[A-Z][a-zA-Z0-9]*$/u), the same contract the sibling path already enforces.throwinrunBoringstackBuildright afterloadApprovedPlan, beforeslicesToFeatures/baseline/generation, with an actionable message naming the offending id(s). Surfaced cleanly by headless-build's top-levelmain().catch(stderr + exit 1) — the only non-test caller.Enforcing strict PascalCase (not a looser identifier regex) is deliberate: it's the declared contract (plan-types.ts comment + planner prompt) and is already enforced on the resource-planner path, so this is consistency. Worst case is a clear "use PascalCase" message for a one-character fix. No gate or status-contract change.
Tests
invalidEntityIdsunit tests (space / hyphen / leading-lowercase / leading-digit / symbol flagged, order preserved; empty list).runBoringstackBuildrejects on"Purchase Order"and — per panel advisory — spies the generators to assert zero generate/generateUi calls, zero baseline captures, and no model send, pinning the fail-fast-before-side-effects guarantee.Review
Local 4-model harness-review panel: PASS (4/4). Round-1 raised one advisory (test didn't protect the fail-fast ordering) — incorporated; round-2 clean, zero findings.