Skip to content

docs(views): web_to_case's comment stops crediting the hook for priority - #1522

Merged
os-sales merged 1 commit into
mainfrom
claude/issue-1305-priority-defaults-comment
Sep 3, 2026
Merged

docs(views): web_to_case's comment stops crediting the hook for priority#1522
os-sales merged 1 commit into
mainfrom
claude/issue-1305-priority-defaults-comment

Conversation

@os-sales

@os-sales os-sales commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1305

What was false

src/views/case.view.ts's web_to_case doc comment listed priority defaults among the internal fields "stamped by case.hook.ts after a guest submission". The hook has never written priority. This is not a comment that went stale when code moved — it described an intent the app never honoured.

Re-derived on origin/main @ e8a3ae9 rather than taken from the card, and the framework legs read out of the installed @objectstack/objectql instead of the repo's own prose about it:

  • applyFieldDefaults builds defaultedData, that row becomes input.data on the beforeInsert hook contexts, and triggerHooks('beforeInsert') runs afterwards. Field defaults land first, on the engine's own insert path.
  • applyFieldDefaults skips any slot that is already non-null, and otherwise takes the option marked default: true (resolveOptionDefault).
  • src/objects/case.object.ts marks the low option of crm_case.priority default: true.
  • src/objects/case.hook.ts only reads priority, to materialise priority_rank. It never assigns it. What remains there is a comment recording why the deleted line could not fire.

The card located the clause at roughly line 309; it is live at line 416. Re-located by text, not by line number.

The low / medium disagreement, resolved

The card says the field default is low, while the removed hook line would have written 'medium'. Both cannot describe one behaviour, and the comment now asserts the answer, so it had to be settled rather than paraphrased around:

low. medium only ever existed in the dead line, which could not execute. And a guest's own selection outranks both — web_to_case puts priority on the form in front of the guest, so the declared default applies only when the guest leaves it unset.

Deleted or replaced: replaced

The card left this call open. Replaced, for a reason specific to this form: web_to_case asks the guest for priority, with help text about critical issues. A reader who found the false clause removed and then found the field would have no account at all of where the value comes from — the same gap that let the wrong explanation survive. Deleting is true but silent; replacing is true and forecloses the false belief by name.

The new text says priority is not among the hook-stamped fields, that the guest supplies it here, that an unset one takes the low option declared on crm_case.priority, that field defaults are applied before beforeInsert, and that the hook only reads it.

Scope held

One clause in one comment. The other four items (status, origin, owner_id, SLA) are genuinely hook-stamped and are untouched, as is the rest of the paragraph. git diff --stat is a single hunk in one source file plus the changeset.

Changeset

Empty-frontmatter, the form .github/workflows/changeset-check.yml documents as the sanctioned "this PR releases nothing" declaration, on par with the skip-changeset label, and the established precedent here for prose-only work including one prior comment-only src/ edit. Preferred over the label because it travels inside the PR: no separate label write, and no exposure to a concurrent label rewrite stripping a gate-bearing label. pnpm changeset status --since=e8a3ae9 exits 0 and bumps no package.

Verification

pnpm verify (validate, typecheck, lint, lint:i18n-gate, hygiene, hygiene:tokens, build, test), run twice under this container's shared heavy-verify lock — once on the working tree, then again on the final commit 0cf4357 so the green result belongs to the tree that is being pushed.

Second run, at 0cf4357, lock verdict command-exit 0:

  • Validation passed
  • source hygiene clean, including "no raw control bytes in first-party files" and "no source file over 100KB"
  • source token ratchet clean: business semantics ~83,079 (ceiling ~85,000), interaction layer ~37,426 (ceiling ~40,000), authored total ~134,846 (ceiling ~140,000). Unmoved by this PR by design — the ratchet is comment-stripped, so comment work cannot buy or spend budget there.
  • Build complete
  • Test Files 156 passed (156); Tests 3285 passed, 1 skipped (3286)

Nothing pins the old wording: priority defaults now appears nowhere in the repo outside this PR's changeset. No published page under content/docs/ repeats the false claim, so there is no doc counterpart to fix — docs/feature-inventory.md SVC-005 says the hook fills defaults, which stays true of origin and status.

🤖 Generated with Claude Code

https://claude.ai/code/session_019hUuCQStzXGMFSX4dzww5t


Generated by Claude Code

The `web_to_case` doc comment listed `priority defaults` among the internal
fields "stamped by `case.hook.ts` after a guest submission". The hook has never
written `priority`: `crm_case.priority` declares its `low` option
`default: true`, and on the engine's insert path `applyFieldDefaults` produces
the row that becomes the `beforeInsert` hook's `input.data`, so the slot is
already full every time the guest branch runs. The dead
`if (!input.priority) input.priority = 'medium'` line the clause described has
since been deleted; the hook keeps only a comment recording why it could never
fire.

Replaced rather than deleted, because this form puts `priority` in front of the
guest and a reader would otherwise be left with no account of where the value
comes from. The comment now names the real mechanism and resolves the
`low`/`medium` disagreement in favour of `low`. The other four items (status,
origin, owner_id, SLA) are genuinely hook-stamped and are untouched, as is the
rest of the paragraph.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019hUuCQStzXGMFSX4dzww5t
@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
hotcrm Ignored Ignored Sep 3, 2026 7:42am UTC

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

metadata Declarative metadata — schema, security posture, UI surfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

case.view.ts's web_to_case comment says the hook stamps "priority defaults" — it never did, and after #1296 the line it referred to is gone

2 participants