Add # references to host objects and free-typed @handles #6
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 577 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.380
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6"
general
weight: 0.35
BenA-SA
What
Adds pluggable
#references from chat messages to host objects (the first host is Comply 100:#B3.2for requirements,#0001for risks), and free-typed@handlementions. These are the two features requested together; the work is split into one ADR per decision.Details
#references to host objectshuddle.references.ReferenceResolver(one subclass perkind), registered in the newHUDDLE_REFERENCE_RESOLVERSsetting and loaded into a cachedReferenceRegistry. A resolver implementssearch(channel, user, query, *, limit),resolve_code(channel, user, code)andget(channel, user, ids), and can overridecode/label/url/object_id.ChatService.encode,MessageMarkup.encode).#codebecomes<#kind:id>. Pickedkind:idtokens are used first (if the sender may see them), then free-typed codes go to the resolvers. Unknown or unauthorised codes stay plain text, and a hand-typed<#…>is neutralised just like<@…>.MessageReferencemodel (message,kind,object_id, optionalcontent_type/target), migration0002, plusfor_target()/visible_to()lookups. Rows are kept in step with edits and deletes. The newreference_added(message, reference, target)signal fires after commit, once per newly referenced object.ChatRendererloads a page's reference rows in one query and callsget()once per channel and kind for the viewer. Anything not visible renders as a neutral#unavailableand never leaks its label.MessageViewgainstextandreferences.#after whitespace querieshuddle:references(c/<pk>/references/?q=). Picking an option inserts#CODEand adds a hiddenreferencesinput. The template iscomponents/reference_results.html.references: [{kind, id, code, label, url}], filtered per viewer. The input serializer acceptsreference_ids, and there is a newGET /channels/{id}/references/?q=. Websocket JSON mode reuses the payloads.Free-typed @handles
@handleis matched case-insensitively againstmentionable_users(channel), using the display name with spaces removed or the email local part. If more than one user fits, nobody is mentioned.HUDDLE_FREE_TYPED_MENTIONS = Falseturns this off.Design decisions (ADRs 0007–0009)
channel.scope is Noneis passed to the resolvers, which return nothing if their objects only exist inside a scope (documented).ChatPolicyhook. The policy decides chat visibility and resolvers decide host-object visibility. Resolvers are only asked after the policy has admitted the user to the channel.<#…>, so a token only becomes a chip if the service recorded aMessageReferencerow for it. This stops old hand-typed tokens from coming alive when a host adds a resolver.#stays plain text.Testing
tests/test_references.py,tests/test_handles.py) using a toyexampleapp (Project,Ticket,ProjectChatPolicy,TicketResolver). They cover encoding and the no-forging rule, permission at send and at render, unknown codes, DMs, resolver conflicts and picks, edit/delete row sync and the signal, a bulk query-count guard, the autocomplete view, the API payload and search, websocket JSON, and handles including ambiguity.ruff,mypy --strict,tox -f py314(Django 6.0 + 6.1) andpre-commit run --all-filesall pass locally.AI Provenance
#reference mechanism in django-huddle (resolver hook, send-time encoding with no forging, render-time permission re-check,MessageReferencestorage plusreference_addedsignal, composer autocomplete, API/JSON payloads) and free-typed@handleswith ambiguity handling, as one PR with ADRs, without building Comply 100's resolver.Checklist