@carecard/validate 3.27.0 → 3.29.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.
- package/.agents/skills/carecard-must-do/SKILL.md +93 -0
- package/.agents/skills/carecard-workspace-standards/SKILL.md +37 -33
- package/.agents/skills/github-pr-create-update/SKILL.md +132 -167
- package/.agents/skills/github-pr-create-update/agents/openai.yaml +4 -4
- package/.agents/skills/github-pr-merge-cleanup/SKILL.md +220 -219
- package/.agents/skills/github-pr-merge-cleanup/agents/openai.yaml +4 -4
- package/.agents/skills/pkg-publish/SKILL.md +56 -7
- package/.agents/skills/pkg-validate-coding-standards-and-best-practices/SKILL.md +10 -3
- package/.agents/skills/pkg-validate-validation-library/SKILL.md +38 -33
- package/.codex/AGENTS.md +16 -4
- package/AGENTS.md +13 -1
- package/CLAUDE.md +43 -0
- package/lib/validateNewUserRoleRequest.js +1 -3
- package/lib/validateWhitelistProperties.js +2 -4
- package/package.json +3 -3
- package/readme.md +11 -6
|
@@ -101,6 +101,9 @@ depend on those folders being present.
|
|
|
101
101
|
- Keep key-based property sanitization in `lib/validateProperties.js`.
|
|
102
102
|
- Keep whitelist, nested-path, casing, flattening, and CareCard bad-input
|
|
103
103
|
behavior in `lib/validateWhitelistProperties.js`.
|
|
104
|
+
- Import shared casing and bad-input behavior through the focused
|
|
105
|
+
`@carecard/common-util/case-converter` and `@carecard/common-util/errors`
|
|
106
|
+
entrypoints so the package root remains safe for browser bundles.
|
|
104
107
|
- Preserve the package's CommonJS module style unless the repository is
|
|
105
108
|
intentionally migrated.
|
|
106
109
|
- Keep the deprecated `validate` namespace export backward-compatible while
|
|
@@ -124,7 +127,8 @@ depend on those folders being present.
|
|
|
124
127
|
- `validateProperties` should return a new sanitized object and omit unknown or
|
|
125
128
|
invalid fields without mutating the input.
|
|
126
129
|
- `validateWhitelistProperties` should reject missing or invalid required fields
|
|
127
|
-
with CareCard `BAD_INPUT` errors through
|
|
130
|
+
with CareCard `BAD_INPUT` errors through the focused
|
|
131
|
+
`@carecard/common-util/errors` entrypoint.
|
|
128
132
|
- Optional whitelist fields should be ignored when absent and rejected when
|
|
129
133
|
present but invalid.
|
|
130
134
|
- Preserve supported snake_case and camelCase field aliases unless a task
|
|
@@ -196,41 +200,42 @@ and remaining risk.
|
|
|
196
200
|
|
|
197
201
|
## Remote Git Operations Guardrail
|
|
198
202
|
|
|
199
|
-
|
|
203
|
+
Fetches needed to establish a fresh `origin/main` at task start and before a
|
|
204
|
+
source-branch push are authorized without a separate approval question. Commits,
|
|
205
|
+
pushes, PR mutations, and branch cleanup require an authorized task; a request
|
|
206
|
+
for local work alone does not authorize publication. An authorized squash merge
|
|
207
|
+
into `main` includes the merged-source cleanup, local `main` update, and
|
|
208
|
+
`development` synchronization below unless the user explicitly says otherwise.
|
|
209
|
+
Never delete local or remote `main`, or force-push to remote `main`, including
|
|
210
|
+
with `--force-with-lease`.
|
|
200
211
|
|
|
201
212
|
## Agent Guidance Git Workflow
|
|
202
213
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
git ls-remote --heads origin feature/codex
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
Do not commit or push `.agents` guidance changes directly from `development`
|
|
232
|
-
or `main`. Do not stage unrelated files, generated output, dependency folders,
|
|
233
|
-
build artifacts, logs, or `.DS_Store`.
|
|
214
|
+
Work from the owning repository root and stage only intended guidance changes.
|
|
215
|
+
Use freshly fetched `origin/main` as the default base. Start `<agent-name>/<task-name>`
|
|
216
|
+
from it, or rebase existing work when it does not already contain the latest
|
|
217
|
+
`origin/main`. An explicit user instruction to use the current or another
|
|
218
|
+
working branch overrides the default `<agent-name>/<task-name>` selection.
|
|
219
|
+
|
|
220
|
+
Fetch again before every source-branch push and rebase only when the branch
|
|
221
|
+
does not already contain the latest `origin/main`. Required fetches need no
|
|
222
|
+
separate approval; commits, pushes, PR mutations, and cleanup require an
|
|
223
|
+
authorized task. A local guidance edit does not authorize publishing it.
|
|
224
|
+
|
|
225
|
+
For an authorized merge, create or reuse the PR into `main`, run applicable
|
|
226
|
+
validation, and squash-merge; administrator privileges may be used without
|
|
227
|
+
GitHub reviews. Verify the merge and delete its source branch remotely and
|
|
228
|
+
locally after checking for newer unmerged work. Then fast-forward local `main`
|
|
229
|
+
and replace local and remote branches named exactly `development` with the
|
|
230
|
+
latest remote `main` commit, using an explicit observed-commit
|
|
231
|
+
`--force-with-lease` remotely. Create a missing development counterpart when
|
|
232
|
+
either existed; leave repositories with neither unchanged. If development was
|
|
233
|
+
the merged source, recreate it from the new main. Verify commit parity and
|
|
234
|
+
cleanup; preserve dirty worktrees and report conflicts or rejected leases.
|
|
235
|
+
|
|
236
|
+
Never delete local or remote `main` or force-push to remote `main`, including
|
|
237
|
+
with `--force-with-lease`. Guard exact destination refs before deleting or
|
|
238
|
+
forcing any branch. Do not amend commits or stage unrelated files.
|
|
234
239
|
|
|
235
240
|
## Fail-Closed Test Lifecycle Audit
|
|
236
241
|
|
package/.codex/AGENTS.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Codex Instructions For pkg-validate
|
|
2
2
|
|
|
3
|
+
## Mandatory startup for every agent
|
|
4
|
+
|
|
5
|
+
Every agent, including Codex, Claude, other assistants, and delegated agents,
|
|
6
|
+
must read and follow [carecard-must-do](../.agents/skills/carecard-must-do/SKILL.md)
|
|
7
|
+
before beginning or resuming any task. This includes planning, questions,
|
|
8
|
+
read-only investigation, coding, review, documentation, and validation.
|
|
9
|
+
|
|
10
|
+
Then load the [repository engineering standards](../.agents/skills/pkg-validate-coding-standards-and-best-practices/SKILL.md)
|
|
11
|
+
and the specialist skills relevant to the task.
|
|
12
|
+
An agent without automatic skill discovery must open the skill explicitly;
|
|
13
|
+
the requirement applies regardless of the agent platform.
|
|
14
|
+
|
|
3
15
|
## Non-negotiable Codex banked-reset requirement
|
|
4
16
|
|
|
5
17
|
- Never use or consume a banked Codex rate-limit reset automatically.
|
|
@@ -133,10 +145,10 @@ The `pkg-*` directories are reusable CareCard packages. Shared API response, err
|
|
|
133
145
|
- Use coverage reports only as diagnostics for potentially untested observable behavior. Percentages for lines, branches, functions, and statements are not functional evidence and must not determine test assertions. Never add implementation-detail tests to preserve a metric or lower thresholds to hide a failing check; report any conflict with the behavior-only policy.
|
|
134
146
|
- Keep tests readable and domain-specific. Prefer explicit helper names over generic test utilities that hide important behavior.
|
|
135
147
|
- Use existing test frameworks and layouts:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
148
|
+
- JavaScript `api-*`: usually Mocha, Supertest, `test/index.test.js`, and Docker-backed Postgres scripts.
|
|
149
|
+
- TypeScript `api-*`: usually Jest and `tests/index.test.ts`.
|
|
150
|
+
- `pkg-*`: Mocha plus TypeScript type tests where present.
|
|
151
|
+
- `app-dashboard`: Vitest, React Testing Library, mock API tests, and Selenium for end-to-end flows.
|
|
140
152
|
- For database tests, use existing seed, migration, rollback, and cleanup patterns. Keep tests isolated and make cleanup reliable even after failures.
|
|
141
153
|
- Add tests for API success responses, validation errors, auth/authz errors, JWT errors, not-found/conflict cases, and unexpected error handling when those paths change.
|
|
142
154
|
- For frontend changes, test rendered UI, public HTTP or network outcomes, navigation, accessibility, and user-visible flows at the narrowest practical level first. Use focused non-test dependency checks for validation, transform, query, mutation, hook, and module organization.
|
package/AGENTS.md
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Agent Instructions
|
|
2
|
+
|
|
3
|
+
## Mandatory startup for every agent
|
|
4
|
+
|
|
5
|
+
Every agent, including Codex, Claude, other assistants, and delegated agents,
|
|
6
|
+
must read and follow [carecard-must-do](.agents/skills/carecard-must-do/SKILL.md)
|
|
7
|
+
before beginning or resuming any task. This includes planning, questions,
|
|
8
|
+
read-only investigation, coding, review, documentation, and validation.
|
|
9
|
+
|
|
10
|
+
Then load the [repository engineering standards](.agents/skills/pkg-validate-coding-standards-and-best-practices/SKILL.md)
|
|
11
|
+
and the specialist skills relevant to the task.
|
|
12
|
+
An agent without automatic skill discovery must open the skill explicitly;
|
|
13
|
+
the requirement applies regardless of the agent platform.
|
|
2
14
|
|
|
3
15
|
## Non-negotiable Codex banked-reset requirement
|
|
4
16
|
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Repository Agent Instructions
|
|
2
|
+
|
|
3
|
+
## Mandatory startup for every agent
|
|
4
|
+
|
|
5
|
+
Every agent, including Codex, Claude, other assistants, and delegated agents,
|
|
6
|
+
must read and follow [carecard-must-do](.agents/skills/carecard-must-do/SKILL.md)
|
|
7
|
+
before beginning or resuming any task. This includes planning, questions,
|
|
8
|
+
read-only investigation, coding, review, documentation, and validation.
|
|
9
|
+
|
|
10
|
+
Then load the [repository engineering standards](.agents/skills/pkg-validate-coding-standards-and-best-practices/SKILL.md)
|
|
11
|
+
and the specialist skills relevant to the task.
|
|
12
|
+
An agent without automatic skill discovery must open the skill explicitly;
|
|
13
|
+
the requirement applies regardless of the agent platform.
|
|
14
|
+
|
|
15
|
+
Also read [AGENTS.md](AGENTS.md) for the full repository instructions.
|
|
16
|
+
|
|
17
|
+
## Existing repository isolation contract
|
|
18
|
+
|
|
19
|
+
Non-negotiable repository isolation rule: Every repository must run its Husky
|
|
20
|
+
hooks and tests using only files, code, fixtures, dependencies, and services
|
|
21
|
+
contained within that repository. Tests and Husky scripts must not import,
|
|
22
|
+
require, read, execute, or otherwise depend on sibling repositories or paths
|
|
23
|
+
outside the repository root. app-e2e-tests is the only exception because
|
|
24
|
+
cross-repository end-to-end testing is its explicit responsibility.
|
|
25
|
+
|
|
26
|
+
Also apply [$carecard-workspace-standards](.agents/skills/carecard-workspace-standards/SKILL.md)
|
|
27
|
+
for the mandatory TDD and code organization rules.
|
|
28
|
+
|
|
29
|
+
## Existing test-preservation policy
|
|
30
|
+
|
|
31
|
+
The TDD and validation requirements are non-negotiable and cannot be
|
|
32
|
+
overridden. The separate pre-existing-test protection still requires the
|
|
33
|
+
user's fresh, explicit permission for each exact proposed test modification.
|
|
34
|
+
|
|
35
|
+
A pre-existing test—defined as any test present before work on the current task
|
|
36
|
+
begins—must not be deleted, disabled, skipped, weakened, excluded from execution,
|
|
37
|
+
or otherwise removed. A pre-existing test must not be modified without the
|
|
38
|
+
user's explicit approval for the exact proposed change. If changing a
|
|
39
|
+
pre-existing test is believed necessary, stop before making the change and
|
|
40
|
+
request approval. The request must identify every affected test, describe the
|
|
41
|
+
precise proposed modification, provide detailed technical justification, and
|
|
42
|
+
explain all known or reasonably foreseeable regression risks. Until approval is
|
|
43
|
+
granted, leave every pre-existing test unchanged.
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
error: { throwBadInputError },
|
|
5
|
-
} = require('@carecard/common-util');
|
|
3
|
+
const { throwBadInputError } = require('@carecard/common-util/errors');
|
|
6
4
|
const { isUserRoleRequestRoleString } = require('./validate');
|
|
7
5
|
|
|
8
6
|
const DEFAULT_USER_ROLE_REQUEST_ROLE = 'student';
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
caseConverter: { keysToSnakeCase },
|
|
6
|
-
} = require('@carecard/common-util');
|
|
3
|
+
const { keysToSnakeCase } = require('@carecard/common-util/case-converter');
|
|
4
|
+
const { throwBadInputError } = require('@carecard/common-util/errors');
|
|
7
5
|
|
|
8
6
|
const { validateProperties } = require('./validateProperties');
|
|
9
7
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carecard/validate",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.29.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/CareCard-ca/pkg-validate.git"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"typescript": "6.0.3"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@carecard/common-util": "3.
|
|
50
|
+
"@carecard/common-util": "3.29.0"
|
|
51
51
|
},
|
|
52
52
|
"nyc": {
|
|
53
53
|
"all": true,
|
|
@@ -67,6 +67,6 @@
|
|
|
67
67
|
"glob": "13.0.6",
|
|
68
68
|
"minimatch": "10.2.6",
|
|
69
69
|
"serialize-javascript": "7.0.5",
|
|
70
|
-
"js-yaml": "4.3.
|
|
70
|
+
"js-yaml": "4.3.2"
|
|
71
71
|
}
|
|
72
72
|
}
|
package/readme.md
CHANGED
|
@@ -54,6 +54,11 @@ General validators are available both as top-level exports and under the
|
|
|
54
54
|
deprecated `validate` namespace. `validatePassword` is intentionally available
|
|
55
55
|
only as one direct export.
|
|
56
56
|
|
|
57
|
+
The package root is safe to import from browser bundles. Its whitelist and role
|
|
58
|
+
request validators use the focused `@carecard/common-util/case-converter` and
|
|
59
|
+
`@carecard/common-util/errors` entrypoints, so importing `isEmailString` does
|
|
60
|
+
not load server-only request context or trace storage.
|
|
61
|
+
|
|
57
62
|
```js
|
|
58
63
|
isEmailString('jane@example.com'); // true
|
|
59
64
|
validate.isEmailString('jane@example.com'); // true
|
|
@@ -204,12 +209,12 @@ await validateWhitelistProperties(input, ['user.first_name', 'user.contact.email
|
|
|
204
209
|
|
|
205
210
|
### Options
|
|
206
211
|
|
|
207
|
-
| Option | Default | Behavior
|
|
208
|
-
| -------------------- | -------- |
|
|
209
|
-
| `optionalProperties` | `[]` | Additional property paths that may be present. Absent optional paths are ignored. Present optional paths must be valid.
|
|
210
|
-
| `convertToSnakeCase` | `false` | When `true`, converts returned keys, including nested keys, to snake_case using `@carecard/common-util
|
|
211
|
-
| `flattenOutput` | `false` | When `true`, removes nested objects from the returned value so every validated leaf becomes a top-level key.
|
|
212
|
-
| `flattenKeyStyle` | `'path'` | Controls flattened key naming when `flattenOutput` is `true`. Use `'path'` for full dot-notation keys or `'leaf'` for direct leaf names. Invalid values throw a `BAD_INPUT` error.
|
|
212
|
+
| Option | Default | Behavior |
|
|
213
|
+
| -------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
214
|
+
| `optionalProperties` | `[]` | Additional property paths that may be present. Absent optional paths are ignored. Present optional paths must be valid. |
|
|
215
|
+
| `convertToSnakeCase` | `false` | When `true`, converts returned keys, including nested keys, to snake_case using the browser-safe `@carecard/common-util/case-converter` entrypoint. Conversion happens before flattening. |
|
|
216
|
+
| `flattenOutput` | `false` | When `true`, removes nested objects from the returned value so every validated leaf becomes a top-level key. |
|
|
217
|
+
| `flattenKeyStyle` | `'path'` | Controls flattened key naming when `flattenOutput` is `true`. Use `'path'` for full dot-notation keys or `'leaf'` for direct leaf names. Invalid values throw a `BAD_INPUT` error. |
|
|
213
218
|
|
|
214
219
|
Example with only the default options:
|
|
215
220
|
|