docs(views): web_to_case's comment stops crediting the hook for priority - #1522
Merged
Merged
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
os-sales
marked this pull request as ready for review
September 3, 2026 07:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1305
What was false
src/views/case.view.ts'sweb_to_casedoc comment listedpriority defaultsamong the internal fields "stamped bycase.hook.tsafter a guest submission". The hook has never writtenpriority. This is not a comment that went stale when code moved — it described an intent the app never honoured.Re-derived on
origin/main@e8a3ae9rather than taken from the card, and the framework legs read out of the installed@objectstack/objectqlinstead of the repo's own prose about it:applyFieldDefaultsbuildsdefaultedData, that row becomesinput.dataon thebeforeInserthook contexts, andtriggerHooks('beforeInsert')runs afterwards. Field defaults land first, on the engine's own insert path.applyFieldDefaultsskips any slot that is already non-null, and otherwise takes the option markeddefault: true(resolveOptionDefault).src/objects/case.object.tsmarks thelowoption ofcrm_case.prioritydefault: true.src/objects/case.hook.tsonly readspriority, to materialisepriority_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/mediumdisagreement, resolvedThe 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.mediumonly ever existed in the dead line, which could not execute. And a guest's own selection outranks both —web_to_caseputspriorityon 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_caseasks the guest forpriority, 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
priorityis not among the hook-stamped fields, that the guest supplies it here, that an unset one takes thelowoption declared oncrm_case.priority, that field defaults are applied beforebeforeInsert, 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 --statis a single hunk in one source file plus the changeset.Changeset
Empty-frontmatter, the form
.github/workflows/changeset-check.ymldocuments as the sanctioned "this PR releases nothing" declaration, on par with theskip-changesetlabel, and the established precedent here for prose-only work including one prior comment-onlysrc/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=e8a3ae9exits 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 commit0cf4357so the green result belongs to the tree that is being pushed.Second run, at
0cf4357, lock verdictcommand-exit 0:Nothing pins the old wording:
priority defaultsnow appears nowhere in the repo outside this PR's changeset. No published page undercontent/docs/repeats the false claim, so there is no doc counterpart to fix —docs/feature-inventory.mdSVC-005 says the hook fills defaults, which stays true oforiginandstatus.🤖 Generated with Claude Code
https://claude.ai/code/session_019hUuCQStzXGMFSX4dzww5t
Generated by Claude Code