Repository navigation
Commit 4bea755
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XHUVA2v8YMSniMMGK58oCeh)_
Part of #25522
Clause-②: no
Metadata-protocol: none
Ruling-ref: 6348891160
Cut 5 of the `packages/objectql/src/engine.ts` split (#24586 ruling A,
recorded in `6270097840`). The claim is `6412019236`, which amends
`6411795983` after the dev report `6411990837`. The nine bodies of the
"Secret and internal-field handling" area move unedited into a new
module, `packages/objectql/src/engine-secret-internal-fields.ts`:
`encryptSecretFields`, `refuseEmptyPasswordFields`, `maskSecretFields`,
`omitInternalFields`, `stripSearchCompanionFromRead`,
`privilegedReadDriverOptions`, `resolveSecret`, `resolveSecretField` and
`resolveInternalField`. No secret-handling behaviour changes. #25522
stays open for the later cuts.
Branch `claude/project-thread-npj50o` (the card thread's harness-pinned
branch), cut from `origin/main` at `c8cb510a5`. `main` has since moved
to `c16c00f93`; nothing in that range touches `packages/objectql/**`,
the two docs files or the anchor directory entries this PR edits, so the
branch is not merged forward and CI builds the merge ref. #25980 (the
last commit before the base) changed `engine.ts` only in its preamble
and trailer; the nine bodies are byte-identical from `a4eae0649` to
`c8cb510a5`.
## Why this area (the fresh seam table)
Measured on `origin/main` `a4eae06499`: `engine.ts` is 23,458 lines,
7,214 of them (30.8%) from the last 30 days (`git blame -s
--since=2026-09-26T08:45Z`), 121 commits in 30 days and 31 in 7. The
full 41-section table in #23050's shape, with a per-method screen of
every section, is in the dev report `6411990837` and its project file.
The three areas left by cut 4 do not pay a move-only cut without a
`packages/spec` edit:
| area | 30-day lines | movable inside the claim | why not |
|---|---|---|---|
| Roll-up summaries | 0 | 46 body lines, about -15 net |
`buildSummaryIndex` is cited from `packages/spec`
(`functional-completeness.ts`, ADR-anchored; `liveness/field.json`
`summaryOperations`, and `liveness/` ships in the spec tarball);
`recomputeSummaries` hands `this` to `aggregateSummaryValue` |
| Datasource registry | 1 | 27 body lines, about -5 net |
`unregisterDriver` and `clearDatasourceUnavailable` are
`this.FIELD.delete(` sites (U = 3) |
| Related-record expansion | 10 | 0 | `expandRelatedRecords` reads the
private static `MAX_EXPAND_DEPTH` and is cited from
`liveness/query.json` and `liveness/field.json` |
| **Secret and internal-field handling** (this PR) | 32 of 566 | **all 9
bodies, 208 body lines** | none: no inferred-return public method, no
`this.FIELD.delete/insert/update(` site, no private-static read
(screened by AST), no `packages/spec` or `docs/adr` pointer |
## The shape (#23050 shape B, as cuts 1 to 4 apply it)
- The class keeps all nine methods with name, modifiers, signature,
docblock and position, because tsup emits members with their JSDoc into
the `.d.ts`. Each body is now one host literal plus `fn.call(host, …)`,
marked `[#25522 cut 5]`.
- `SecretInternalFieldsHost` is new. Each member is typed as the class
member (`ObjectQL['cryptoProvider']`, `ObjectQL['getDriver']`), and each
moved function types its `this` as the `Pick` of exactly the members its
body reads; each stub annotates its literal as `ThisParameterType` of
that function. No cast, and no member changes visibility.
- The three fields (`_registry`, `cryptoProvider`, `txStore`) go as
GETTERS, so `setCryptoProvider` between calls is seen exactly as before.
The five methods the bodies call (`getDriver`,
`transactionCoversDriverFor`, `omitInternalFields`,
`privilegedReadDriverOptions`, `resolveSecret`) go as late-bound
closures over the instance, so a double set on the engine still
intercepts. Tests do replace `resolveInternalField` (4 sites) and
`resolveSecretField` (2) on the instance; those methods stay on the
class, so the doubles still take effect.
- `stripSearchCompanionFromRead` reads no member and is called directly,
as cut 1 calls `objectDisplayLabel`.
- **Imports.** The module imports `ObjectQL` as a TYPE only (no runtime
cycle) and nothing re-exports it. `engine.ts` drops the names whose last
code reader moved: `CryptoHandle`, `collectSecretFields`,
`collectMaskedReadFields`, `collectMaskedPasswordFields`,
`makeSecretRef`, `parseSecretRef`, `isSecretRef`,
`EmptyCredentialWriteError`, `SECRET_MASK` and
`isSearchCompanionRequested`. `collectInternalReadFields`,
`collectCredentialFields`, `stripSearchCompanion`,
`redactPropagatedDriverFault` and `ICryptoProvider` still have readers
there and stay.
## Net lines (the seat's rule)
`engine.ts` 23,492 → 23,351, **net -141**. The module is 360 lines: the
header and host interface (about 75), nine one-line docblocks, and the
208 moved body lines with their signatures. 667 changed lines over 6
files (+447 / -220), well under the 3,000 human-merge line.
## The published `.d.ts` does not change (ruling `6348891160`)
Base: `@objectstack/objectql` built with `engine.ts` restored from
`c8cb510a5` and the new module removed (tree only, restored with `git
checkout HEAD --`, `git status` clean afterwards). Head: built at
`bd40de2733`. The head `dist/index.mjs` carries the stub's
`readCryptoProvider`, which the base build lacks, so each leg built the
source it names. All six declaration files are **raw byte-identical**,
so the ruled normaliser has nothing to do:
| file | sha256, base = head |
|---|---|
| `index.d.ts` |
`3d0e556fe6cf12c69d3b9516d9f414d235bd7279b3f9cb4bbd10f8fb3f098726` |
| `index.d.mts` |
`9d741b723c1c6697d9b2ccd98cac69075dc5f87328d50936c5d73496c45d4626` |
| `core.d.ts` |
`a024599701ba68ebfa6d0c3781d3c8d755ab1c7c1fc2db5ab89cb30020091a7e` |
| `core.d.mts` |
`9acb9b18b3220f17a45abc36ef86fb54f53244e634b71400ba45c12895dc5b2b` |
| `util-CR5tVhqM.d.ts` and `.d.mts` |
`2696708b9ee625ddcdf62709ea19e6d92b39d2d82cdd803652be1b17f625b059` |
**Positive control:** making line 8014 of the head `util-CR5tVhqM.d.ts`
(`private maskSecretFields;`) public gives
`7f91b0b1062f7356115bd25365df7bc3baaae7678e3d06dc92552ffdb87df35f`, so
the comparison can fail. Export lists, ESM = CJS at both ends: `.` 182
names (sorted sha256 `881616cc…0adaa`), `./core` 54 (`393e8069…90f49`),
identical at base and head; no moved name is exported.
## Proof of move-only
A TypeScript-AST leaf-token compare (recursive `getChildren`, JSDoc
skipped), base `engine.ts` against the head module:
- Each of the nine: parameters (less `this`) + return type + body tokens
**SAME**, `async` the same, and every body line equals the base line
less two leading spaces. `encryptSecretFields` 354 tokens / 73 lines,
`resolveInternalField` 324 / 41, `resolveSecret` 197 / 31,
`resolveSecretField` 169 / 24, `maskSecretFields` 128 / 17,
`omitInternalFields` 96 / 9, `refuseEmptyPasswordFields` 76 / 7,
`privilegedReadDriverOptions` 57 / 4, `stripSearchCompanionFromRead` 37
/ 2.
- **Negative controls:** one `return` rewritten in the moved
`resolveInternalField` or `maskSecretFields` reports DIFFER.
- Class: 318 members at both ends, same order; 309 byte-identical (full
text, docblocks included); the 9 stubs keep docblock, modifiers and
signature byte-identical up to the body.
- Top level: 224 of 228 base statements byte-identical in head. The
others are the class, the three narrowed imports above, and the new
module import with its comment.
## Readers of the moved lines, migrated in this PR
- `docs/qa/platform-checklist/areas/records-forms.json`: the
secret-field item's source pointer, `engine.ts#encryptSecretFields` →
`engine-secret-internal-fields.ts#encryptSecretFields`.
`check:platform-checklist` green.
- `content/docs/permissions/system-context.mdx` row 27:
`engine.ts#stripSearchCompanionFromRead` →
`engine-secret-internal-fields.ts#stripSearchCompanionFromRead`, the
`isSystem` read's new home. `check-system-context-census` green: 151
read sites in 22 packages across 79 files, the page cites 144 symbols
against 144 required.
- `packages/objectql/src/federated-injected-column-readers.test.ts`: the
ledger key `engine.ts#encryptSecretFields :: created_at` →
`engine-secret-internal-fields.ts#encryptSecretFields :: created_at`
(the scan keys by file).
- **ADR anchors.** The engine anchor entry's one paragraph is the
transaction seam (`buildDriverOptions`, `enforceTransactionOrigin`) and
describes no moved body. But the moved encrypt and decrypt bodies carry
two `ADR-0128 D1` citations, and moving them dropped the anchored
surface's decision-letter count from 1,844 to 1,842. Cut 4 resolved the
same drop with an entry for its new module, so this PR adds
`scripts/adr-anchors/packages__objectql__src__engine-secret-internal-fields.ts.json`
(ADR-0100, ADR-0128). `check:adr-anchors`: base 86 anchored files, 1,844
letter citations; head 87, **1,845**.
- **Census and receivers.** `check-tenant-audit-census` green (243 write
call sites, every `UNTYPED_RECEIVERS` row matched; the moved
`secretDriver.create(` is a local receiver, not a `this.FIELD` one).
`check:logger-receiver-detach` green (the moved bodies read no logger).
`check:durability-log-level` green over the objectql read seams.
## Acceptance notes
- Prose that names `engine.ts` beside a moved method still resolves by
method name, because every method stays on the class. Examples:
`service-settings`'s `settings-crypto-fail-closed.test.ts` comment and
`plugin-security`'s `insert-check-post-image.test.ts` comments. They are
outside this claim's file surface and left as they are.
- Serial check, re-read before `pr_create`: 29 PRs are open. One touches
`engine.ts`: #26026 (seat 1's #24768, branch
`claude/project-thread-otcr21`). Its hunks are in
`createWithAutonumberResync`, `insert` and `update`, and `git
merge-tree` of the two heads is clean (exit 0). Whichever lands second
merges `main`.
## Verification
At head `bd40de2733`:
- `pnpm --filter @objectstack/objectql typecheck` (`tsc --noEmit` +
`check:test-typecheck`, 39 files / 233 errors / 64 pinned signatures
held): exit 0. `eslint --no-inline-config packages/objectql`: exit 0.
- `pnpm --filter @objectstack/objectql exec vitest run --project local`:
470 files, 8,742 tests, 8,742 passed, 0 failed, 0 skipped. This includes
`read-internal-column.test.ts`, the secret and password suites, and
`federated-injected-column-readers.test.ts`.
- Dependants: every changed member keeps its declaration and all six
published `.d.ts` files are byte-identical, so no dependant can see a
difference; CI's `TypeScript Type Check` covers them.
- `dispatch-gates --commands` derived 103 families on the real diff. All
were run at head, each exit code recorded before any pipe, and
reconciled with `--ran` (103 accounted for: 102 run, 1 NOT MEASURED).
`check:skill-examples` exited 3 until `client-react`'s closure was
built, then 0. **NOT MEASURED** (CI runs it):
`check:dual-build-cjs-loads` exit 3, PREREQUISITE NOT MET (it needs
every package's `dist/`; the export lists above answer it for objectql).
`check-engine-split-ratio --days 90`: 98.1%, exit 0.
- Hand gates, all exit 0: `check-adr-anchors` (base and head, above),
`check-adr-symbol-anchors` (2,658 anchors resolve),
`check-tenant-audit-census`, `check-nul-bytes`,
`check-platform-checklist --changed-from origin/main` (2 anchored files,
14 anchors, 0 lost), `check-commit-card-trailers --range
origin/main..HEAD`.
`skip-changeset`: move-only. The published `.d.ts` files and export
lists are byte-identical, `liveness/` and every other published path are
untouched, and the module's runtime is the same code under a different
file name.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01FCw8ckDE3VXVavCoqsMQ3u)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 10ba46b commit 4bea755
6 files changed
Lines changed: 447 additions & 220 deletions
File tree
- content/docs/permissions
- docs/qa/platform-checklist/areas
- packages/objectql/src
- scripts/adr-anchors
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4114 | 4114 | | |
4115 | 4115 | | |
4116 | 4116 | | |
4117 | | - | |
| 4117 | + | |
4118 | 4118 | | |
4119 | 4119 | | |
4120 | 4120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
0 commit comments