Skip to content

docs(sharing): describe the record-level access the app really ships (#549) - #584

Merged
os-zhuang merged 1 commit into
mainfrom
claude/issue-549-sharing-coverage-5a8b2a
Aug 2, 2026
Merged

docs(sharing): describe the record-level access the app really ships (#549)#584
os-zhuang merged 1 commit into
mainfrom
claude/issue-549-sharing-coverage-5a8b2a

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Description

A sharing rule widens the object it names, never the records hanging off it. HotCRM authors its widening rules on crm_account only (north_america_territory, europe_territory, account_team_sharing), so a rep who receives an account through a territory rule reads the account and its contacts (controlled_by_parent) — while the quotes, contracts and tasks on it stay own-only and opportunities widen only through the ≥ $100k leadership rules.

The docs claimed otherwise. contracts.mdx promised "Contracts follow the account's sharing — if you can see the account, you can see its contracts", the security doc documented an account-team roster and a Team tab this app does not ship, and the FAQ told users to ask for a seat on that team. That is the declaration-vs-reality half of #549 and it is what this PR fixes.

No permission set, OWD or sharing rule changed. Whether quotes, contracts and tasks should follow the account is the business decision the issue asks for; the options and their costs are written up in a comment on #549.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • CI/CD update

Related Issues

Related to #549 (the record-level decision stays open), follows #547.

Changes Made

  • Sharing & Security (en + zh-Hans + zh-Hant): new "A rule widens one object, not the records underneath it" section with a per-related-list table of what a shared account actually carries; Layer 4 restated as Manual shares (the platform feature that exists) with an explicit note that no account-team object or Team tab ships and that Account Team Sharing is an ordinary criteria rule for sales_manager; the "you're on the account team" combine-rule and user tip replaced.
  • Contracts (3 locales): owner-only visibility documented, including who does hold View All, and what an admin would have to author to change it.
  • FAQ (3 locales): the account-team diagnostic step replaced with parent-derivation / sharing-rule / manual-share steps, plus a note that a shared account carries its contacts and nothing else.
  • src/docs/crm_admin.md: the Account Team rule row says what it grants; a paragraph records the own-only reach of the account's children and points at the open decision.
  • sales-rep / service-agent profiles: comments no longer claim cross-team visibility that no sharing rule delivers, and warn against widening the grants to paper over Sharing coverage gap: territory/team-shared accounts show quote, task and contract related lists the rep cannot read #549.
  • test/sharing-coverage.test.ts (new): guards described below.

Testing

  • Unit tests pass (pnpm test — 646 passed, 1 skipped)
  • Linting passes (pnpm lint)
  • Build succeeds (pnpm build)
  • Manual testing completed — pnpm verify (validate → typecheck → lint → hygiene → build → test) green
  • New tests added (if applicable)

test/sharing-coverage.test.ts holds a ledger of every object hanging off crm_account, classified derived / partial / own_only, and asserts:

  • the ledger covers exactly the objects that hang off the account (a new child object fails until someone decides its reach);
  • the ledger matches the shipped OWD + sharing rules, and no rule widens a child by account criteria behind its back;
  • sales_rep / service_agent keep own scope on the own-only children (no silent viewAllRecords);
  • the docs' rule table matches src/sharing/ rule-for-rule (object, access level, position), the positions block matches CrmPositions, and the related-list table's promises match the ledger;
  • no product doc promises account-derived visibility for an object the metadata keeps own-only — the exact defect reported in Sharing coverage gap: territory/team-shared accounts show quote, task and contract related lists the rep cannot read #549.

Both directions were negative-tested: flipping a ledger entry and restoring the old contracts.mdx sentence each turn the suite red.

Screenshots

n/a — documentation and test-only change.

Checklist

  • I have added a changeset (.changeset/sharing-coverage-docs-truth.md)
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Two adjacent defects were found and deliberately left alone — each is the same "docs describe something that isn't shipped" class but a different subject, and folding them in would bury the sharing fix:

  1. Phantom Competitor object. The OWD table lists Competitor — Public Read-Only, and profiles.mdx has three personas reading "competitor battlecards". No such object exists; competitors are a picklist on crm_opportunity.
  2. Role-hierarchy roll-up prose. ADR-0090 D3 made positions flat, but ~38 lines across ~13 doc pages (× 3 locales) still say access flows "up the role hierarchy" or to "managers and their subordinates". sharing-and-security.mdx already states the flat rule, so the feature docs contradict it.

Both are worth their own issues.


Generated by Claude Code

A sharing rule widens the object it names, not the records hanging off it.
The widening rules are authored on crm_account only, so a rep who receives
an account through a territory rule reads the account and its contacts
(controlled_by_parent) while the quotes, contracts and tasks on it stay
own-only and opportunities widen only through the >= $100k leadership rules.

The docs claimed otherwise: contracts.mdx promised "contracts follow the
account's sharing", the security doc documented an account-team roster and
Team tab that this app does not ship, and the FAQ told users to ask for a
seat on that team. That is the declaration/reality half of #549 — fixed
here. No permission set, OWD or sharing rule changed: whether the account's
children should follow the account is the business decision still open in
the issue.

- Sharing & Security: per-related-list table of what a shared account
  carries, Layer 4 restated as manual shares, account-team roster claim
  removed (en + zh-Hans + zh-Hant).
- Contracts: owner-only visibility documented, with who holds View All.
- FAQ: account-team diagnostic replaced with parent/rule/manual-share steps.
- crm_admin.md: the Account Team rule is criteria-based, not a roster.
- sales_rep / service_agent profiles: comments no longer claim cross-team
  visibility that no sharing rule delivers.

New guards in test/sharing-coverage.test.ts pin, per account child, whether
its records are parent-derived, partially shared or own-only, and keep the
admin docs matching that ledger — so closing the gap stays a decision
instead of drift.

Refs #549
@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hotcrm Ignored Ignored Aug 1, 2026 2:13am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation ci/cd CI plumbing and the verification pipeline metadata Declarative metadata — schema, security posture, UI surfaces labels Aug 1, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review August 2, 2026 11:01
@os-zhuang
os-zhuang added this pull request to the merge queue Aug 2, 2026
Merged via the queue into main with commit 94f99eb Aug 2, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd CI plumbing and the verification pipeline documentation Improvements or additions to documentation metadata Declarative metadata — schema, security posture, UI surfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants