Skip to content

lint: an unguarded condition on owner_id, created_by, updated_by, owning_business_unit_id or queue is accepted though the column can be NULL on a stored row #33435

Closed

Description

@objectstack-fleet

domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag

Follow-up of #33246 (PR #33434), its dev report 6884094895 open_questions 1. Seat answer: B, a separate card.

Measured (engine probe, system context): a row inserted with a system context holds created_at / updated_at, and NULL in owner_id, created_by, updated_by, owning_business_unit_id and queue. buildNullableFieldIndex (packages/lint/src/validate-expressions.ts) leaves every injected column out of the nullable index on purpose, so os build (and, after #33434, the publish door) accept record.owner_id > 'a' unguarded in a flow or hook condition; on a stored row with NULL there the predicate aborts (flow run fails, hook condition faults).

First step: measure what the REST data door stamps for a signed-in user's create (the probe above used a system context), per column and per ownership tier, before deciding. If the door always stamps a column for user writes, the only NULL rows come from system inserts; say whether those reach flows and hooks.

Candidate fix (to be judged on that evidence): judge the injected columns the platform does not always populate as nullable at both os build and the door; created_at / updated_at stay never-null. That is a narrowing (Clause-②: no (narrowing), Metadata-protocol: narrowed, ADR-0087 entry, measured first-party exposure). If the measurement shows every reachable row is stamped, close with the docblock reasoning made explicit instead.

Related, noted by the same report and not filed separately: a hop leaf through an injected lookup (record.owner_id.nmae != null) is judged at neither the build nor the door.

class: b · type: Bug · Grade: p3 (coverage gap, not a false refusal; needs measurement) · domain: spec

Activity

  1. added
    pm:queue
    domain:spec
    on Nov 14, 2026
  2. objectstack-fleet commented on Nov 14, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag

    Seat: scope additions from PR #33434 round-2 review (record 6884875891) · 2026-11-14T22:03Z

    ⛔ Not a claim. Serial: dispatched after PR #33434 lands.

  3. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC

    Claim: PM loop round 4 · 2026-11-15T19:09Z
    Session: session_01ADHkmQjrEpxMVxEiDUJHqC (seat); a card thread of this account's project is the dev and reports its session id
    Account: os-steve
    Branch: pending — the card thread's designated branch; a follow-up Claim: from this session names it before the dev builds
    Worktree: objectstack-issue-33435
    Domain: domain:spec
    Seat: domain:spec#2
    File surface: packages/lint/src/validate-expressions.ts (buildNullableFieldIndex and its docblock), the flow/hook door's nullable reading where it must agree with os build, their tests, one ADR-0087 semantic entry if the measurement narrows, root .changeset/. Serial: #33529 is held behind this card (same files)
    Container & model: S/M, mode:thread, model: default tier
    Clause-②: no (narrowing) — only if the measurement leads there
    Metadata-protocol: narrowed (expected if narrowing; else none)
    Responsibility: objectstack: injected columns owner_id / created_by / updated_by / owning_business_unit_id / queue / organization_id are judged never-null by os build though a system insert leaves them NULL | flow and hook authors | a condition on them aborts at run time on a stored row
    Premise: holds at origin/main (seat read: validate-expressions.ts ~:588 docblock leaves injected columns out of the nullable index on purpose). PR #33434 merged. Order: /mnt/project-files/spec-seat2/33435-delta.md (project share).
    Priority: p3, dispatched under the maintainer's 2026-11-15T17:14Z opening of p3 on this lane; the spec queue holds no claimable p1/p2.

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 15, 2026
  5. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC

    Claim: PM loop round 4 · 2026-11-15T19:12Z (names the branch; supersedes claim 6899727412, same session)
    Session: session_01ADHkmQjrEpxMVxEiDUJHqC (seat); card thread session_01ADHkmS2qjQvEgMBSBQpeea is the dev
    Account: os-steve
    Branch: claude/project-thread-al00uu (the card thread's designated branch; the platform lets a thread push only that branch)
    Worktree: objectstack-issue-33435
    Domain: domain:spec
    Seat: domain:spec#2
    File surface: packages/lint/src/validate-expressions.ts (buildNullableFieldIndex and its docblock), the flow/hook door's nullable reading where it must agree with os build, their tests, one ADR-0087 semantic entry if the measurement narrows, root .changeset/. Serial: #33529 is held behind this card (same files)
    Container & model: S/M, mode:thread, model: default tier
    Clause-②: no (narrowing) — only if the measurement leads there
    Metadata-protocol: narrowed (expected if narrowing; else none)
    Responsibility: objectstack: injected columns owner_id / created_by / updated_by / owning_business_unit_id / queue / organization_id are judged never-null by os build though a system insert leaves them NULL | flow and hook authors | a condition on them aborts at run time on a stored row
    Premise: holds at origin/main (seat read: validate-expressions.ts ~:588 docblock leaves injected columns out of the nullable index on purpose). PR #33434 merged. Order: /mnt/project-files/spec-seat2/33435-delta.md (project share).
    Priority: p3, dispatched under the maintainer's 2026-11-15T17:14Z opening of p3 on this lane; the spec queue holds no claimable p1/p2.

  6. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:spec#2 · os-steve · session_01ADHkmS2qjQvEgMBSBQpeea
    os-dev-report

    {
      "status": "done",
      "branch": "claude/project-thread-al00uu",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34129",
      "session": "session_01ADHkmS2qjQvEgMBSBQpeea",
      "premise_still_valid": true,
      "summary": "Measured per column, tier and writer (showcase, real REST door + engine, sqlite-wasm, single posture): owner_id, created_by, updated_by hold NULL on system inserts and seeded rows; owning_business_unit_id and queue are NULL on every write; organization_id is set on stored SQL rows but absent at beforeInsert and never stamped by driver-memory; created_at/updated_at are set on every stored row but absent at beforeInsert. No column is stamped for some tiers only, so no STOP. os build now judges flow and hook conditions over the declared fields plus the injected columns the object does not carry (and created_at/updated_at at a beforeInsert hook, S1), so it gives the door's exact verdict; the door's verdicts do not move. First-party exposure: zero hits in the four examples and platform packages.",
      "tests": "packages/lint: 212/212 files, 9033/9033 tests; flow-null-guards file 29/29 incl. 7 new #33435 cases (six columns x every flow slot + hook, bare spelling, per tier, S1 beforeInsert + afterInsert/flow controls, guarded control, author-declared owner_id control, validation-rule control). lint typecheck exit 0. Consumers: cli unit 423/423 files 6010/6010; metadata-protocol 342 passed 9 skipped files, 22926 passed 45 skipped; mcp 65/65, 1185/1185; platform-objects 122/122, 2007/2007. Positive control: app-todo start condition + `&& record.created_by > \"a\"` via ablation-replace => objectstack build exit 1 with the null-guard finding; restored, git diff HEAD empty. Base f81e4b6c gate reading: door=1 build=0 per column; head: build equals door in every cell.",
      "gates": "dispatch-gates --commands (no paths) 109 commands, each run with stdin closed and the exit captured before any pipe; --ran: 109 derived, 108 run, 1 NOT-MEASURED, 0 UNRUN. NOT MEASURED: pnpm check:dual-build-cjs-loads (exit 3 PREREQUISITE NOT MET: not every package has dist/; CI runs it). Re-run green after prerequisite: check-plugin-teardown-shape --self-test (fetched 621a4876, 48 cases), spec check:skill-examples (built client-react deps, 346 examples), check:type-check-debt (lock slot). check-changeset-no-major offline with the PR body event: exit 0. check-adr-0087-registration --base origin/main: exit 0. Ledger: /mnt/project-files/spec-seat2/33435-gates-ran.txt. CI check-runs not awaited (order: don't wait on CI).",
      "dogfood_battery": "f1e07bac · VERDICT command-exit 0 · Test Files 467 passed 3 skipped (470) · Tests 3962 passed 42 skipped (4004) · no failures",
      "mcp_calls": "1 — mcp__github__pull_request_read (get, #34129 read-back: draft true, assignee os-steve, 7 files, head f1e07bac)",
      "api_writes": "2 — relay pr_create (with-fleet.sh --via dispatch, run 43758802200) creating #34129; this os-dev-report comment via post-stamped.mjs. Plus 3 git pushes to claude/project-thread-al00uu.",
      "open_questions": [
        {
          "question": "organization_id is set on every stored SQL-family row; should the door instead exempt it like created_at/updated_at (a widening at the door) rather than build joining the door's nullable verdict?",
          "options": [
            "A keep it nullable at both (this PR)",
            "B add organization_id to the stamped-row exemption at flow sites and non-beforeInsert hooks, Clause-② yes"
          ],
          "recommendation": "A, because driver-memory never stamps a tenant column and a beforeInsert hook reads it absent, so not every reachable row holds it; B widens the accept set for a gain no first-party app asks for."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "class: b · reach: os build and publish door both accept `record.owner_id.nmae != null` (hop leaf through an injected lookup is judged at neither) · evidence: card delta names it out of scope · dedupe words: hop leaf injected lookup null guard",
        "class: b · reach: a validation rule or requiredWhen ordering an injected column is judged at neither door (object door judges the authored object) and faults on a NULL row · evidence: CONTROL case in flow-null-guards test, door=0 build=0 · dedupe words: validation rule injected column null guard",
        "class: c · reach: residual created_at/updated_at build/door differences (flow arithmetic, previous.created_at, beforeFind/afterFind hooks, external objects) left per the order's S1 scope · evidence: PR Acceptance notes",
        "carrier: PR #34129 Acceptance notes · the null-guard message says the object 'declares as nullable' an injected column the author never declared; door wording kept for parity · noted, not filed"
      ],
      "files_changed": {
        ".changeset/33435-injected-column-null-guard-at-build.md": "+23 -0",
        "content/docs/automation/flows.mdx": "+5 -0",
        "content/docs/automation/hooks.mdx": "+10 -0",
        "packages/lint/src/validate-expressions.flow-null-guards.test.ts": "+103 -1",
        "packages/lint/src/validate-expressions.test.ts": "+6 -0",
        "packages/lint/src/validate-expressions.ts": "+146 -24",
        "packages/spec/src/migrations/entries/semantic/18.flow-hook-condition-injected-column-null-guard-at-build.ts": "+31 -0"
      },
      "line_budget": "7 files, +324 -25 (349 lines; PR additions+deletions read back), under the 3000-line threshold; no generated files",
      "deviations": [
        "Early in the run the card and its comments were read with `gh api` (non-search GET) against the gh-only-for-search rule; reads only, no writes.",
        "Forced test edit: validate-expressions.test.ts #5017 meta-test PLUMBING list gained five receivers.",
        "PR body is final as created (no post-create issue_patch); body file left for the seat at /mnt/project-files/spec-seat2/33435-pr-body.md."
      ]
    }

    Stamped 2026-11-15T20:36Z.


    Generated by Claude Code

  7. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC

    Seat ruling on the os-dev-report 6900991227 open question · 2026-11-15T20:38Z

    organization_id: keep it judged nullable at both doors (the dev's recommendation). Do not add a door-side exemption. The measurement is the reason. A beforeInsert hook reads organization_id as null, and driver-memory never stamps it, so a condition on it can meet NULL on a real run. Exempting it at the door would put back the disagreement between os build and the door that this card closes, in the opposite direction.

    The out-of-scope items are carried forward. The seat files them after merge:

    • the hop leaf through an injected lookup (record.owner_id.nmae), judged at neither door;
    • validation rules and requiredWhen on injected columns, judged at neither door;
    • the created_at residue left under S1.
  8. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:spec#2 · os-steve · session_01ADHkmS2qjQvEgMBSBQpeea
    os-dev-report

    {
      "status": "done",
      "branch": "claude/project-thread-al00uu",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34129",
      "session": "session_01ADHkmS2qjQvEgMBSBQpeea",
      "premise_still_valid": true,
      "summary": "Round 2 on the seat's contract review (PR comment 6901107947, PASS with S1/S2). S1: the changeset and the ADR-0087 entry now name the two runtime readers that narrow with the build (MCP validate_expression at site flow_condition; a publish-drafts batch carrying a draft of the flow's or hook's own object), the batch case no longer sits under 'Unchanged', each has a pin, and the comment above flowHookNullableIndex names the pending-draft door instead of the extension door. S2: the entry's reason, the changeset and hooks.mdx say a beforeInsert hook reads created_at/updated_at as null only when it runs before the stamp (priority below 10); the rule itself is unchanged (door parity, #33434). N2 taken: the join's locals are renamed carriedFieldNames/joinedNullable/joinedFields so PLUMBING no longer excuses the generic names file-wide. N1/N3 unchanged, accepted deviations.",
      "tests": "packages/lint: 212/212 files, 9034/9034 tests (lock VERDICT 0), typecheck exit 0. New pins: authored-site-expression.test.ts MCP flow_condition case; metadata-protocol runtime-authoring-gate.injected-column-null-guard.test.ts 3 cases (batch flow over owner_id, batch beforeInsert hook over created_at, guarded control). Ablation: base validate-expressions.ts + lint rebuilt => the 2 batch cases and the MCP case fail; restored + rebuilt => pass. metadata-protocol typecheck exit 0; protocol-publish-drafts-closure.test.ts green; spec src/migrations 5 files 198 tests; spec tsc --noEmit exit 0. Round 1 readings (cli, metadata-protocol, mcp, platform-objects) stand: no behaviour change since f1e07bac.",
      "gates": "dispatch-gates --commands at 34790afb: 110 commands (new: check:durability-log-level), each with stdin closed and the exit captured before any pipe. First pass: 104 exit 0, 6 spec checks exit 3 (PREREQUISITE NOT MET: spec dist predated the edited migration entry); built @objectstack/client-react... under the lock, re-ran the 6: exit 0. Final record (last code per command): /mnt/project-files/spec-seat2/33435-gates-ran-r2.txt; --ran: 110 derived, 110 run, 0 NOT-MEASURED, 0 UNRUN (check:dual-build-cjs-loads measured this round, exit 0).",
      "dogfood_battery": "f1e07bac · VERDICT command-exit 0 · Test Files 467 passed 3 skipped (470) · Tests 3962 passed 42 skipped (4004) · not re-run at 34790afb: round 2 changes no runtime or lint verdict (tests, docs, comments, the entry's reason text, local renames)",
      "mcp_calls": "2 total — mcp__github__pull_request_read (round 1 read-back), mcp__github__issue_read get_comments on #34129 (round 2, reading the review); no write tools",
      "api_writes": "3 total — relay pr_create (run 43758802200); round-1 os-dev-report comment 6900991227; this round-2 comment. Plus 4 git pushes (f1e07bac..34790afb this round).",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "class: b · reach: os build and publish door both accept `record.owner_id.nmae != null` (hop leaf through an injected lookup is judged at neither) · evidence: card delta names it out of scope · dedupe words: hop leaf injected lookup null guard",
        "class: b · reach: a validation rule or requiredWhen ordering an injected column is judged at neither door (object door judges the authored object) and faults on a NULL row · evidence: CONTROL case in flow-null-guards test, door=0 build=0 · dedupe words: validation rule injected column null guard",
        "class: c · reach: residual created_at/updated_at build/door differences (flow arithmetic, previous.created_at, beforeFind/afterFind hooks, external objects) left per the order's S1 scope · evidence: PR Acceptance notes",
        "carrier: PR #34129 Acceptance notes · the null-guard message says the object 'declares as nullable' an injected column the author never declared; door wording kept for parity · noted, not filed"
      ],
      "files_changed": {
        ".changeset/33435-injected-column-null-guard-at-build.md": "+25 -0",
        "content/docs/automation/flows.mdx": "+5 -0",
        "content/docs/automation/hooks.mdx": "+11 -0",
        "packages/lint/src/authored-site-expression.test.ts": "+13 -0",
        "packages/lint/src/validate-expressions.flow-null-guards.test.ts": "+103 -1",
        "packages/lint/src/validate-expressions.test.ts": "+6 -0",
        "packages/lint/src/validate-expressions.ts": "+149 -24",
        "packages/metadata-protocol/src/runtime-authoring-gate.injected-column-null-guard.test.ts": "+68 -0",
        "packages/spec/src/migrations/entries/semantic/18.flow-hook-condition-injected-column-null-guard-at-build.ts": "+33 -0"
      },
      "line_budget": "9 files, +413 -25 (438 lines) vs f81e4b6c; round 2 delta 7 files +108 -19; under the 3000-line threshold; no generated files",
      "deviations": [
        "Round 1: card and comments read with `gh api` (GET) early on; reads only.",
        "Forced test edit: validate-expressions.test.ts #5017 PLUMBING list gains five receivers (now carriedFieldNames, joinedNullable, joinedFields after N2).",
        "N1 (bare flow spelling stricter than the door) and N3 (\"declares as nullable\" wording) left as the review accepted them.",
        "PR body not rewritten (issue_patch refused in card threads); the updated body is at /mnt/project-files/spec-seat2/33435-pr-body.md for the seat.",
        "Dogfood battery not re-run at 34790afb (see dogfood_battery)."
      ]
    }

    Stamped 2026-11-15T21:30Z.


    Generated by Claude Code

  9. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC

    Landed · #33435 via PR #34129 · 2026-11-16T00:44Z

    probe reading
    PR #34129 MERGED, merge commit a06170867afb00d9ad3a81779de87648d0250665 at 2026-11-16T00:38Z
    card #33435 closed (by Fixes #33435)

    State: pm:dispatched removed and assignee cleared; the card is done. Follow-ups filed per ruling 6901005939: #34194 (priority-aware beforeInsert timestamps, plus flows.mdx rule 5), #34195 (hop leaf through an injected lookup), #34196 (validation rules / requiredWhen over injected columns). Serial successor #33529 (same lint files) is no longer blocked.

  10. removed
    pm:dispatched
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:specpriority:p3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions