@carecard/validate 3.13.0 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,10 @@ Non-negotiable root-cause solution rule: Always identify and solve the verified
7
7
 
8
8
  # CareCard Workspace Standards
9
9
 
10
+ Mandatory companion: load
11
+ `$pkg-validate-coding-standards-and-best-practices` before this skill for every
12
+ task in this repository.
13
+
10
14
  Non-negotiable test order invariance rule: Every test must pass independently of which tests run before or after it, and the suite must pass in every execution order. Each test must establish the state it needs, isolate mutable state, and clean up state it owns; it must never rely on another test's setup, mutations, or cleanup. Default test, CI, and Husky commands must use the test framework's ordinary ordering and must not force randomized ordering. Random-order execution is an explicit diagnostic only, and every failure it exposes must be fixed at the root cause.
11
15
 
12
16
  Non-negotiable parallel test execution rule: Run independent test files in parallel with repository-native worker support wherever resource isolation makes parallel execution safe. Tests that share a mutable database, application server, browser state, filesystem fixture, port, or cluster resource must remain in an explicitly isolated serial group until every worker owns a separate resource. Parallel execution must preserve ordinary test selection and must never use randomized ordering, retries, locks, or error suppression to conceal coupling.
@@ -406,7 +410,7 @@ the authenticated dashboard.
406
410
  - `ms-auth` follows the shared PostgreSQL/RLS pattern: auth tables live in the `carecard` schema, RLS is enabled and forced on every auth table, and application runtime queries use the unprivileged database role.
407
411
  - Auth table policies allow normal JWT users to access only self-owned rows. Do not add redundant `user_id = <jwt sub>` SQL predicates to duplicate self-row checks when RLS owns the authorization decision.
408
412
  - A JWT payload containing `roles: ["ad"]` is the auth-service super-admin signal and can perform any action on auth tables. Dashboard code may map that role to `super_admin`, but backend auth RLS must not require a separate database role row for that bypass.
409
- - Public auth flows such as registration, login, confirmation, recovery, visitor creation, and service user lookup must use narrow system contexts (`system_create`, `system_login`, `system_confirm`, `system_recovery`, `system_visitor`, `system_service`) instead of privileged runtime queries.
413
+ - Public auth flows such as registration, login, recovery, visitor creation, and service user lookup must use narrow system contexts (`system_create`, `system_login`, `system_recovery`, `system_visitor`, `system_service`) instead of privileged runtime queries.
410
414
 
411
415
  - `ms-auth` controller exports use concise action names such as `loginUser`,
412
416
  `registerUser`, `getUserDetail`, and `renewJwt`; route middleware and router
@@ -416,7 +420,7 @@ the authenticated dashboard.
416
420
 
417
421
  ## Security Requirements
418
422
 
419
- - Treat authentication, authorization, JWT, password, email confirmation,
423
+ - Treat authentication, authorization, JWT, password, email verification,
420
424
  recovery, file upload, CORS, rate limits, and error response behavior as
421
425
  security-sensitive.
422
426
  - Never log or return secrets, tokens, passwords, credentials, private keys,
@@ -0,0 +1,165 @@
1
+ ---
2
+ name: pkg-validate-coding-standards-and-best-practices
3
+ description: 'Mandatory for every pkg-validate task, including analysis, clarification, planning, implementation, review, debugging, documentation, public API work, skill maintenance, and validation. Use before every narrower skill.'
4
+ ---
5
+
6
+ # Pkg Validate Coding Standards And Best Practices
7
+
8
+ Non-negotiable root-cause solution rule: Always identify and solve the verified
9
+ root cause, use the stronger solution, and deliver a correct, durable,
10
+ production-quality result. Never treat a temporary workaround, resource
11
+ increase, retry, suppression, bypass, or symptom-only patch as completion.
12
+ Validate the root-cause fix against the real failing workflow and prove the end
13
+ state.
14
+
15
+ Non-negotiable error and warning rule: Never suppress, silence, hide, downgrade,
16
+ filter, ignore, skip, or bypass errors or warnings from code, tests, tools,
17
+ compilers, linters, or validation. Fix the root cause, then rerun the affected
18
+ check and require a clean result. Expected error-path tests may assert errors,
19
+ but must not conceal unexpected failures.
20
+
21
+ Non-negotiable repository isolation rule: Every repository must run its Husky
22
+ hooks and tests using only files, code, fixtures, dependencies, and services
23
+ contained within that repository. Tests and Husky scripts must not import,
24
+ require, read, execute, or otherwise depend on sibling repositories or paths
25
+ outside the repository root. app-e2e-tests is the only exception because
26
+ cross-repository end-to-end testing is its explicit responsibility.
27
+
28
+ ## Mandatory Use And Authorities
29
+
30
+ Load this skill before doing any work in `pkg-validate`, including read-only
31
+ and documentation-only work. Then load every narrower skill that owns the
32
+ affected package contract.
33
+
34
+ Use these existing authorities instead of duplicating them:
35
+
36
+ - `$carecard-workspace-standards` for TDD, root-cause solutions, dependencies,
37
+ errors, isolation, and repository workflow;
38
+ - `$software-design-patterns-and-clean-code` for design, DRY, KISS,
39
+ testability, and clean-code details;
40
+ - `$pkg-validate-validation-library` for validators, sanitization, whitelist
41
+ behavior, exports, types, coverage, and validation; and
42
+ - `$pkg-publish` only when runtime package artifacts or consumer versions must
43
+ be published and propagated.
44
+
45
+ This skill adds the function-evolution, direct-contract, composition, and
46
+ completion rules below without weakening those companion skills.
47
+
48
+ ## Requirement Judgment
49
+
50
+ 1. Read the complete request and inspect implementation, public exports,
51
+ declarations, validation call sites, tests, documentation, and consumers
52
+ before deciding how to change the package.
53
+ 2. Translate the request into a coherent technical contract. Do not apply
54
+ wording mechanically when it is contradictory, unsafe, impossible, or
55
+ incompatible with validation or package architecture.
56
+ 3. Make low-risk, reversible assumptions only when they preserve requested
57
+ behavior and scope.
58
+ 4. Ask for clarification when an unresolved choice would materially change a
59
+ public API, accepted or rejected input, error behavior, security, consumer
60
+ behavior, destructive scope, or the repositories that must change.
61
+ 5. Explain architectural tradeoffs before a major API, validator, sanitizer,
62
+ type, module, package, or dependency change.
63
+
64
+ ## Scope And Quality
65
+
66
+ - Treat every workspace repository as independent and validate it from its own
67
+ root.
68
+ - Update every skill, document, source, runtime test, type test, export,
69
+ declaration, consumer, and package version genuinely required for a coherent
70
+ task.
71
+ - Do not broaden the task into unrelated cleanup.
72
+ - Preserve CommonJS, predicate, sanitization, whitelist, declaration, naming,
73
+ and test conventions unless the task explicitly replaces them.
74
+ - Prefer Node core and existing helpers over new dependencies.
75
+ - Prefer readable deterministic implementation over clever compression or a
76
+ temporary workaround.
77
+ - Use meaningful names that describe validation and sanitization intent.
78
+
79
+ ## Function Evolution
80
+
81
+ Before changing a function's behavior or signature, inventory every direct,
82
+ indirect, test, exported, validator-map, callback, configuration-driven, and
83
+ dynamic consumer.
84
+
85
+ - If exactly one consumer is proven, change the function only when required.
86
+ - If two or more consumers exist, do not change the shared function's behavior.
87
+ Create a new purpose-named function and migrate only intended consumers.
88
+ - If every consumer needs the new contract, migrate all consumers and delete
89
+ the old function after proving it unused.
90
+ - Treat every exported, declared, public, registered, callback, or dynamically
91
+ discovered function as shared unless single use is conclusively proven.
92
+ - Do not add caller branches, mode flags, or optional parameters merely to
93
+ make one shared function serve incompatible contracts.
94
+ - Cover the new function, public surface, types, and every migrated consumer
95
+ through TDD.
96
+
97
+ ## Direct Contract Without Backward Compatibility
98
+
99
+ When the active task replaces a contract, implement the requested end state
100
+ directly. Do not add legacy aliases, deprecated wrappers, compatibility
101
+ overloads, duplicate exports, dual validation paths, transitional names, or
102
+ fallback behavior solely to preserve the superseded contract.
103
+
104
+ Delete obsolete functions and exports after all intended consumers have
105
+ migrated and repository-native search, runtime tests, type tests, and coverage
106
+ prove them unused. This does not authorize unrelated API removal. If an
107
+ existing published or security contract requires compatibility and the request
108
+ does not clearly supersede it, explain the conflict and ask first.
109
+
110
+ ## TDD And Root-Cause Gate
111
+
112
+ Follow `$carecard-workspace-standards` and
113
+ `$pkg-validate-validation-library` for the complete failing-test-first,
114
+ root-cause, and 100-percent-coverage workflow. Documentation and skill changes
115
+ require a focused structural validation before prose changes. Do not accept
116
+ retries, suppressed diagnostics, weakened types, reduced coverage, disabled
117
+ tests, forced success, compatibility patches, or symptom-only workarounds as
118
+ completion.
119
+
120
+ ## Function Size
121
+
122
+ Every new or materially changed function must contain at most 25 logical code
123
+ lines.
124
+
125
+ - Count executable statements, branches, loop headers, side-effecting calls,
126
+ returns, and throws.
127
+ - Exclude signatures, type-only declarations, blank lines, comments, and
128
+ isolated braces.
129
+ - Extract cohesive purpose-named helpers and compose them when needed.
130
+ - Keep parsing, predicate evaluation, sanitization, transformation, and error
131
+ mapping responsibilities explicit rather than hiding them in one long
132
+ function.
133
+ - Avoid meaningless forwarding wrappers and do not refactor untouched
134
+ functions solely to satisfy this limit.
135
+
136
+ ## UI Composition
137
+
138
+ This package does not own UI. If a package contract requires UI changes, make
139
+ them in the owning app repository. There, create focused components, compose
140
+ existing and new components, and delete obsolete components only after proving
141
+ them unused and replaced.
142
+
143
+ ## Skills, Documentation, And Database Boundaries
144
+
145
+ - Update affected skills, README guidance, examples, exports, and declarations
146
+ with behavior or validation changes.
147
+ - Reference existing authoritative skills instead of copying their details.
148
+ - If work reaches an `ms-*` database, change SQL only in the owning repository
149
+ using its database-migration-ownership skill. For first-create work, edit the
150
+ existing migration and matching rollback directly rather than adding a
151
+ compatibility migration.
152
+ - Keep persistence and service behavior in their owning repositories.
153
+
154
+ ## Completion
155
+
156
+ 1. Review each changed repository's diff and status independently.
157
+ 2. Run focused runtime, type, and coverage tests, then all broader checks
158
+ required by local skills.
159
+ 3. If every changed file in a repository is Markdown (`*.md`), skip Husky and
160
+ run only focused Markdown validation.
161
+ 4. If any changed file is not Markdown, run every direct `.husky` script. If
162
+ none exists, run the strongest repository-native focused validation.
163
+ 5. Fix every in-scope failure at its root cause and rerun the exact command.
164
+ 6. Report exact commands, results, limitations, and remaining risk.
165
+ 7. Do not perform remote Git or GitHub operations unless explicitly requested.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: 'Pkg Validate Coding Standards'
3
+ short_description: 'Apply mandatory validation package standards'
4
+ default_prompt: 'Use $pkg-validate-coding-standards-and-best-practices before every pkg-validate task and apply all narrower skills that the task requires.'
package/.codex/AGENTS.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Codex Instructions For pkg-validate
2
2
 
3
+ ## Non-negotiable Codex banked-reset requirement
4
+
5
+ - Never use or consume a banked Codex rate-limit reset automatically.
6
+ - Before using any banked Codex rate-limit reset, stop, ask the user for explicit, direct approval for that specific reset, and wait for their reply.
7
+ - Never treat earlier approval, a standing instruction, silence, urgency, an unfinished task, or a request to continue as approval for a future reset.
8
+ - Do not invoke `/usage` redemption, a reset-consumption action, a reset API or tool, or any equivalent mechanism unless the user explicitly approved that specific reset.
9
+ - If a Codex limit is reached without that approval, pause and let the user reset it manually. Never consume a banked reset to keep working.
10
+
3
11
  Non-negotiable test order invariance rule: Every test must pass independently of which tests run before or after it, and the suite must pass in every execution order. Each test must establish the state it needs, isolate mutable state, and clean up state it owns; it must never rely on another test's setup, mutations, or cleanup. Default test, CI, and Husky commands must use the test framework's ordinary ordering and must not force randomized ordering. Random-order execution is an explicit diagnostic only, and every failure it exposes must be fixed at the root cause.
4
12
 
5
13
  Non-negotiable code organization rule: Functions with the same or equivalent behavior must use the same or clearly corresponding descriptive names across CareCard repositories, and equivalent functionality must live in files with the same names within each repository's established architecture. No backward compatibility names, aliases, or duplicate locations are allowed.
@@ -147,7 +155,7 @@ The `pkg-*` directories are reusable CareCard packages. Shared API response, err
147
155
 
148
156
  ### Security Requirements
149
157
 
150
- - Treat authentication, authorization, JWT, password, email confirmation, recovery, file upload, CORS, rate limits, and error response behavior as security-sensitive.
158
+ - Treat authentication, authorization, JWT, password, email verification, recovery, file upload, CORS, rate limits, and error response behavior as security-sensitive.
151
159
  - Never log or return secrets, tokens, passwords, credentials, private keys, full JWT payloads, or sensitive personal data.
152
160
  - Use safe error messages for users and structured details only when they do not reveal sensitive implementation or data.
153
161
  - Keep body-size limits, Helmet, CORS allow-lists, and rate-limit behavior intact unless a task explicitly changes them.
package/AGENTS.md ADDED
@@ -0,0 +1,15 @@
1
+ # Codex Instructions
2
+
3
+ ## Non-negotiable Codex banked-reset requirement
4
+
5
+ - Never use or consume a banked Codex rate-limit reset automatically.
6
+ - Before using any banked Codex rate-limit reset, stop, ask the user for explicit, direct approval for that specific reset, and wait for their reply.
7
+ - Never treat earlier approval, a standing instruction, silence, urgency, an unfinished task, or a request to continue as approval for a future reset.
8
+ - Do not invoke `/usage` redemption, a reset-consumption action, a reset API or tool, or any equivalent mechanism unless the user explicitly approved that specific reset.
9
+ - If a Codex limit is reached without that approval, pause and let the user reset it manually. Never consume a banked reset to keep working.
10
+
11
+ ## Repository validation contracts
12
+
13
+ Non-negotiable repository isolation rule: Every repository must run its Husky hooks and tests using only files, code, fixtures, dependencies, and services contained within that repository. Tests and Husky scripts must not import, require, read, execute, or otherwise depend on sibling repositories or paths outside the repository root. app-e2e-tests is the only exception because cross-repository end-to-end testing is its explicit responsibility.
14
+
15
+ Non-negotiable code organization rule: Functions with the same or equivalent behavior must use the same or clearly corresponding descriptive names across CareCard repositories, and equivalent functionality must live in files with the same names within each repository's established architecture. No backward compatibility names, aliases, or duplicate locations are allowed.
@@ -138,8 +138,8 @@ function validateProperties(obj = {}) {
138
138
  }
139
139
  break;
140
140
  case 'token':
141
- case 'email_confirm_token':
142
- case 'emailConfirmToken':
141
+ case 'email_verification_token':
142
+ case 'emailVerificationToken':
143
143
  case 'verification_token':
144
144
  case 'verificationToken':
145
145
  if (isUrlSafeString(value)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carecard/validate",
3
- "version": "3.13.0",
3
+ "version": "3.14.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/CareCard-ca/pkg-validate.git"
@@ -39,7 +39,7 @@
39
39
  "typescript": "6.0.3"
40
40
  },
41
41
  "dependencies": {
42
- "@carecard/common-util": "3.13.0"
42
+ "@carecard/common-util": "3.14.0"
43
43
  },
44
44
  "nyc": {
45
45
  "all": true,
package/readme.md CHANGED
@@ -124,7 +124,7 @@ where the package supports both.
124
124
  | `isEmailString` | `email` |
125
125
  | `isPhoneNumber` | `phone_number`, `phoneNumber` |
126
126
  | `isCountryCodeString` | `country_code`, `countryCode` |
127
- | `isUrlSafeString` | `token`, `email_confirm_token`, `emailConfirmToken`, `verification_token`, `verificationToken` |
127
+ | `isUrlSafeString` | `token`, `email_verification_token`, `emailVerificationToken`, `verification_token`, `verificationToken` |
128
128
  | `isValidUuidString` | `uuid`, `item_id`, `itemId`, `user_id`, `userId`, `address_id`, `addressId`, `order_id`, `orderId`, `category_id`, `categoryId`, `parent_id`, `parentId`, `college_id`, `collegeId`, `campus_id`, `campusId`, `program_id`, `programId`, `program_term_id`, `programTermId`, `template_id`, `templateId`, `program_template_id`, `programTemplateId`, `user_item_id`, `userItemId`, `user_item_status_id`, `userItemStatusId`, `requirement_item_id`, `requirementItemId`, `program_document_id`, `programDocumentId`, `id`, `institution_id`, `institutionId`, `role_assignment_id`, `roleAssignmentId`, `user_role_id`, `userRoleId`, `phone_number_id`, `phoneNumberId`, `entity_id`, `entityId`, `changed_by`, `changedBy`, `request_id`, `requestId` |
129
129
  | `isCcIdString` | `cc_id`, `ccId` |
130
130
  | `isValidIntegerString` | `offset_number`, `offsetNumber`, `number_of_orders`, `numberOfOrders`, `price`, `from`, `number`, `limit`, `offset` |