json-rest-api 1.0.21 → 1.0.22
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/audit/00-charter.md +103 -0
- package/audit/01-scope-map.md +84 -0
- package/audit/02-coverage-matrix.csv +174 -0
- package/audit/03-invariants.md +123 -0
- package/audit/04-standards-rubric.md +56 -0
- package/audit/05-competitor-rubric.md +77 -0
- package/audit/06-findings.md +160 -0
- package/audit/07-risk-register.csv +10 -0
- package/audit/08-remediation-roadmap.md +177 -0
- package/audit/09-signoff-check.md +23 -0
- package/audit/10-final-synthesis.md +29 -0
- package/audit/evidence/code/all-files-json-rest-api.txt +168 -0
- package/audit/evidence/code/all-files-json-rest-schema.txt +12 -0
- package/audit/evidence/code/boundary-leak-checks.txt +72 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__bulk-operations-plugin.js.txt +480 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__express-plugin.js.txt +532 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__busboy-detector.js.txt +175 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__formidable-detector.js.txt +138 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__request-helpers.js.txt +222 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt +342 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__dbTablesOperations.js.txt +304 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__fractional-positioning.js.txt +188 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__compile-schemas.js.txt +336 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__connectors-query-parser.js.txt +165 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt +265 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-value-normalizers.js.txt +369 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__default-data-helpers.js.txt +72 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__field-utils.js.txt +139 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-constants.js.txt +45 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-field-helpers.js.txt +396 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-json-api-transformers.js.txt +162 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__payload-validators.js.txt +1314 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__schema-helpers.js.txt +488 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__scope-validations.js.txt +484 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__simplified-helpers.js.txt +857 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt +565 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-json-api-transformers-querying.js.txt +485 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-pagination-helpers.js.txt +560 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-process-includes.js.txt +167 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers-base.js.txt +109 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers.js.txt +1064 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt +1983 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-window-queries.js.txt +328 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__url-helpers.js.txt +119 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__storage__storage-adapter.js.txt +160 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__writing__many-to-many-manipulations.js.txt +300 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__writing__relationship-processor.js.txt +245 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-access.js.txt +459 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-cors-plugin.js.txt +237 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-knex-plugin.js.txt +1135 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt +314 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__compile-resource-schemas.js.txt +7 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__register-relationship-routes.js.txt +71 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__register-scope-routes.js.txt +102 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__turn-scope-init-into-vars.js.txt +49 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__validate-include-configurations.js.txt +39 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__add-route.js.txt +23 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__check-permissions.js.txt +13 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__common.js.txt +639 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__delete-relationship.js.txt +117 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__delete.js.txt +104 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__enrich-attributes.js.txt +199 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__get-related.js.txt +353 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__get-relationship.js.txt +61 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__get.js.txt +184 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__patch-relationship.js.txt +55 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__patch.js.txt +191 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__post-relationship.js.txt +110 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__post.js.txt +168 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__put.js.txt +253 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__query.js.txt +207 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__release.js.txt +12 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin.js.txt +165 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt +668 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt +621 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__local-storage.js.txt +218 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__s3-storage.js.txt +124 -0
- package/audit/evidence/code/critical-pass1/json-rest-schema__src__CorePlugin.js.txt +269 -0
- package/audit/evidence/code/critical-pass1/json-rest-schema__src__Schema.js.txt +242 -0
- package/audit/evidence/code/critical-pass1/json-rest-schema__src__index.js.txt +77 -0
- package/audit/evidence/code/critical-pass1-risk-keywords.txt +238 -0
- package/audit/evidence/code/critical-pass1-summary.csv +67 -0
- package/audit/evidence/code/critical-pass2-summary.csv +67 -0
- package/audit/evidence/code/early-silent-zones-no-test-token.txt +57 -0
- package/audit/evidence/code/error-model-signals.txt +98 -0
- package/audit/evidence/code/git-files-json-rest-api.txt +171 -0
- package/audit/evidence/code/git-files-json-rest-schema.txt +27 -0
- package/audit/evidence/code/hook-flow-signals.txt +282 -0
- package/audit/evidence/code/idproperty-signals.txt +157 -0
- package/audit/evidence/code/import-cycles-non-anyapi.txt +3 -0
- package/audit/evidence/code/import-hotspots-non-anyapi.txt +96 -0
- package/audit/evidence/code/imports-json-rest-api.txt +354 -0
- package/audit/evidence/code/imports-json-rest-schema.txt +15 -0
- package/audit/evidence/code/in-scope-files-json-rest-api.txt +160 -0
- package/audit/evidence/code/in-scope-files-json-rest-schema.txt +13 -0
- package/audit/evidence/code/non-anyapi-core-files.txt +101 -0
- package/audit/evidence/code/permission-signals.txt +193 -0
- package/audit/evidence/code/query-include-signals.txt +687 -0
- package/audit/evidence/code/transaction-signals.txt +28 -0
- package/audit/evidence/code/validation-signals.txt +650 -0
- package/audit/evidence/code/write-path-signals.txt +61 -0
- package/audit/evidence/docs/docs-claims-signals.txt +1075 -0
- package/audit/evidence/docs/schema-docs-claims-signals.txt +179 -0
- package/audit/evidence/external/corpus-freeze.md +21 -0
- package/audit/evidence/external/npm-competitor-metadata.txt +70 -0
- package/audit/evidence/external/npm-download-signals.txt +23 -0
- package/audit/evidence/external/npm-jsonapi-server.txt +8 -0
- package/audit/evidence/external/npm-modern-jsonapi-metadata.txt +38 -0
- package/audit/evidence/external/readme-fortune-signals.txt +26 -0
- package/audit/evidence/external/readme-fortune.md +165 -0
- package/audit/evidence/external/readme-json-api-serializer-signals.txt +80 -0
- package/audit/evidence/external/readme-json-api-serializer.md +690 -0
- package/audit/evidence/external/readme-jsonapi-serde-server-signals.txt +0 -0
- package/audit/evidence/external/readme-jsonapi-serde-server.md +22 -0
- package/audit/evidence/external/readme-jsonapi-serializer-signals.txt +63 -0
- package/audit/evidence/external/readme-jsonapi-serializer.md +315 -0
- package/audit/evidence/external/readme-jsonapi-server-signals.txt +19 -0
- package/audit/evidence/external/readme-jsonapi-server.md +104 -0
- package/audit/evidence/external/readme-nestjs-json-api-signals.txt +4 -0
- package/audit/evidence/external/readme-nestjs-json-api.md +94 -0
- package/audit/evidence/external/readme-yaser-json-api-nestjs-signals.txt +47 -0
- package/audit/evidence/external/readme-yaser-json-api-nestjs.md +447 -0
- package/audit/evidence/external/standard-jsonapi-snippets.txt +84 -0
- package/audit/evidence/external/standard-rfc-snippets.txt +168 -0
- package/audit/evidence/external/standards-sources.txt +6 -0
- package/audit/evidence/runtime/baseline-commits.txt +2 -0
- package/audit/evidence/runtime/db-adapter-assumptions.txt +3 -0
- package/audit/evidence/runtime/environment.txt +4 -0
- package/audit/evidence/runtime/invariant-runtime-mapping.md +38 -0
- package/audit/evidence/runtime/probe-patch-relationship-error.exitcode +1 -0
- package/audit/evidence/runtime/probe-patch-relationship-error.log +76 -0
- package/audit/evidence/runtime/probe-patch-relationship-error.mjs +67 -0
- package/audit/evidence/runtime/probe-patch-relationship-referenceerror.exitcode +1 -0
- package/audit/evidence/runtime/probe-patch-relationship-referenceerror.log +62 -0
- package/audit/evidence/runtime/probe-patch-relationship-referenceerror.mjs +47 -0
- package/audit/evidence/runtime/test-exitcodes.txt +4 -0
- package/audit/evidence/runtime/test-summary.md +107 -0
- package/audit/evidence/runtime/trace-anchors.txt +61 -0
- package/audit/evidence/tests/access-multitenancy-test-signals.txt +125 -0
- package/audit/evidence/tests/failing-tests-summary.txt +25 -0
- package/audit/evidence/tests/npm-test-json-rest-api.exitcode +1 -0
- package/audit/evidence/tests/npm-test-json-rest-api.log +5885 -0
- package/audit/evidence/tests/npm-test-json-rest-schema.exitcode +1 -0
- package/audit/evidence/tests/npm-test-json-rest-schema.log +356 -0
- package/audit/evidence/tests/query-include-test-signals.txt +948 -0
- package/audit/evidence/tests/relationship-test-signals.txt +223 -0
- package/audit/evidence/tests/skipped-tests.txt +10 -0
- package/audit/evidence/tests/test-suite-list-non-anyapi.txt +30 -0
- package/audit/evidence/tests/test-suite-list.txt +32 -0
- package/audit/subsystems/docs-drift.md +49 -0
- package/audit/subsystems/pass2-cross-review.md +131 -0
- package/audit/subsystems/plugins-access.md +51 -0
- package/audit/subsystems/plugins-bulk.md +50 -0
- package/audit/subsystems/plugins-cors.md +48 -0
- package/audit/subsystems/plugins-file.md +53 -0
- package/audit/subsystems/plugins-multihome.md +50 -0
- package/audit/subsystems/plugins-positioning.md +54 -0
- package/audit/subsystems/plugins-socketio.md +50 -0
- package/audit/subsystems/query-engine.md +61 -0
- package/audit/subsystems/relationships.md +55 -0
- package/audit/subsystems/rest-orchestration.md +66 -0
- package/audit/subsystems/schema-core.md +64 -0
- package/audit/subsystems/storage-knex.md +57 -0
- package/audit/subsystems/tests.md +48 -0
- package/audit/subsystems/transport-express.md +55 -0
- package/audit/traces/trace-read-get.md +22 -0
- package/audit/traces/trace-read-query.md +25 -0
- package/audit/traces/trace-relationship-endpoints.md +31 -0
- package/audit/traces/trace-write-delete.md +17 -0
- package/audit/traces/trace-write-patch.md +26 -0
- package/audit/traces/trace-write-post.md +22 -0
- package/audit/traces/trace-write-put.md +23 -0
- package/package.json +3 -3
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Subsystem: plugins-file (Pass 1)
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
- File handling plugin + storage backends (`local-storage`, `s3-storage`) + transport detector integration.
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
- Detect multipart/file uploads, validate schema-declared file constraints, upload via configured storage backend, and merge resulting URLs into write payloads.
|
|
8
|
+
|
|
9
|
+
## Key entry points
|
|
10
|
+
- `plugins/core/file-handling-plugin.js`
|
|
11
|
+
- `plugins/storage/local-storage.js`
|
|
12
|
+
- `plugins/storage/s3-storage.js`
|
|
13
|
+
- `plugins/core/connectors/lib/{busboy-detector,formidable-detector}.js`
|
|
14
|
+
|
|
15
|
+
## Core data flow
|
|
16
|
+
- Walkthrough (POST with file):
|
|
17
|
+
- [Verified][C5] `beforeProcessing` hook detects file-capable scope, runs detector registry, validates mime/size, uploads, then mutates `params.inputRecord.data.attributes` with stored value(s). Evidence: `file-handling-plugin.js:112-275`, `280-292`.
|
|
18
|
+
|
|
19
|
+
## Hook/control flow
|
|
20
|
+
- [Verified][C4] Detectors are transport-registered and protocol-agnostic via `api.rest.registerFileDetector`.
|
|
21
|
+
|
|
22
|
+
## Failure modes
|
|
23
|
+
- [Verified][C4] Upload failure throws validation error and attempts temp-file cleanup; cleanup failures only logged. Evidence: `file-handling-plugin.js:224-248`, `266-273`.
|
|
24
|
+
- [Inferred][C3] No built-in transactional compensation for already-uploaded files if DB write later fails; rollback of storage side effects depends on custom hooks/backends.
|
|
25
|
+
|
|
26
|
+
## Strengths
|
|
27
|
+
- [Verified][C4] Schema-driven file field detection avoids hardcoded upload logic.
|
|
28
|
+
- [Verified][C4] Required file checks handled both no-detector and missing-field cases.
|
|
29
|
+
|
|
30
|
+
## Risks
|
|
31
|
+
- R-FILE-001:
|
|
32
|
+
- [Inferred][C3] Potential orphaned files on downstream write rollback.
|
|
33
|
+
- R-FILE-002:
|
|
34
|
+
- [Unknown][C2] Large concurrent upload pressure not benchmarked.
|
|
35
|
+
|
|
36
|
+
## Missing tests
|
|
37
|
+
- [Inferred][C3] Add test that simulates upload success + DB failure to verify cleanup/compensation strategy.
|
|
38
|
+
|
|
39
|
+
## Explicit unknowns
|
|
40
|
+
- [Unknown][C2] Backend-specific consistency guarantees for S3/local under partial failures.
|
|
41
|
+
|
|
42
|
+
## Pass-1 confidence
|
|
43
|
+
- Overall: **C3-C4**.
|
|
44
|
+
|
|
45
|
+
## Evidence links
|
|
46
|
+
- `plugins/core/file-handling-plugin.js`
|
|
47
|
+
- `plugins/storage/local-storage.js`
|
|
48
|
+
- `plugins/storage/s3-storage.js`
|
|
49
|
+
- `docs/mini-guides/file-uploads-complete.md`
|
|
50
|
+
|
|
51
|
+
## Pass-2 cross-review status
|
|
52
|
+
- Reconciled in [pass2-cross-review.md](/home/merc/Development/current/json-rest-api/audit/subsystems/pass2-cross-review.md).
|
|
53
|
+
- Final assertion/confidence values in this report are considered pass-2 normalized.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Subsystem: plugins-multihome (Pass 1)
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
- Multi-tenant extraction/filter/enforcement plugin.
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
- Enforce tenant isolation by attaching tenant context, filtering queries, setting tenant field on writes, and checking ownership on single-resource operations.
|
|
8
|
+
|
|
9
|
+
## Key entry points
|
|
10
|
+
- `plugins/core/rest-api-multihome-plugin.js`
|
|
11
|
+
|
|
12
|
+
## Core data flow
|
|
13
|
+
- Walkthrough (tenant-scoped query + write):
|
|
14
|
+
- [Verified][C5] `transport:request` extracts tenant ID into `context.auth.multihome_id`. Evidence: `rest-api-multihome-plugin.js:65-84`.
|
|
15
|
+
- [Verified][C5] `knexQueryFiltering` adds tenant where clause for eligible scopes. Evidence: `rest-api-multihome-plugin.js:112-179`.
|
|
16
|
+
- [Verified][C4] `beforeSchemaValidate` enforces/sets tenant field on writes. Evidence: `rest-api-multihome-plugin.js:182-228`.
|
|
17
|
+
|
|
18
|
+
## Hook/control flow
|
|
19
|
+
- [Verified][C4] `checkPermissions` hook validates tenant ownership of `minimalRecord` for existing-resource operations. Evidence: `rest-api-multihome-plugin.js:232-287`.
|
|
20
|
+
|
|
21
|
+
## Failure modes
|
|
22
|
+
- [Verified][C4] For tenant mismatch, plugin throws generic errors with custom codes (`REST_API_RESOURCE` / `REST_API_FORBIDDEN`) instead of typed `RestApiResourceError`; transport mapping may produce non-uniform envelope semantics. Evidence: `rest-api-multihome-plugin.js:274-284`, `express-plugin.js:236-266`.
|
|
23
|
+
|
|
24
|
+
## Strengths
|
|
25
|
+
- [Verified][C5] Defense-in-depth: both query-time filtering and single-record permission checks.
|
|
26
|
+
- [Verified][C4] Explicit handling for excluded resources and missing-tenant policy toggles.
|
|
27
|
+
|
|
28
|
+
## Risks
|
|
29
|
+
- R-MULTI-001:
|
|
30
|
+
- [Inferred][C3] Error typing inconsistency can alter client-observed semantics across connectors.
|
|
31
|
+
- R-MULTI-002:
|
|
32
|
+
- [Unknown][C2] Dependence on extractor correctness (subdomain/header) may cause tenant mis-assignment if upstream proxy headers are untrusted.
|
|
33
|
+
|
|
34
|
+
## Missing tests
|
|
35
|
+
- [Inferred][C3] Add negative tests for malformed forwarded host/header extraction and spoofing scenarios.
|
|
36
|
+
|
|
37
|
+
## Explicit unknowns
|
|
38
|
+
- [Unknown][C2] Full trust-boundary hardening at edge proxy layer is not inspectable from this repo alone.
|
|
39
|
+
|
|
40
|
+
## Pass-1 confidence
|
|
41
|
+
- Overall: **C4**.
|
|
42
|
+
|
|
43
|
+
## Evidence links
|
|
44
|
+
- `plugins/core/rest-api-multihome-plugin.js`
|
|
45
|
+
- `tests/multihome.test.js`
|
|
46
|
+
- `audit/evidence/tests/access-multitenancy-test-signals.txt`
|
|
47
|
+
|
|
48
|
+
## Pass-2 cross-review status
|
|
49
|
+
- Reconciled in [pass2-cross-review.md](/home/merc/Development/current/json-rest-api/audit/subsystems/pass2-cross-review.md).
|
|
50
|
+
- Final assertion/confidence values in this report are considered pass-2 normalized.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Subsystem: plugins-positioning (Pass 1)
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
- Fractional positioning plugin and helper math.
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
- Compute and persist sortable position values with optional group filters and `beforeId` insertion semantics.
|
|
8
|
+
|
|
9
|
+
## Key entry points
|
|
10
|
+
- `plugins/core/rest-api-positioning-plugin.js`
|
|
11
|
+
- `plugins/core/lib/fractional-positioning.js`
|
|
12
|
+
|
|
13
|
+
## Core data flow
|
|
14
|
+
- Walkthrough (PATCH with `beforeId`):
|
|
15
|
+
- [Verified][C4] `beforeSchemaValidate` strips `beforeId` and managed `position` from client payload, storing intent in context. Evidence: `rest-api-positioning-plugin.js:257-323`.
|
|
16
|
+
- [Verified][C4] `beforeDataCallPatch` computes target position using grouped query and writes computed position into `context.inputRecord.data.attributes` before storage update. Evidence: `rest-api-positioning-plugin.js:339-345`, `347-545`.
|
|
17
|
+
|
|
18
|
+
## Hook/control flow
|
|
19
|
+
- [Verified][C4] Uses method-specific `beforeDataCall*` hooks, plus optional query-sort default hook (`beforeQuery`). Evidence: `rest-api-positioning-plugin.js:326-345`, `574-589`.
|
|
20
|
+
|
|
21
|
+
## Failure modes
|
|
22
|
+
- [Inferred][C3] Concurrent reordering operations can still race without explicit row locking; final ordering correctness depends on DB isolation and retry strategy.
|
|
23
|
+
- [Verified][C3] Index creation best-effort errors are downgraded to warnings, which can hide performance regressions. Evidence: `rest-api-positioning-plugin.js:251-253`.
|
|
24
|
+
|
|
25
|
+
## Strengths
|
|
26
|
+
- [Verified][C4] Adapter-aware filter-to-column translation and scoped grouping logic.
|
|
27
|
+
- [Verified][C4] Prevents direct client overwrite of managed position field.
|
|
28
|
+
|
|
29
|
+
## Risks
|
|
30
|
+
- R-POS-001:
|
|
31
|
+
- [Inferred][C3] Concurrency ordering race risk under heavy writes.
|
|
32
|
+
- R-POS-002:
|
|
33
|
+
- [Inferred][C3] Silent index-create failure can degrade query/update performance.
|
|
34
|
+
|
|
35
|
+
## Missing tests
|
|
36
|
+
- [Inferred][C3] Add concurrent reorder tests (same group, multiple writers).
|
|
37
|
+
- [Unknown][C2] No observed tests for index-creation fallback path.
|
|
38
|
+
|
|
39
|
+
## Explicit unknowns
|
|
40
|
+
- [Unknown][C2] Long-term rebalance behavior once `rebalanceThreshold` is exceeded.
|
|
41
|
+
|
|
42
|
+
## Pass-1 confidence
|
|
43
|
+
- Overall: **C3-C4**.
|
|
44
|
+
|
|
45
|
+
## Evidence links
|
|
46
|
+
- `plugins/core/rest-api-positioning-plugin.js`
|
|
47
|
+
- `plugins/core/lib/fractional-positioning.js`
|
|
48
|
+
- `tests/positioning.test.js`
|
|
49
|
+
- `tests/positioning-advanced.test.js`
|
|
50
|
+
- `tests/positioning-extended.test.js`
|
|
51
|
+
|
|
52
|
+
## Pass-2 cross-review status
|
|
53
|
+
- Reconciled in [pass2-cross-review.md](/home/merc/Development/current/json-rest-api/audit/subsystems/pass2-cross-review.md).
|
|
54
|
+
- Final assertion/confidence values in this report are considered pass-2 normalized.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Subsystem: plugins-socketio (Pass 1)
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
- Socket.IO realtime subscription and broadcast plugin.
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
- Allow clients to subscribe to resource updates with filter validation and emit events after successful write lifecycles.
|
|
8
|
+
|
|
9
|
+
## Key entry points
|
|
10
|
+
- `plugins/core/socketio-plugin.js`
|
|
11
|
+
|
|
12
|
+
## Core data flow
|
|
13
|
+
- Walkthrough (write -> broadcast):
|
|
14
|
+
- [Verified][C4] `finish` hook queues broadcasts when a transaction exists; `afterCommit` flushes; `afterRollback` drops pending messages. Evidence: `socketio-plugin.js:576-619`.
|
|
15
|
+
- [Verified][C4] Subscription registration validates resource existence, query permission, filter schema, include/fields shape, then joins room. Evidence: `socketio-plugin.js:161-288`.
|
|
16
|
+
|
|
17
|
+
## Hook/control flow
|
|
18
|
+
- [Verified][C4] Broadcast filtering uses `searchSchemaStructure` and `matchesFilters` against minimal record context.
|
|
19
|
+
|
|
20
|
+
## Failure modes
|
|
21
|
+
- [Inferred][C3] If `minimalRecord` lacks attributes needed for subscription filters, updates may be under/over-delivered depending on filter type.
|
|
22
|
+
- [Unknown][C2] Backpressure and memory behavior under very high subscription fanout not verified.
|
|
23
|
+
|
|
24
|
+
## Strengths
|
|
25
|
+
- [Verified][C4] Commit-aware broadcast deferral avoids notifying on rolled-back mutations.
|
|
26
|
+
- [Verified][C4] Optional Redis adapter support for horizontal scaling.
|
|
27
|
+
|
|
28
|
+
## Risks
|
|
29
|
+
- R-SOCKET-001:
|
|
30
|
+
- [Inferred][C3] Filter evaluation fidelity depends on minimal record shape.
|
|
31
|
+
- R-SOCKET-002:
|
|
32
|
+
- [Unknown][C2] Throughput limits and queue growth under load.
|
|
33
|
+
|
|
34
|
+
## Missing tests
|
|
35
|
+
- [Inferred][C3] Add explicit tests for afterRollback suppression and post-commit-only delivery with failing writes.
|
|
36
|
+
- [Unknown][C2] Load/fanout tests absent.
|
|
37
|
+
|
|
38
|
+
## Explicit unknowns
|
|
39
|
+
- [Unknown][C2] Ordering guarantees across clustered deployments with Redis adapter under network partitions.
|
|
40
|
+
|
|
41
|
+
## Pass-1 confidence
|
|
42
|
+
- Overall: **C3-C4**.
|
|
43
|
+
|
|
44
|
+
## Evidence links
|
|
45
|
+
- `plugins/core/socketio-plugin.js`
|
|
46
|
+
- `tests/socketio.test.js`
|
|
47
|
+
|
|
48
|
+
## Pass-2 cross-review status
|
|
49
|
+
- Reconciled in [pass2-cross-review.md](/home/merc/Development/current/json-rest-api/audit/subsystems/pass2-cross-review.md).
|
|
50
|
+
- Final assertion/confidence values in this report are considered pass-2 normalized.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Subsystem: query-engine (Pass 1)
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
- Query parsing, filtering, sorting, pagination, include loading, and response shaping.
|
|
5
|
+
- Exclusion: anyapi-only query branches.
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
- Implement JSON:API-style collection/single retrieval with filters, sparse fieldsets, includes, and pagination.
|
|
9
|
+
|
|
10
|
+
## Key entry points
|
|
11
|
+
- `plugins/core/rest-api-plugin-methods/query.js`
|
|
12
|
+
- `plugins/core/lib/querying-writing/payload-validators.js`
|
|
13
|
+
- `plugins/core/lib/querying/knex-query-helpers.js`
|
|
14
|
+
- `plugins/core/lib/querying/knex-relationship-includes.js`
|
|
15
|
+
- `plugins/core/lib/querying-writing/knex-field-helpers.js`
|
|
16
|
+
- `plugins/core/lib/querying-writing/connectors-query-parser.js`
|
|
17
|
+
|
|
18
|
+
## Core data flow
|
|
19
|
+
- Walkthrough (query + include):
|
|
20
|
+
- [Verified][C5] Query payload parsed/validated, then permission gate runs before `helpers.dataQuery`. Evidence: `query.js:75-137`.
|
|
21
|
+
- [Verified][C5] `dataQuery` builds field selection, runs filter hooks, applies sort/pagination, then relationship identifiers/includes and JSON:API transformation. Evidence: `rest-api-knex-plugin.js:448-880`.
|
|
22
|
+
- [Verified][C4] Include engine batches by relationship type and parent IDs (not per-record) for standard hasMany/manyToMany identifier loading. Evidence: `knex-relationship-includes.js:595-625`, `1876-1903`, `1925-1927`.
|
|
23
|
+
|
|
24
|
+
## Hook/control flow
|
|
25
|
+
- [Verified][C4] Filtering hook chain order is explicit: polymorphic -> cross-table -> basic. Evidence: `rest-api-knex-plugin.js:152-163` and hook helper docs in `knex-query-helpers.js`.
|
|
26
|
+
|
|
27
|
+
## Failure modes
|
|
28
|
+
- [Verified][C4] Unknown sparse fields throw hard errors; hidden fields are suppressed even if requested. Evidence: `knex-field-helpers.js:203`, `209-214`.
|
|
29
|
+
- [Inferred][C3] Include recursion still risks high query volume at deep nesting despite per-layer batching; worst-case behavior depends on relationship fanout. Evidence: `knex-relationship-includes.js:1598-1727`.
|
|
30
|
+
- [Inferred][C3] Query string generation may produce duplicated delimiters (`&&`) in some link paths (doc examples show this pattern), creating cosmetic interoperability risk.
|
|
31
|
+
|
|
32
|
+
## Strengths
|
|
33
|
+
- [Verified][C5] Strong validation on include depth, sort whitelist, page param types.
|
|
34
|
+
- [Verified][C4] `idProperty` handling is deeply integrated in selection, includes, and pagination cursor construction.
|
|
35
|
+
|
|
36
|
+
## Risks
|
|
37
|
+
- R-QUERY-001:
|
|
38
|
+
- [Inferred][C3] Potential performance cliff on deep includes with high cardinality.
|
|
39
|
+
- R-QUERY-002:
|
|
40
|
+
- [Unknown][C2] Window-strategy fallback behavior across all supported SQL dialects not yet runtime-confirmed.
|
|
41
|
+
|
|
42
|
+
## Missing tests
|
|
43
|
+
- [Inferred][C3] Expand high-cardinality include tests with explicit query-count assertions.
|
|
44
|
+
- [Verified][C4] Some multi-field cursor cases are skipped in suite (`pagination-cursor-multifield.test.js` has skipped tests).
|
|
45
|
+
|
|
46
|
+
## Explicit unknowns
|
|
47
|
+
- [Unknown][C2] Practical N+1 envelope under production dataset shape.
|
|
48
|
+
|
|
49
|
+
## Pass-1 confidence
|
|
50
|
+
- Overall: **C4** on correctness path; **C2-C3** on large-scale performance bounds.
|
|
51
|
+
|
|
52
|
+
## Evidence links
|
|
53
|
+
- `plugins/core/rest-api-plugin-methods/query.js`
|
|
54
|
+
- `plugins/core/lib/querying/knex-relationship-includes.js`
|
|
55
|
+
- `plugins/core/lib/querying-writing/knex-field-helpers.js`
|
|
56
|
+
- `audit/evidence/code/query-include-signals.txt`
|
|
57
|
+
- `audit/evidence/tests/query-include-test-signals.txt`
|
|
58
|
+
|
|
59
|
+
## Pass-2 cross-review status
|
|
60
|
+
- Reconciled in [pass2-cross-review.md](/home/merc/Development/current/json-rest-api/audit/subsystems/pass2-cross-review.md).
|
|
61
|
+
- Final assertion/confidence values in this report are considered pass-2 normalized.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Subsystem: relationships (Pass 1)
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
- Relationship read/write methods and relationship processing helpers.
|
|
5
|
+
- Exclusion: anyapi-specific link backends.
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
- Keep relationship semantics consistent across `POST/PUT/PATCH` resource writes and explicit relationship endpoints.
|
|
9
|
+
|
|
10
|
+
## Key entry points
|
|
11
|
+
- `plugins/core/rest-api-plugin-methods/{get-related,get-relationship,post-relationship,patch-relationship,delete-relationship}.js`
|
|
12
|
+
- `plugins/core/lib/writing/{relationship-processor,many-to-many-manipulations}.js`
|
|
13
|
+
|
|
14
|
+
## Core data flow
|
|
15
|
+
- Walkthrough (PATCH relationship endpoint):
|
|
16
|
+
- [Verified][C4] `patchRelationship` proxies to scope `patch` with synthesized `inputRecord.data.relationships`. Evidence: `patch-relationship.js:27-42`.
|
|
17
|
+
- [Verified][C5] Resource-level `patch` then executes standard validation, permission checks, storage update, and relationship synchronization. Evidence: `patch.js:58-165`.
|
|
18
|
+
|
|
19
|
+
## Hook/control flow
|
|
20
|
+
- [Verified][C4] Relationship endpoint methods run `checkPermissions` and endpoint-specific hook suffixes before mutation. Evidence: `post-relationship.js:49-52`, `delete-relationship.js:47-49`, `patch-relationship.js:24-25`.
|
|
21
|
+
|
|
22
|
+
## Failure modes
|
|
23
|
+
- [Verified][C5] `patch-relationship` error handling defect (undefined symbol path) can break rollback hook execution on failures. Evidence: `patch-relationship.js:52-54`, `common.js:210-215`.
|
|
24
|
+
- [Inferred][C3] `getRelated` many-to-many fallback may degrade to multiple GET calls when included resources are absent, increasing latency with many IDs. Evidence: `get-related.js:306-341`.
|
|
25
|
+
|
|
26
|
+
## Strengths
|
|
27
|
+
- [Verified][C5] Relationship processor cleanly separates belongsTo updates, polymorphic writes, and many-to-many pivot sync list generation.
|
|
28
|
+
- [Verified][C4] Many-to-many sync logic preserves existing pivot records where possible (`updateManyToManyRelationship`).
|
|
29
|
+
|
|
30
|
+
## Risks
|
|
31
|
+
- R-REL-001:
|
|
32
|
+
- [Verified][C5] Relationship PATCH error-path reliability defect.
|
|
33
|
+
- R-REL-002:
|
|
34
|
+
- [Inferred][C3] High cardinality many-to-many read paths can incur extra per-id lookups in fallback branch.
|
|
35
|
+
|
|
36
|
+
## Missing tests
|
|
37
|
+
- [Inferred][C4] Add explicit failure-path tests for relationship endpoint transaction rollback + hook behavior.
|
|
38
|
+
- [Unknown][C2] Add stress test for many-to-many fallback retrieval volume.
|
|
39
|
+
|
|
40
|
+
## Explicit unknowns
|
|
41
|
+
- [Unknown][C2] Exact behavior parity between relationship endpoints and base methods under all plugin combinations is not fully runtime-proven yet.
|
|
42
|
+
|
|
43
|
+
## Pass-1 confidence
|
|
44
|
+
- Overall: **C4**.
|
|
45
|
+
|
|
46
|
+
## Evidence links
|
|
47
|
+
- `plugins/core/rest-api-plugin-methods/patch-relationship.js`
|
|
48
|
+
- `plugins/core/rest-api-plugin-methods/get-related.js`
|
|
49
|
+
- `plugins/core/lib/writing/relationship-processor.js`
|
|
50
|
+
- `plugins/core/lib/writing/many-to-many-manipulations.js`
|
|
51
|
+
- `audit/evidence/tests/relationship-test-signals.txt`
|
|
52
|
+
|
|
53
|
+
## Pass-2 cross-review status
|
|
54
|
+
- Reconciled in [pass2-cross-review.md](/home/merc/Development/current/json-rest-api/audit/subsystems/pass2-cross-review.md).
|
|
55
|
+
- Final assertion/confidence values in this report are considered pass-2 normalized.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Subsystem: rest-orchestration (Pass 1)
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
- Core REST method orchestration and shared method helpers.
|
|
5
|
+
- Exclusion: anyapi-specific branches are not evaluated.
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
- Normalize request context, enforce payload/permission contract ordering, route to storage helpers, and apply hook lifecycle around CRUD and relationship operations.
|
|
9
|
+
|
|
10
|
+
## Key entry points
|
|
11
|
+
- `plugins/core/rest-api-plugin.js`
|
|
12
|
+
- `plugins/core/rest-api-plugin-methods/{query,get,post,put,patch,delete}.js`
|
|
13
|
+
- `plugins/core/rest-api-plugin-methods/{post-relationship,patch-relationship,delete-relationship,get-related,get-relationship}.js`
|
|
14
|
+
- `plugins/core/rest-api-plugin-methods/common.js`
|
|
15
|
+
- `plugins/core/rest-api-plugin-hooks/{register-scope-routes,register-relationship-routes}.js`
|
|
16
|
+
|
|
17
|
+
## Core data flow
|
|
18
|
+
- Walkthrough (write path: POST/PUT/PATCH):
|
|
19
|
+
- [Verified][C5] `setupCommonRequest` establishes `context.inputRecord`, schema shortcuts, transaction, type/ID consistency checks. Evidence: `common.js:54-197`.
|
|
20
|
+
- [Verified][C5] Write methods call validation and relationship access checks before `helpers.dataPost/dataPut/dataPatch`. Evidence: `post.js:53-121`, `put.js:57-194`, `patch.js:58-134`.
|
|
21
|
+
- [Verified][C5] Permission gate executes before irreversible storage operation (`scope.checkPermissions` before `beforeDataCall` + data helper). Evidence: `post.js:97-121`, `put.js:170-194`, `patch.js:102-134`, `delete.js:67-84`.
|
|
22
|
+
|
|
23
|
+
## Hook/control flow
|
|
24
|
+
- [Verified][C5] Standardized lifecycle hooks exist for pre-processing, schema validation, data call, finish, commit/rollback handling. Evidence: `common.js:285-410`, methods throughout.
|
|
25
|
+
- [Verified][C4] Relationship routes map explicitly to dedicated methods and reuse shared checks. Evidence: `register-relationship-routes.js:33-68`.
|
|
26
|
+
|
|
27
|
+
## Failure modes
|
|
28
|
+
- [Verified][C5] **Concrete defect**: `patch-relationship` catch block calls `handleWriteMethodError` and `log` without import/parameter wiring, likely causing `ReferenceError` and masking original failures.
|
|
29
|
+
- Evidence: `patch-relationship.js:52-54`; compare correct pattern in `post-relationship.js:1-3,15,107-109` and `delete-relationship.js:1-3,14,114-116`.
|
|
30
|
+
- [Inferred][C4] Error-path rollback semantics in `patch-relationship` are unreliable because missing `runHooks` argument to `handleWriteMethodError` would break `afterRollback` hook even if symbol existed. Evidence: `common.js:210-215`, `patch-relationship.js:53`.
|
|
31
|
+
|
|
32
|
+
## Strengths
|
|
33
|
+
- [Verified][C5] Clear centralization of cross-cutting behavior in `common.js`.
|
|
34
|
+
- [Verified][C4] Consistent permission placement before storage write calls.
|
|
35
|
+
- [Verified][C4] Route registration is explicit and auditable.
|
|
36
|
+
|
|
37
|
+
## Risks
|
|
38
|
+
- R-REST-001:
|
|
39
|
+
- [Verified][C5] Relationship PATCH error-path defect (undefined symbol path).
|
|
40
|
+
- Impact: high (error handling reliability, rollback hooks).
|
|
41
|
+
- R-REST-002:
|
|
42
|
+
- [Inferred][C3] Route handler/context shaping differences between scope routes and relationship routes can create subtle transport-level behavior drift.
|
|
43
|
+
- Evidence: `register-scope-routes.js:10-53` vs `register-relationship-routes.js:10-30`.
|
|
44
|
+
|
|
45
|
+
## Missing tests
|
|
46
|
+
- [Inferred][C4] Add targeted failure-path tests for `PATCH /relationships/*` with forced storage errors to verify rollback + error envelope.
|
|
47
|
+
- [Unknown][C2] No direct test evidence yet for all hook lifecycle transitions under nested transaction reuse.
|
|
48
|
+
|
|
49
|
+
## Explicit unknowns
|
|
50
|
+
- [Unknown][C2] Whether plugin hooks depend on currently missing rollback hook in relationship PATCH path.
|
|
51
|
+
|
|
52
|
+
## Pass-1 confidence
|
|
53
|
+
- Overall: **C4**.
|
|
54
|
+
|
|
55
|
+
## Evidence links
|
|
56
|
+
- `plugins/core/rest-api-plugin.js`
|
|
57
|
+
- `plugins/core/rest-api-plugin-methods/common.js`
|
|
58
|
+
- `plugins/core/rest-api-plugin-methods/patch-relationship.js`
|
|
59
|
+
- `plugins/core/rest-api-plugin-methods/post-relationship.js`
|
|
60
|
+
- `plugins/core/rest-api-plugin-methods/delete-relationship.js`
|
|
61
|
+
- `plugins/core/rest-api-plugin-hooks/register-scope-routes.js`
|
|
62
|
+
- `plugins/core/rest-api-plugin-hooks/register-relationship-routes.js`
|
|
63
|
+
|
|
64
|
+
## Pass-2 cross-review status
|
|
65
|
+
- Reconciled in [pass2-cross-review.md](/home/merc/Development/current/json-rest-api/audit/subsystems/pass2-cross-review.md).
|
|
66
|
+
- Final assertion/confidence values in this report are considered pass-2 normalized.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Subsystem: schema-core (Pass 1)
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
- Repositories: `json-rest-schema` + schema compilation path in `json-rest-api`.
|
|
5
|
+
- Exclusion: anyapi internals are out of scope.
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
- Compile and enforce schema contracts (types, validators, relationships, getter/setter/computed metadata) before runtime read/write paths.
|
|
9
|
+
|
|
10
|
+
## Key entry points
|
|
11
|
+
- `json-rest-schema/src/index.js`
|
|
12
|
+
- `json-rest-schema/src/Schema.js`
|
|
13
|
+
- `json-rest-schema/src/CorePlugin.js`
|
|
14
|
+
- `plugins/core/lib/querying-writing/compile-schemas.js`
|
|
15
|
+
- `plugins/core/rest-api-plugin-hooks/compile-resource-schemas.js`
|
|
16
|
+
|
|
17
|
+
## Core data flow
|
|
18
|
+
- Walkthrough (resource registration path):
|
|
19
|
+
- [Verified][C5] `scope:added -> compileResourceSchemas -> compileSchemas` builds `scope.vars.schemaInfo` once per scope. Evidence: `plugins/core/rest-api-plugin.js:117-120`, `plugins/core/rest-api-plugin-hooks/compile-resource-schemas.js:3-6`, `plugins/core/lib/querying-writing/compile-schemas.js:124-335`.
|
|
20
|
+
- [Verified][C5] `compileSchemas` separates computed fields, enriches belongsTo types, builds validation schema and search schema, then caches `schemaInfo` with `schemaStructure`, `searchSchemaStructure`, `schemaRelationships`, `idProperty`, getters/setters metadata. Evidence: `compile-schemas.js:132-335`.
|
|
21
|
+
- [Verified][C5] `Schema.validate()` in `json-rest-schema` enforces unknown-field errors, per-field cast/validator pipeline, and default/null completion behavior for full validation. Evidence: `/home/merc/Development/current/json-rest-schema/src/Schema.js:177-225`.
|
|
22
|
+
|
|
23
|
+
## Hook/control flow
|
|
24
|
+
- [Verified][C4] Schema enrichment hooks are first-class (`schema:enrich`, `searchSchema:enrich`), allowing plugin extensions before schema instances are finalized. Evidence: `compile-schemas.js:183-190`, `217-224`.
|
|
25
|
+
- [Verified][C4] Relationship definitions for runtime include both explicit `scopeOptions.relationships` and schema-derived belongsTo metadata checks. Evidence: `compile-schemas.js:231-244`.
|
|
26
|
+
|
|
27
|
+
## Failure modes
|
|
28
|
+
- [Verified][C5] Invalid schema config fails fast at scope-add time (missing `as` on belongsTo, invalid getter/setter dependencies, invalid computed definition). Evidence: `compile-schemas.js:142-148`, `237-242`, `260-315`.
|
|
29
|
+
- [Inferred][C3] Global mutable registries in `json-rest-schema` (`globalTypes`, `globalValidators`) can create cross-test/plugin coupling if mutated dynamically after schema creation order changes. Evidence: `/home/merc/Development/current/json-rest-schema/src/index.js:13-43`, `64-74`.
|
|
30
|
+
|
|
31
|
+
## Strengths
|
|
32
|
+
- [Verified][C5] Clear separation between schema compile phase and request execution phase.
|
|
33
|
+
- [Verified][C4] Search schema auto-generation and index intent (`ensureSearchFieldsAreIndexed`) are centralized.
|
|
34
|
+
- [Verified][C4] Getter/setter dependency ordering provides deterministic execution semantics.
|
|
35
|
+
|
|
36
|
+
## Risks
|
|
37
|
+
- R-SCHEMA-001:
|
|
38
|
+
- [Inferred][C3] Global registry mutation risk in long-lived process/plugin hot-load scenarios.
|
|
39
|
+
- Impact: medium; can create non-local behavior shifts.
|
|
40
|
+
- Evidence: `/home/merc/Development/current/json-rest-schema/src/index.js:13-43`.
|
|
41
|
+
- R-SCHEMA-002:
|
|
42
|
+
- [Unknown][C2] No direct benchmark evidence yet for schema validation overhead under high-field payloads.
|
|
43
|
+
|
|
44
|
+
## Missing tests
|
|
45
|
+
- [Unknown][C2] No explicit concurrency/ordering tests found for dynamic plugin registration in `json-rest-schema`.
|
|
46
|
+
- [Inferred][C3] Add tests for `schema:enrich` + `searchSchema:enrich` conflict resolution ordering.
|
|
47
|
+
|
|
48
|
+
## Explicit unknowns
|
|
49
|
+
- [Unknown][C2] Runtime memory growth profile with many scopes and large computed dependency graphs.
|
|
50
|
+
- [Unknown][C2] Backward-compatibility expectations for runtime mutation of global validators/types.
|
|
51
|
+
|
|
52
|
+
## Pass-1 confidence
|
|
53
|
+
- Overall: **C4 (high)** for correctness of structural claims, **C2-C3** for performance/operational unknowns.
|
|
54
|
+
|
|
55
|
+
## Evidence links
|
|
56
|
+
- `audit/evidence/code/import-hotspots-non-anyapi.txt`
|
|
57
|
+
- `plugins/core/lib/querying-writing/compile-schemas.js`
|
|
58
|
+
- `/home/merc/Development/current/json-rest-schema/src/Schema.js`
|
|
59
|
+
- `/home/merc/Development/current/json-rest-schema/src/index.js`
|
|
60
|
+
- `/home/merc/Development/current/json-rest-schema/src/CorePlugin.js`
|
|
61
|
+
|
|
62
|
+
## Pass-2 cross-review status
|
|
63
|
+
- Reconciled in [pass2-cross-review.md](/home/merc/Development/current/json-rest-api/audit/subsystems/pass2-cross-review.md).
|
|
64
|
+
- Final assertion/confidence values in this report are considered pass-2 normalized.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Subsystem: storage-knex (Pass 1)
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
- Knex-backed storage helpers and storage adapter abstraction.
|
|
5
|
+
- Exclusion: anyapi-specific storage paths.
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
- Provide database CRUD primitives used by REST methods, including adapter translation hooks and query construction support.
|
|
9
|
+
|
|
10
|
+
## Key entry points
|
|
11
|
+
- `plugins/core/rest-api-knex-plugin.js`
|
|
12
|
+
- `plugins/core/lib/storage/storage-adapter.js`
|
|
13
|
+
- `plugins/core/lib/querying-writing/{database-value-normalizers,compile-schemas,knex-json-api-transformers}.js`
|
|
14
|
+
- `plugins/core/lib/querying-writing/{field-utils,schema-helpers,database-capabilities,knex-field-helpers}.js`
|
|
15
|
+
|
|
16
|
+
## Core data flow
|
|
17
|
+
- Walkthrough (PATCH):
|
|
18
|
+
- [Verified][C5] Method layer provides transaction in `context.db`; storage helper checks existence then applies merged attributes/relationship FK updates and strips non-db fields. Evidence: `patch.js:116-134`, `rest-api-knex-plugin.js:1030-1078`.
|
|
19
|
+
- [Verified][C5] Adapter abstraction translates columns/values and applies base resource scope when canonical adapter is used. Evidence: `storage-adapter.js:25-49`, `68-147`.
|
|
20
|
+
|
|
21
|
+
## Hook/control flow
|
|
22
|
+
- [Verified][C4] Query filtering hooks are invoked by dataQuery/countQuery via `context.knexQuery` handoff to hook chain. Evidence: `rest-api-knex-plugin.js:491-507`, `787-804`.
|
|
23
|
+
- [Verified][C4] `helpers.newTransaction` is exposed and used by method layer for managed transactions. Evidence: `rest-api-knex-plugin.js:213-215`, `common.js:126-130`.
|
|
24
|
+
|
|
25
|
+
## Failure modes
|
|
26
|
+
- [Verified][C4] `dataPut` performs create/update branching and duplicate existence checks; race between existence check and write is possible without higher isolation/constraints. Evidence: `rest-api-knex-plugin.js:974-1007`.
|
|
27
|
+
- [Inferred][C3] Error semantics depend heavily on upstream method orchestration; storage helpers do not independently enforce permission ordering.
|
|
28
|
+
|
|
29
|
+
## Strengths
|
|
30
|
+
- [Verified][C5] Clear separation between orchestration and storage implementation.
|
|
31
|
+
- [Verified][C4] `idProperty` handling is consistently aliased/selectable across get/query/write helpers.
|
|
32
|
+
|
|
33
|
+
## Risks
|
|
34
|
+
- R-STORAGE-001:
|
|
35
|
+
- [Inferred][C3] Possible TOCTOU edge on update/delete existence checks under concurrent writers.
|
|
36
|
+
- R-STORAGE-002:
|
|
37
|
+
- [Unknown][C2] No explicit retry/backoff strategy for transient DB faults.
|
|
38
|
+
|
|
39
|
+
## Missing tests
|
|
40
|
+
- [Inferred][C3] Add concurrency tests for PUT/PATCH/DELETE conflict windows.
|
|
41
|
+
- [Unknown][C2] Add tests for adapter translation edge cases across all relationship filter forms.
|
|
42
|
+
|
|
43
|
+
## Explicit unknowns
|
|
44
|
+
- [Unknown][C2] Real DB behavior variance (SQLite vs Postgres vs MySQL) for returning/locking paths is not yet runtime-verified.
|
|
45
|
+
|
|
46
|
+
## Pass-1 confidence
|
|
47
|
+
- Overall: **C4** for structure/call order; **C2-C3** for concurrency behavior.
|
|
48
|
+
|
|
49
|
+
## Evidence links
|
|
50
|
+
- `plugins/core/rest-api-knex-plugin.js`
|
|
51
|
+
- `plugins/core/lib/storage/storage-adapter.js`
|
|
52
|
+
- `audit/evidence/code/transaction-signals.txt`
|
|
53
|
+
- `audit/evidence/code/idproperty-signals.txt`
|
|
54
|
+
|
|
55
|
+
## Pass-2 cross-review status
|
|
56
|
+
- Reconciled in [pass2-cross-review.md](/home/merc/Development/current/json-rest-api/audit/subsystems/pass2-cross-review.md).
|
|
57
|
+
- Final assertion/confidence values in this report are considered pass-2 normalized.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Subsystem: tests (Pass 1)
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
- Test suite structure and invariant coverage signal (excluding anyapi tests).
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
- Provide confidence on correctness/regression resistance for critical behaviors.
|
|
8
|
+
|
|
9
|
+
## Inventory signal
|
|
10
|
+
- [Verified][C5] Non-anyapi test files: 30 (`tests/*.test.js` excluding anyapi). Evidence: `audit/evidence/tests/test-suite-list-non-anyapi.txt`.
|
|
11
|
+
- [Verified][C5] Skipped tests: 10, all in multi-field cursor pagination suite. Evidence: `audit/evidence/tests/skipped-tests.txt`.
|
|
12
|
+
|
|
13
|
+
## Coverage strengths
|
|
14
|
+
- [Verified][C4] Relationship semantics have dedicated suites (`relationships`, `relationship-endpoints`, custom idProperty relationship tests).
|
|
15
|
+
- [Verified][C4] Plugin-focused suites exist for access, CORS, multihome, positioning, socketio, bulk.
|
|
16
|
+
- [Verified][C4] Include depth and sparse-field interactions are tested.
|
|
17
|
+
|
|
18
|
+
## Coverage gaps
|
|
19
|
+
- [Inferred][C4] Critical cursor edge cases are deferred via skipped tests, lowering confidence for pagination invariants under complex sort tuples.
|
|
20
|
+
- [Inferred][C3] Limited explicit failure-path assertions for rollback hooks (especially relationship PATCH defect path) found in static scan.
|
|
21
|
+
- [Unknown][C2] Query-count/N+1 guard tests are not evident from static test names/signals.
|
|
22
|
+
|
|
23
|
+
## Risks
|
|
24
|
+
- R-TEST-001:
|
|
25
|
+
- [Verified][C4] Skipped pagination tests leave known edge space unverified.
|
|
26
|
+
- R-TEST-002:
|
|
27
|
+
- [Inferred][C3] Runtime invariants may be indirectly covered but not explicitly mapped per invariant ID.
|
|
28
|
+
|
|
29
|
+
## Missing tests
|
|
30
|
+
- [Inferred][C4] Add targeted regression for `patch-relationship` error path (undefined handler/log).
|
|
31
|
+
- [Inferred][C3] Add explicit N+1/query-count budget tests for representative include graphs.
|
|
32
|
+
- [Inferred][C3] Add rollback + afterRollback hook assertions across all relationship endpoint mutations.
|
|
33
|
+
|
|
34
|
+
## Explicit unknowns
|
|
35
|
+
- [Unknown][C2] Current CI timing/flakiness profile (not observed yet; runtime run pending).
|
|
36
|
+
|
|
37
|
+
## Pass-1 confidence
|
|
38
|
+
- Overall: **C3-C4** (good breadth, specific deep-edge gaps).
|
|
39
|
+
|
|
40
|
+
## Evidence links
|
|
41
|
+
- `audit/evidence/tests/test-suite-list-non-anyapi.txt`
|
|
42
|
+
- `audit/evidence/tests/skipped-tests.txt`
|
|
43
|
+
- `audit/evidence/tests/relationship-test-signals.txt`
|
|
44
|
+
- `audit/evidence/tests/query-include-test-signals.txt`
|
|
45
|
+
|
|
46
|
+
## Pass-2 cross-review status
|
|
47
|
+
- Reconciled in [pass2-cross-review.md](/home/merc/Development/current/json-rest-api/audit/subsystems/pass2-cross-review.md).
|
|
48
|
+
- Final assertion/confidence values in this report are considered pass-2 normalized.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Subsystem: transport-express (Pass 1)
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
- Express connector and request helpers.
|
|
5
|
+
- Exclusion: anyapi paths.
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
- Convert HTTP traffic to scope method calls, enforce transport-level media rules, and map internal errors to JSON:API-style HTTP responses.
|
|
9
|
+
|
|
10
|
+
## Key entry points
|
|
11
|
+
- `plugins/core/connectors/express-plugin.js`
|
|
12
|
+
- `plugins/core/connectors/lib/request-helpers.js`
|
|
13
|
+
- `plugins/core/connectors/lib/{busboy-detector,formidable-detector}.js`
|
|
14
|
+
|
|
15
|
+
## Core data flow
|
|
16
|
+
- Walkthrough (GET request):
|
|
17
|
+
- [Verified][C5] Middleware builds request context (`createContext`), runs `transport:request`, then route handler dispatches to scope method handler with parsed query. Evidence: `express-plugin.js:116-177`, `295-308`, `register-scope-routes.js:31-53`.
|
|
18
|
+
- [Verified][C5] Response status rules are method-sensitive (POST 201/204, DELETE 204, PUT/PATCH 204 on empty body). Evidence: `express-plugin.js:310-326`.
|
|
19
|
+
|
|
20
|
+
## Hook/control flow
|
|
21
|
+
- [Verified][C5] Transport hooks are run on both success and error paths (`transport:request`, `transport:response`). Evidence: `express-plugin.js:151`, `268-279`, `333-341`.
|
|
22
|
+
- [Verified][C4] Wildcard route path uses `router.use` with method gate for match-all behavior (used by CORS OPTIONS). Evidence: `express-plugin.js:393-414`.
|
|
23
|
+
|
|
24
|
+
## Failure modes
|
|
25
|
+
- [Verified][C4] Non-library errors default to 500 with direct `error.message` in response; may expose internal messages in production unless upstream sanitizes. Evidence: `express-plugin.js:210-217`.
|
|
26
|
+
- [Inferred][C3] Inconsistent error coding from plugins (e.g., custom `error.code`) can degrade status mapping determinism because only known codes map to specific status branches. Evidence: `express-plugin.js:219-266`.
|
|
27
|
+
|
|
28
|
+
## Strengths
|
|
29
|
+
- [Verified][C5] Clear error mapping for `REST_API_VALIDATION`, `REST_API_RESOURCE`, `REST_API_PAYLOAD`.
|
|
30
|
+
- [Verified][C4] Content-type gate for write methods and structured 404 handling under mount path.
|
|
31
|
+
|
|
32
|
+
## Risks
|
|
33
|
+
- R-TRANSPORT-001:
|
|
34
|
+
- [Inferred][C3] Potential information leakage via raw `error.message` on unexpected errors.
|
|
35
|
+
- R-TRANSPORT-002:
|
|
36
|
+
- [Unknown][C2] Behavior under malformed large payloads near `requestSizeLimit` not yet runtime-validated.
|
|
37
|
+
|
|
38
|
+
## Missing tests
|
|
39
|
+
- [Inferred][C3] Add tests for unknown exception mapping to verify production-safe envelope strategy.
|
|
40
|
+
- [Unknown][C2] Add tests for transport hook failure isolation (`transport:response` throwing).
|
|
41
|
+
|
|
42
|
+
## Explicit unknowns
|
|
43
|
+
- [Unknown][C2] Reverse proxy edge-case behavior for URL prefix calculation under mixed forwarded headers.
|
|
44
|
+
|
|
45
|
+
## Pass-1 confidence
|
|
46
|
+
- Overall: **C4**.
|
|
47
|
+
|
|
48
|
+
## Evidence links
|
|
49
|
+
- `plugins/core/connectors/express-plugin.js`
|
|
50
|
+
- `plugins/core/connectors/lib/request-helpers.js`
|
|
51
|
+
- `audit/evidence/code/error-model-signals.txt`
|
|
52
|
+
|
|
53
|
+
## Pass-2 cross-review status
|
|
54
|
+
- Reconciled in [pass2-cross-review.md](/home/merc/Development/current/json-rest-api/audit/subsystems/pass2-cross-review.md).
|
|
55
|
+
- Final assertion/confidence values in this report are considered pass-2 normalized.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Trace: Read Get
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
- Non-anyapi path only.
|
|
5
|
+
|
|
6
|
+
## Scenario
|
|
7
|
+
- Retrieve single resource by ID (`books.get`).
|
|
8
|
+
|
|
9
|
+
## Input shape
|
|
10
|
+
- Method call: `api.resources.books.get({ id, simplified: false })`
|
|
11
|
+
|
|
12
|
+
## Call path
|
|
13
|
+
1. Route dispatch to `scope.get` from `register-scope-routes` ([register-scope-routes.js](/home/merc/Development/current/json-rest-api/plugins/core/rest-api-plugin-hooks/register-scope-routes.js)).
|
|
14
|
+
2. `get.js` performs `dataGetMinimal` + `scope.checkPermissions` then `helpers.dataGet` ([get.js](/home/merc/Development/current/json-rest-api/plugins/core/rest-api-plugin-methods/get.js)).
|
|
15
|
+
3. Storage helper resolves idProperty-aware query and transforms output ([rest-api-knex-plugin.js](/home/merc/Development/current/json-rest-api/plugins/core/rest-api-knex-plugin.js)).
|
|
16
|
+
|
|
17
|
+
## Runtime evidence
|
|
18
|
+
- `npm test` confirms single get path:
|
|
19
|
+
- `ok 1 - should retrieve a single resource` at `audit/evidence/tests/npm-test-json-rest-api.log:5480`
|
|
20
|
+
|
|
21
|
+
## Result
|
|
22
|
+
- [Verified][C4] Non-anyapi get flow is operational under test.
|