TypeScript Debugging and Observability
Attach SQLExecutionEvidenceStore only to a server-created SQL client. Its
entries contain trusted parameters, so project them through the
safeSQLEvidence(...) helper from generated Debug Assist before exposing any
diagnostic result.
const store = new SQLExecutionEvidenceStore();
client.setRuntimeTelemetrySink(store);
store.enableSelect();
const rows = await Q.schools().limit(20)
.comment("Diagnose the school search")
.purpose("Verify filters, facets, and relation loading")
.executeForList(context);
const safe = safeSQLEvidence(store.snapshot());
Use enableAll(), enableSelect(), enableMutation(), and disable(); mode
changes clear old entries. The default TextDiagnosticSQLLogSink is
operator-only. Replace it with setDiagnosticSQLLogSink(...) or remove it by
passing undefined. Query and mutation logging can be disabled independently
with setQueryLoggingEnabled(false) and
setMutationLoggingEnabled(false).
Use TypeScript advanced data operations for the
Facet, aggregate, deep relation, Top-N, and audited save requests. Correlate
tracePath and metric aliases with safe SQL timing/count evidence. Keep
debugSQL and parameters out of errors, browser responses, and telemetry.
setAuditSink(...) delivers application audit events independently from
RuntimeTelemetry. Install OpenTelemetry with
dataService.setRuntimeTelemetry(telemetry) and configure the TFP client the
same way when used.
Tenant qualification: the current composition API stores requestPolicy in
UserContext, but core prepareQuery() does not automatically consume that
resource. Enforce tenant scope in the trusted server adapter or custom data
service, reject governance keys from payloads, and retain negative tests for
Query, Facet, aggregate, relation, Mutation, and federation paths.
Finish with the shared checklist.
Order troubleshooting
For the full operation and recovery sequence, use the TypeScript mutation recipes: deletion, state changes and version conflicts.
Start with the TypeScript Order tutorial and API usage guide. Diagnose the first native error before changing a dependency or rerunning a suite. Compare the failing runtime, model and fixture against the authority for that operation.
| Symptom | What to inspect | Next action |
|---|---|---|
| Downloaded first-run package cannot build | Node must be 22.23.4; the package uses locked public npm dependencies and a native SQLite addon. | Activate the pinned Node, run bash order.sh build, and inspect npm/prebuild or compiler errors. Keep install scripts enabled; do not copy node_modules from another ABI/platform. |
| Wrapper rejects existing/missing DB | init protects existing files; read/edit/verify require an initialized DB. | Use a fresh absolute ORDER_DATABASE, run init once, then read/edit/verify against that same path. |
ORDER_OK is printed but the wrong Order is visible | Absolute database path, model revision and selected fixture. | The first-edit fixture has three Orders; pagination and insights use separate nine-/ten-order fixtures. Keep each in its own database and use business keys, not copied numeric IDs. |
| Empty result or duplicate business identity | Query cardinality and scoped predicates. | Keep the expected-one check. An empty result is distinct from a provider exception. A buyer filter alone does not authorize a tenant. |
| Wrong total or omitted item after edit | Full scalar/relation loading, item bounds and money validation. | Reload the complete bounded collection before calculating totals; a preview is not a full edit graph and omission is not deletion. |
better-sqlite3 fails to load or reports an ABI mismatch | Node/native-addon setup differs from the recorded toolchain. | Use the recorded Node version and matching native addon build. Preserve the original error; it is not an optimistic conflict. |
teaql-ts import or runtime resolution is unexpected | The retained console uses an explicit package alias/archive resolution. | Compare its manifest, lock file and runtime-resolution record. Do not repair the example by guessing an import or silently installing a different package. |
| Deleted row reappears in an ordinary read | The earlier published deletion-readback defect is separate from mutation success. | Use the retained workspace qualification and normal/deleted-only read rules. Keep the original School published failure and Order receipts separate. |
| Amounts are imprecise or a fractional quantity is accepted | The application skipped safe-integer validation before computing cents. | Use the retained edit function’s Number.isSafeInteger checks and bounds before mutation. |
| Promise appears complete but SQLite remains in a transaction | Awaited application work and native driver state need separate checks. | Follow the driver ownership and awaited close in the soak console; its native transaction/open state and writer probes establish cleanup for that workload. |
Order query troubleshooting
Use TypeScript Order Queries with the matching export/insights fixture and recorded workspace. Diagnose the native plan and result carrier before changing an optimizer, cache or numeric conversion.
| Symptom | What to inspect | Next action |
|---|---|---|
| Export count is 9 instead of 8 | Export uses a buyer-only predicate; the ten-order fixture adds an export-buyer EUR control. | Use the nine-order export database. Retained-ID and summary recipes deliberately use the ten-order database and a currency predicate. |
| Empty export tail looks like failure | The ascending export's final offset 9 reports CACHE_MISS, zero rows and exact total 8. | Stop on the empty tail normally. For retained IDs an empty tail can instead be an ID_SET_HIT. |
| ID overflow shows 5 while total is 8 | Capacity 4, lower-bound scan and exact provider COUNT. | Keep observedCount separate from the matching total; do not retain a partial set or present 5 as the exact count. |
| Grand total equals a page/preview sum | Parent page size, child preview size and predicates on every aggregate/Facet request. | Aggregate the whole filtered set in the provider. In the all-USD fixture it is 8/35350, even though only three parents are visible. |
| Empty sum or zero buckets are unexpected | Empty groups, the one-row overall aggregate, and include-all versus matched-only Facets. | Preserve overall count 0/sum null; keep zero status buckets only for the requested all-status variant. |
| Retained TTL or invalidate behavior is assumed from a default store | This recipe installs an application-owned protocol implementation. | Keep the example ObservedIds TTL/key handling or supply a verified replacement. Its Map lifecycle is not evidence of a universal runtime invalidate method. |
| Status group is undefined | The native field is orderStatus; statusId is a report normalization. | Read the actual native field and convert count intentionally. Preserve null for an empty overall sum. |
| Plan fields look stale or a fallback reason differs | Read continuousPagePlan/ID-set observations immediately after the relevant query in the same context. | Composite sort reports UNSUPPORTED_QUERY_SHAPE in this receipt. Do not replace it with a Java-specific reason or a synthetic HIT. |
Read the plan immediately after its request; a namespace string or stale observation from another request is not proof of reuse. The existing query cases record actual provider SQL, keys, builds/hits, elapsed expiry/invalidation events and unchanged database snapshots. Use that evidence first. Fixed-data reads do not supply a concurrent-write snapshot or a distributed-cache guarantee. All original runtime pending-release and generator-deployment qualifications remain.
Order isolation troubleshooting
Use TypeScript Order Isolation with the v1.1 model/library and fresh eight-order database. Inspect the facade boundary and actual provider predicates before broadening access or changing a cache namespace.
| Symptom / code | What to inspect | Next action |
|---|---|---|
| Wrong model or missing tenant-key API | v1.0 core/query workspace versus the v1.1 isolation library, manifest and database. | Use the retained regenerated isolation set; this is a fresh-database tutorial, not a live migration. Do not hand-edit generated files. |
UNAUTHENTICATED / FORGED_SCOPE | Server-owned session resolution and identity/policy fields in business JSON. | Keep client fields out of the session tuple; the fixture key is not a production credential. |
INVALID_TRUSTED_SCOPE | Zero/multiple tenant roots for the resolved key. | Fail closed and repair provisioning; never choose an arbitrary root. |
Foreign ID gives NOT_FOUND | Root + buyer predicates and parent-owned item resolution. | Preserve the common missing/foreign response; do not make a public unscoped lookup to distinguish them. |
INVALID_BOUNDS, FORBIDDEN_FIELD, FORBIDDEN_OPERATION | Native numeric type, exact patch keys and read-only actor. | Use integer 1–2 and the exact note/label patch. Do not coerce identity, strip extra fields or partially save. |
| List is scoped but summary/cache is not | Same trusted predicates on every aggregate and retained request. | Expect count 2/7700 cents; cache a,b,c,a must BUILD,BUILD,BUILD,HIT on one context with distinct scope identities. |
| Child edit reads a partial graph or changes unrelated versions | Three-child sentinel, two-child supported bound and native save path. | Detail/edit overflow returns ITEM_LIMIT; preserve scoped complete-state loading and compare unrelated rows. |
| Relation API is missing or note save traverses child graphs | The retained API is filterByCommercePlatform, and the note path reloads complete scoped scalars. | Use the regenerated relationship Assist/graph-save contract and application-owned ID store; preserve pending deployment/release marks. |
| Audit actor or HTTP authorization is assumed from response metadata | The example tuple is separate from native context principal and transport authentication. | Wire real authenticated membership/principal mapping at the service boundary. JSON actor metadata and an audit reason do not prove that integration. |
The isolation receipt checks the named console requests with SQL and SQLite snapshots. It does not certify arbitrary raw Q/database access, exhaustive hostile JSON, production migration or authorization revocation during a save. Keep runtime and generator release marks from the API scope guide.
Read the evidence in order
| Question | Existing authority |
|---|---|
| Query shape, null state, edit, page or analytic result | Core Order receipt, this language’s native source, and the selected fixture. |
| Stale winner or atomic child failure | Concurrent writes and the stored unchanged/authoritative database snapshots. Busy/locked and timeout errors do not qualify as version conflicts. |
| Request cancellation, provider statement failure or real COMMIT failure | Lifecycle evidence. Preserve the native error and verify rollback before retry. |
| Transaction, connection or task ownership after drain/close | Finite soak evidence. Separate active leases from idle owned connections and verify the final native close/lifetime end. |
| Published package differs from a recorded workspace PASS | Release qualifications. Keep the pending-release marker and exact runtime source/package identity. |
Collect the failing phase, native error type/message, model and fixture revision, resolved runtime/package identity, and parameterized SQL shape/affected rows. Keep raw parameters and rendered SQL in the trusted operator boundary. Runtime telemetry sampling is not proof that an audit event was delivered or a transaction committed.
Reuse the existing failure and successful recovery evidence first. If a specific claim still has no authority, isolate that one operation on a disposable database and record the minimal result. Keep that reproduction scoped to the failing operation. Preserve School, every historical Order receipt, all six lifecycle/soak workspace pending-release qualifications, and the generator repairs pending deployment.
This language’s recorded advanced Order result remains WORKSPACE PASS — RELEASE PENDING.