@carecard/validate 3.10.0 → 3.12.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.
@@ -3,12 +3,29 @@ name: carecard-workspace-standards
3
3
  description: 'Follow the shared SO_CareCardCa/CareCard workspace coding, testing, repository, dependency, shared package, frontend, database, API response, and security standards. Use before modifying, testing, reviewing, or debugging any ms-*, pkg-*, app-*, website, dashboard, or other CareCard repository in this workspace, especially when choosing validation commands, package boundaries, TypeScript types, dependencies, API contracts, database logic, service patterns, or frontend architecture.'
4
4
  ---
5
5
 
6
+ Non-negotiable root-cause solution rule: Always identify and solve the verified root cause, use the stronger solution, and deliver a correct, durable, production-quality result. Never treat a temporary workaround, resource increase, retry, suppression, bypass, or symptom-only patch as completion. Validate the root-cause fix against the real failing workflow and prove the end state.
7
+
6
8
  # CareCard Workspace Standards
7
9
 
8
10
  Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
9
11
 
12
+ This requirement is non-negotiable and may be overridden only with the user's
13
+ explicit, direct approval.
14
+
15
+ A pre-existing test—defined as any test present before work on the current task
16
+ begins—must not be deleted, disabled, skipped, weakened, excluded from execution,
17
+ or otherwise removed. A pre-existing test must not be modified without the
18
+ user's explicit approval for the exact proposed change. If changing a
19
+ pre-existing test is believed necessary, stop before making the change and
20
+ request approval. The request must identify every affected test, describe the
21
+ precise proposed modification, provide detailed technical justification, and
22
+ explain all known or reasonably foreseeable regression risks. Until approval is
23
+ granted, leave every pre-existing test unchanged.
24
+
10
25
  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.
11
26
 
27
+ Non-negotiable error and warning rule: Never suppress, silence, hide, downgrade, filter, ignore, skip, or bypass errors or warnings from code, tests, tools, compilers, linters, or validation. Fix the root cause, then rerun the affected check and require a clean result. Expected error-path tests may assert errors, but must not conceal unexpected failures.
28
+
12
29
  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.
13
30
 
14
31
  ## Purpose
@@ -85,7 +102,7 @@ config.
85
102
  - Never suppress errors, TypeScript errors, linter warnings, authorization
86
103
  failures, RLS failures, build failures, hydration issues, or failing tests.
87
104
  Do not add `eslint-disable`, `@ts-ignore`, broad catches, empty catches, or
88
- similar suppression unless explicitly requested.
105
+ similar suppression. Fix the root cause.
89
106
  - Do not add dependencies unless clearly necessary. If one might be needed, ask
90
107
  first with the reason, tradeoff, and why existing code cannot solve it.
91
108
  - Before finalizing repository work, run the affected repository's relevant
@@ -215,7 +232,7 @@ build artifacts, logs, or `.DS_Store`.
215
232
  Most JavaScript `ms-*` services use CommonJS, Mocha, Supertest, Docker Compose
216
233
  database tests, `@carecard/*` packages, and `sub-apps`
217
234
  controller/router/model patterns. TypeScript services such as `ms-messages`
218
- and `ms-template-ts` use Jest or TypeScript tooling and should keep their
235
+ use Jest or TypeScript tooling and should keep their
219
236
  existing TypeScript style.
220
237
 
221
238
  - Keep environment-specific files explicit: `.env.development`, `.env.test`,
@@ -380,7 +397,7 @@ the authenticated dashboard.
380
397
 
381
398
  ## Auth Service RLS Contract
382
399
 
383
- - `ms-auth` follows the shared PostgreSQL/RLS pattern from `ms-template-js`: 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.
400
+ - `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.
384
401
  - 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.
385
402
  - 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.
386
403
  - 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.
@@ -3,12 +3,16 @@ name: github-pr-create-update
3
3
  description: 'Use only when the user explicitly asks for remote Git or GitHub PR work: pushing a branch, creating or updating a PR, or marking a PR ready from the current repository branch into development or main.'
4
4
  ---
5
5
 
6
+ Non-negotiable root-cause solution rule: Always identify and solve the verified root cause, use the stronger solution, and deliver a correct, durable, production-quality result. Never treat a temporary workaround, resource increase, retry, suppression, bypass, or symptom-only patch as completion. Validate the root-cause fix against the real failing workflow and prove the end state.
7
+
6
8
  # Pull Request Create
7
9
 
8
10
  Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
9
11
 
10
12
  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.
11
13
 
14
+ Non-negotiable error and warning rule: Never suppress, silence, hide, downgrade, filter, ignore, skip, or bypass errors or warnings from code, tests, tools, compilers, linters, or validation. Fix the root cause, then rerun the affected check and require a clean result. Expected error-path tests may assert errors, but must not conceal unexpected failures.
15
+
12
16
  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.
13
17
 
14
18
  ## Purpose
@@ -77,14 +81,20 @@ Do not continue automatically when:
77
81
  when `origin/development` is absent:
78
82
 
79
83
  ```sh
80
- if git ls-remote --exit-code --heads origin development >/dev/null 2>&1; then
81
- base="development"
82
- elif git ls-remote --exit-code --heads origin main >/dev/null 2>&1; then
83
- base="main"
84
- else
85
- echo "No origin/development or origin/main branch exists."
86
- exit 1
84
+ remote_base_refs="$(git ls-remote --heads origin development main)"
85
+ remote_query_status=$?
86
+ if [ "$remote_query_status" -ne 0 ]; then
87
+ printf 'Unable to inspect origin base branches (exit %s).\n' "$remote_query_status" >&2
88
+ exit "$remote_query_status"
87
89
  fi
90
+ case "$remote_base_refs" in
91
+ *"refs/heads/development") base="development" ;;
92
+ *"refs/heads/main") base="main" ;;
93
+ *)
94
+ printf '%s\n' "No origin/development or origin/main branch exists." >&2
95
+ exit 1
96
+ ;;
97
+ esac
88
98
  git fetch origin "$base" --prune
89
99
  ```
90
100
 
@@ -3,12 +3,16 @@ name: github-pr-merge-cleanup
3
3
  description: 'Use only when the user explicitly asks for remote Git or GitHub PR work: pushing a branch, creating a missing PR, reviewing mergeability, validating, merging, deleting, or cleaning up a pull request branch.'
4
4
  ---
5
5
 
6
+ Non-negotiable root-cause solution rule: Always identify and solve the verified root cause, use the stronger solution, and deliver a correct, durable, production-quality result. Never treat a temporary workaround, resource increase, retry, suppression, bypass, or symptom-only patch as completion. Validate the root-cause fix against the real failing workflow and prove the end state.
7
+
6
8
  # Pull Request Merge Close
7
9
 
8
10
  Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
9
11
 
10
12
  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.
11
13
 
14
+ Non-negotiable error and warning rule: Never suppress, silence, hide, downgrade, filter, ignore, skip, or bypass errors or warnings from code, tests, tools, compilers, linters, or validation. Fix the root cause, then rerun the affected check and require a clean result. Expected error-path tests may assert errors, but must not conceal unexpected failures.
15
+
12
16
  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.
13
17
 
14
18
  ## Purpose
@@ -74,14 +78,20 @@ completion.
74
78
 
75
79
  ```sh
76
80
  gh auth status
77
- if git ls-remote --exit-code --heads origin development >/dev/null 2>&1; then
78
- base="development"
79
- elif git ls-remote --exit-code --heads origin main >/dev/null 2>&1; then
80
- base="main"
81
- else
82
- echo "No origin/development or origin/main branch exists."
83
- exit 1
81
+ remote_base_refs="$(git ls-remote --heads origin development main)"
82
+ remote_query_status=$?
83
+ if [ "$remote_query_status" -ne 0 ]; then
84
+ printf 'Unable to inspect origin base branches (exit %s).\n' "$remote_query_status" >&2
85
+ exit "$remote_query_status"
84
86
  fi
87
+ case "$remote_base_refs" in
88
+ *"refs/heads/development") base="development" ;;
89
+ *"refs/heads/main") base="main" ;;
90
+ *)
91
+ printf '%s\n' "No origin/development or origin/main branch exists." >&2
92
+ exit 1
93
+ ;;
94
+ esac
85
95
  target_branch="$(git branch --show-current)"
86
96
  test -n "$target_branch"
87
97
  test "$target_branch" != "$base"
@@ -171,7 +181,19 @@ completion.
171
181
  not protected:
172
182
 
173
183
  ```sh
174
- protected="$(gh api "repos/{owner}/{repo}/branches/$target_branch" --jq '.protected' 2>/dev/null || echo false)"
184
+ protected="$(gh api "repos/{owner}/{repo}/branches/$target_branch" --jq '.protected')"
185
+ protection_query_status=$?
186
+ if [ "$protection_query_status" -ne 0 ]; then
187
+ printf 'Unable to inspect branch protection (exit %s).\n' "$protection_query_status" >&2
188
+ exit "$protection_query_status"
189
+ fi
190
+ case "$protected" in
191
+ true|false) ;;
192
+ *)
193
+ printf 'Unexpected branch protection value: %s\n' "$protected" >&2
194
+ exit 1
195
+ ;;
196
+ esac
175
197
  if [ "$protected" = true ]; then
176
198
  gh pr merge "$pr_number" --squash --admin
177
199
  else
@@ -183,8 +205,16 @@ completion.
183
205
  delete it explicitly:
184
206
 
185
207
  ```sh
186
- if [ "$protected" != true ] && git ls-remote --exit-code --heads origin "$target_branch" >/dev/null 2>&1; then
187
- git push origin --delete "$target_branch"
208
+ if [ "$protected" != true ]; then
209
+ remote_target_ref="$(git ls-remote --heads origin "$target_branch")"
210
+ remote_query_status=$?
211
+ if [ "$remote_query_status" -ne 0 ]; then
212
+ printf 'Unable to inspect the remote target branch (exit %s).\n' "$remote_query_status" >&2
213
+ exit "$remote_query_status"
214
+ fi
215
+ if [ -n "$remote_target_ref" ]; then
216
+ git push origin --delete "$target_branch"
217
+ fi
188
218
  fi
189
219
  ```
190
220
 
@@ -3,12 +3,16 @@ name: logged-in-user-profile-page
3
3
  description: 'Use when changing shared validation behavior for app-dashboard logged-in profile/settings fields, especially phone number and country-code request aliases.'
4
4
  ---
5
5
 
6
+ Non-negotiable root-cause solution rule: Always identify and solve the verified root cause, use the stronger solution, and deliver a correct, durable, production-quality result. Never treat a temporary workaround, resource increase, retry, suppression, bypass, or symptom-only patch as completion. Validate the root-cause fix against the real failing workflow and prove the end state.
7
+
6
8
  # Logged-In User Profile Page
7
9
 
8
10
  Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
9
11
 
10
12
  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.
11
13
 
14
+ Non-negotiable error and warning rule: Never suppress, silence, hide, downgrade, filter, ignore, skip, or bypass errors or warnings from code, tests, tools, compilers, linters, or validation. Fix the root cause, then rerun the affected check and require a clean result. Expected error-path tests may assert errors, but must not conceal unexpected failures.
15
+
12
16
  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.
13
17
 
14
18
  ## Scope
@@ -3,12 +3,16 @@ name: pkg-publish
3
3
  description: 'Use when any pkg-* repository has non-Markdown package changes, including source code, public types, tests, scripts, package metadata, lockfiles, dependency behavior, or validation config, and the CareCard packages must be versioned, published in order with just-in-time package pushes, and propagated to pkg-*, ms-*, and app-dashboard consumers. Do not use for Markdown-only changes.'
4
4
  ---
5
5
 
6
+ Non-negotiable root-cause solution rule: Always identify and solve the verified root cause, use the stronger solution, and deliver a correct, durable, production-quality result. Never treat a temporary workaround, resource increase, retry, suppression, bypass, or symptom-only patch as completion. Validate the root-cause fix against the real failing workflow and prove the end state.
7
+
6
8
  # pkg Publish
7
9
 
8
10
  Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
9
11
 
10
12
  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.
11
13
 
14
+ Non-negotiable error and warning rule: Never suppress, silence, hide, downgrade, filter, ignore, skip, or bypass errors or warnings from code, tests, tools, compilers, linters, or validation. Fix the root cause, then rerun the affected check and require a clean result. Expected error-path tests may assert errors, but must not conceal unexpected failures.
15
+
12
16
  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.
13
17
 
14
18
  ## Trigger
@@ -3,12 +3,16 @@ name: pkg-validate-validation-library
3
3
  description: 'Use when changing pkg-validate validators, sanitizers, whitelist behavior, nested path rules, bad-input errors, package exports, or tests.'
4
4
  ---
5
5
 
6
+ Non-negotiable root-cause solution rule: Always identify and solve the verified root cause, use the stronger solution, and deliver a correct, durable, production-quality result. Never treat a temporary workaround, resource increase, retry, suppression, bypass, or symptom-only patch as completion. Validate the root-cause fix against the real failing workflow and prove the end state.
7
+
6
8
  # Package Validate
7
9
 
8
10
  Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
9
11
 
10
12
  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.
11
13
 
14
+ Non-negotiable error and warning rule: Never suppress, silence, hide, downgrade, filter, ignore, skip, or bypass errors or warnings from code, tests, tools, compilers, linters, or validation. Fix the root cause, then rerun the affected check and require a clean result. Expected error-path tests may assert errors, but must not conceal unexpected failures.
15
+
12
16
  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.
13
17
 
14
18
  ## Purpose
@@ -3,12 +3,16 @@ name: software-design-patterns-and-clean-code
3
3
  description: 'Use every time before coding, refactoring, debugging, or reviewing in this repository, alongside all other applicable skills, to apply pragmatic software design patterns, SOLID, Clean Code, and testable architecture.'
4
4
  ---
5
5
 
6
+ Non-negotiable root-cause solution rule: Always identify and solve the verified root cause, use the stronger solution, and deliver a correct, durable, production-quality result. Never treat a temporary workaround, resource increase, retry, suppression, bypass, or symptom-only patch as completion. Validate the root-cause fix against the real failing workflow and prove the end state.
7
+
6
8
  # Software Design Patterns And Clean Code
7
9
 
8
10
  Non-negotiable TDD rule: Always write the failing test first, run it to confirm it fails for the intended reason, then implement the code and rerun the test until it passes. Test Driven Development is required for all coding work and must not be skipped. For documentation- or skill-only edits, add or update the relevant validation check before changing the prose.
9
11
 
10
12
  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.
11
13
 
14
+ Non-negotiable error and warning rule: Never suppress, silence, hide, downgrade, filter, ignore, skip, or bypass errors or warnings from code, tests, tools, compilers, linters, or validation. Fix the root cause, then rerun the affected check and require a clean result. Expected error-path tests may assert errors, but must not conceal unexpected failures.
15
+
12
16
  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.
13
17
 
14
18
  ## Purpose
package/.codex/AGENTS.md CHANGED
@@ -4,6 +4,21 @@ Non-negotiable code organization rule: Functions with the same or equivalent beh
4
4
 
5
5
  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.
6
6
 
7
+ Non-negotiable error and warning rule: Never suppress, silence, hide, downgrade, filter, ignore, skip, or bypass errors or warnings from code, tests, tools, compilers, linters, or validation. Fix the root cause, then rerun the affected check and require a clean result. Expected error-path tests may assert errors, but must not conceal unexpected failures.
8
+
9
+ This requirement is non-negotiable and may be overridden only with the user's
10
+ explicit, direct approval.
11
+
12
+ A pre-existing test—defined as any test present before work on the current task
13
+ begins—must not be deleted, disabled, skipped, weakened, excluded from execution,
14
+ or otherwise removed. A pre-existing test must not be modified without the
15
+ user's explicit approval for the exact proposed change. If changing a
16
+ pre-existing test is believed necessary, stop before making the change and
17
+ request approval. The request must identify every affected test, describe the
18
+ precise proposed modification, provide detailed technical justification, and
19
+ explain all known or reasonably foreseeable regression risks. Until approval is
20
+ granted, leave every pre-existing test unchanged.
21
+
7
22
  These instructions apply to the `pkg-validate` repository. This file is self-contained:
8
23
  it includes the workspace-level instructions that were previously read from
9
24
  `/Users/pankajpriscilla/SO_CareCardCa/.codex/AGENTS.md`, followed by
@@ -21,7 +36,7 @@ These instructions apply to the whole workspace. The workspace is a collection o
21
36
  - **Always follow the owner's naming conventions.** Use meaningful function, variable, file, test, and type names that match the surrounding code.
22
37
  - **Always follow the existing project structure.** Put code, tests, docs, services, validation, transforms, components, and helpers where the current repository already expects them.
23
38
  - **Always use Test-Driven Development.** Write or update focused tests first, verify they fail for the missing behavior when practical, then implement the code.
24
- - **Never suppress errors, TypeScript errors, linter warnings, or failing tests.** Do not add `eslint-disable`, `@ts-ignore`, broad catches, empty catches, or other suppression unless the user explicitly requests it. Handle the issue properly.
39
+ - **Never suppress errors, TypeScript errors, linter warnings, or failing tests.** Do not add `eslint-disable`, `@ts-ignore`, broad catches, empty catches, or other suppression. Fix the root cause.
25
40
  - **Do not add new dependencies unless they are clearly necessary.** If a dependency might be needed, stop and ask for confirmation first, with a clear reason, tradeoff, and why existing code cannot reasonably solve it.
26
41
  - **Before finalizing any response for a repository, run every script in that repository's `.husky` directory.** Do not bypass hooks. If a `.husky` script fails, fix the underlying issue and rerun it. If it cannot run because of environment constraints, report the exact script and reason.
27
42
 
@@ -102,7 +102,7 @@ jobs:
102
102
  --head "$HEAD" \
103
103
  --base "$BASE" \
104
104
  --json number \
105
- --jq '.[0].number' || true)
105
+ --jq '.[0].number')
106
106
 
107
107
  if [[ -n "${EXISTING:-}" ]]; then
108
108
  echo "An open PR already exists for $HEAD -> $BASE (#$EXISTING). Updating PR metadata."
@@ -165,7 +165,7 @@ jobs:
165
165
  exit 0
166
166
  fi
167
167
 
168
- if ! gh issue view "$TICKET_NUMBER" --repo "$REPO" --json number >/dev/null 2>&1; then
168
+ if ! gh issue view "$TICKET_NUMBER" --repo "$REPO" --json number; then
169
169
  echo "GitHub issue #$TICKET_NUMBER was not found. Skipping ticket assignment."
170
170
  exit 0
171
171
  fi
@@ -45,7 +45,8 @@ jobs:
45
45
  echo "package_name=${package_name}" >> "$GITHUB_OUTPUT"
46
46
  echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
47
47
 
48
- if npm view "${package_name}@${package_version}" version >/dev/null 2>&1; then
48
+ published_versions="$(npm view "${package_name}" versions --json)"
49
+ if node -e 'const value=JSON.parse(process.argv[1]); const versions=Array.isArray(value) ? value : [value]; process.exit(versions.includes(process.argv[2]) ? 0 : 1);' "$published_versions" "$package_version"; then
49
50
  echo "${package_name}@${package_version} is already published."
50
51
  echo "should_publish=false" >> "$GITHUB_OUTPUT"
51
52
  else
package/lib/validate.js CHANGED
@@ -15,7 +15,8 @@ const isValidJsonString = str => {
15
15
  try {
16
16
  const json = JSON.parse(str);
17
17
  return typeof json === 'object' && json !== null;
18
- } catch {
18
+ } catch (error) {
19
+ if (!(error instanceof SyntaxError)) throw error;
19
20
  return false;
20
21
  }
21
22
  };
@@ -229,12 +230,10 @@ const isValidDateString = str => {
229
230
 
230
231
  const isValidUrl = url => {
231
232
  if (typeof url !== 'string' || url.length === 0 || url.length > 2048) return false;
232
- try {
233
- const parsedUrl = new URL(url);
234
- return parsedUrl.protocol === 'http:' || parsedUrl.protocol === 'https:';
235
- } catch {
236
- return false;
237
- }
233
+ if (!URL.canParse(url)) return false;
234
+
235
+ const parsedUrl = new URL(url);
236
+ return parsedUrl.protocol === 'http:' || parsedUrl.protocol === 'https:';
238
237
  };
239
238
  const isValidArrayOfStrings = arr => {
240
239
  if (!Array.isArray(arr)) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carecard/validate",
3
- "version": "3.10.0",
3
+ "version": "3.12.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/CareCard-ca/pkg-validate.git"
@@ -38,7 +38,7 @@
38
38
  "typescript": "6.0.3"
39
39
  },
40
40
  "dependencies": {
41
- "@carecard/common-util": "3.10.0"
41
+ "@carecard/common-util": "3.12.0"
42
42
  },
43
43
  "nyc": {
44
44
  "all": true,
@@ -54,6 +54,7 @@
54
54
  },
55
55
  "overrides": {
56
56
  "diff": "8.0.4",
57
+ "glob": "13.0.6",
57
58
  "serialize-javascript": "7.0.5",
58
59
  "js-yaml": "4.2.0"
59
60
  }
package/readme.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @carecard/validate
2
2
 
3
+ Non-negotiable root-cause solution rule: Always identify and solve the verified root cause, use the stronger solution, and deliver a correct, durable, production-quality result. Never treat a temporary workaround, resource increase, retry, suppression, bypass, or symptom-only patch as completion. Validate the root-cause fix against the real failing workflow and prove the end state.
4
+
3
5
  `@carecard/validate` is a small CommonJS validation package for CareCard
4
6
  services. It exposes individual value validators, a bulk property sanitizer, and
5
7
  a whitelist validator for request-like payloads.
@@ -15,6 +17,8 @@ Non-negotiable TDD rule: Always write the failing test first, run it to confirm
15
17
 
16
18
  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.
17
19
 
20
+ Non-negotiable error and warning rule: Never suppress, silence, hide, downgrade, filter, ignore, skip, or bypass errors or warnings from code, tests, tools, compilers, linters, or validation. Fix the root cause, then rerun the affected check and require a clean result. Expected error-path tests may assert errors, but must not conceal unexpected failures.
21
+
18
22
  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.
19
23
 
20
24
  ## Installation