Group9 Beta Sprint: Team Coding Standards
| Item | Details |
|---|---|
| Course | EE308FZ |
| Assignment | Teamwork — Beta Sprint |
| Team and project | Group 9 · MoodSky |
| Objective | Document the formatting, architecture, privacy, Git, testing, and CI coding standards enforced across MoodSky's Beta sprint |
| Effective baseline | v0.5.6, build 787ddc2 |
| References | CONTRIBUTING.md, eslint.config.js, .prettierrc.json, Privacy & UGC Rules, CI Workflow |

Snapshot: December 2, 2026 (787ddc268aeb0f5a691e5e22be814ad0dce33644). These coding standards govern all 12 members of Group 9 during the MoodSky Beta Sprint across the native WeChat Mini Program (miniprogram/), Tencent CloudBase functions (cloudfunctions/moodsky/), database policies (database/), admin console (admin/), and verification suites (tests/, scripts/, tools/). Every rule below is backed either by an automated check in npm run check and .github/workflows/ci.yml or by mandatory code-review gates in CONTRIBUTING.md.
Contents
- 1. Purpose, stack, and Alpha-to-Beta evolution
- 2. Formatting, naming, and repository layout
- 3. Architecture, shared contracts, and trust boundaries
- 4. Error handling, idempotent retries, and async UI safety
- 5. Privacy, content security, and credential hygiene
- 6. Branches, commits, PRs, and Beta handoff discipline
- 7. Automated quality gates, testing rules, and evidence layers
- 8. Pre-PR developer checklist
1. Purpose, stack, and Alpha-to-Beta evolution
MoodSky is built with CommonJS JavaScript (ES2020), WXML, WXSS, JSON, CloudBase, Node 24 (>=24 <25), and strict TypeScript (5.9.3) contract assertions. Following our course reference to the Alibaba Java Development Manual (online guide), we adopt its core engineering categories—naming, formatting, modular layering, error handling, security/privacy, testing, and Git workflow—while translating every rule into concrete JavaScript, Mini Program, and CloudBase checks rather than quoting unrelated Java syntax.
Beta tightens several standards directly in response to Alpha and post-Alpha findings:
- Shared validation before UI wiring: A mismatch between 120-character public suggestions and a 60-character task-title cap caused valid-looking suggestions to fail on tap (PR #233). Client and server limits now live in shared contract files before any page consumes them.
- Transactional live-state and task-ID checks: Post-Alpha fixes (
v0.5.5PR #281,v0.5.6PR #283) proved that server transactions must re-read live flags (places.enabled) and carry exact entity keys (taskId) instead of trusting static lists or coarse page flags. - Explicit test configs and failure assertions: Local tests must supply explicit synthetic configurations—never inheriting personal developer configs—and assert real outcomes before recording
PASS.
2. Formatting, naming, and repository layout
Consistent formatting is machine-enforced rather than left to style debates. Contributors must keep editor settings, Prettier formatting, and ESLint rules green before committing:
| Tool / Config | Enforced rules in MoodSky | Purpose |
|---|---|---|
.editorconfig | charset = utf-8, end_of_line = lf, insert_final_newline = true, indent_style = space, indent_size = 2, trim_trailing_whitespace = true | Prevent CRLF diffs and mixed-tab formatting across Windows and Linux CI |
.prettierrc.json | singleQuote: true, trailingComma: "all", printWidth: 100, proseWrap: "preserve" | Deterministic formatting checked by npm run format:check |
eslint.config.js | ESLint 10.12.0 (ecmaVersion: 2020, commonjs), no-undef, no-unused-vars (^_ ignore), no-var, prefer-const, eqeqeq: ['error', 'always'], curly: ['error', 'all'], no-eval, no-debugger, no-dupe-keys, no-unreachable | Catch scoping bugs, implicit globals, loose equality, and dead code early |
Naming and directory conventions:
- Use
camelCasefor functions, methods, and local variables; useUPPER_SNAKE_CASEfor shared constants (ACTIONS, weather enums, validation bounds). - Use lowercase English (kebab-case for new folders/docs) for file and directory names. Never rewrite Git history or rename historical member evidence directories solely for naming cleanup.
- Preserve the 4-tab Mini Program shell (
miniprogram/app.jsonverified byscripts/check-structure.js). Every registered page and component must include all four files (.js,.json,.wxml,.wxss).
3. Architecture, shared contracts, and trust boundaries
MoodSky enforces strict separation between UI presentation, client service gateways, shared contracts, and server-side CloudBase execution:
- Zero direct client database access:
eslint.config.jsenforces a customno-restricted-syntaxrule onminiprogram/**/*.js: calling.database()anywhere in the client fails lint with "Business data must go through services/api.js and cloud authorization." In parallel,database/client-access-policy.jsonlocksdefaultClientRuleto{ "read": false, "write": false }, checked on everynpm run structure:check. - Single source of truth for shared contracts: Weather codes, action contracts, requirement mappings (
UW3-F01throughUW3-F24), validation bounds, and Beta expansion contracts live inminiprogram/shared/. Runningnpm run cloud:preparecopies them intocloudfunctions/moodsky/shared/(which is ESLint-ignored as a generated directory). Never edit files insidecloudfunctions/moodsky/shared/by hand—scripts/shared-contracts.jsverifies byte-for-byte equality (Buffer.equals) and aborts checks or builds on any mismatch. - Time, text length, and validation alignment:
- Business dates use Beijing time (
YYYY-MM-DD); persistence timestamps use UTC. - Text lengths (diary entries, custom tags, custom nicknames) count Unicode code points, not raw UTF-16
.length, so multi-byte characters and emoji are bounded consistently on client and server. - Validation rules (username, password, recovery code, nickname, card visibility) are defined in shared constants/validators before page wiring.
- Business dates use Beijing time (
- Zero-trust server authorization & feature isolation:
- Cloud functions derive the caller from trusted WeChat context or verified Beta session tokens—never from client-supplied
ownerId,openid, or role flags. - Server transactions re-verify account state (active vs. deactivated, registration generation), resource availability (
places.enabled), and dynamic friendship/visibility rules (SELF,PUBLIC,FRIENDS_INCLUDE,FRIENDS_EXCLUDE) on every read or write. - Beta expansion endpoints and structured sharing stay isolated behind
MOODSKY_EXPANSION_PILOTandMOODSKY_EXPANSION_STRUCTURED_SHARING(both defaulting tofalsein standard packages).
- Cloud functions derive the caller from trusted WeChat context or verified Beta session tokens—never from client-supplied
4. Error handling, idempotent retries, and async UI safety
- Three-state outcome model: Every service and UI handler distinguishes success, confirmed failure, and unknown outcome (network timeout/interruption). Empty
catchblocks, hardcodedtruereturns, or silent fallbacks that hide missing backend logic are prohibited. - Actionable user feedback without data loss: Failures preserve the user's unsent form input and return localized, actionable Chinese feedback (no raw English stack traces or misleading "please sign in" prompts on read-only views).
- Idempotent write retries:
- Mutating requests carry a deterministic
requestId. When a write outcome is unknown, retrying reuses the exact originalrequestId, payload, and business date—even across a Beijing midnight rollover—so a retried save never creates duplicate records or shifts dates silently. - In the Beta expansion client, unconfirmed non-credential writes may be cached locally per environment and account (max
24hours) strictly for identical retry; passwords, recovery codes, and login requests must never enter retry caches.
- Mutating requests carry a deterministic
- Async race & account-switch safety: Page callbacks must verify that the response matches the current active account, visit token, and selected month/period before calling
setData. Logging out or deactivating an account clears local session tokens and private caches immediately.
5. Privacy, content security, and credential hygiene
All code and PRs must comply with docs/privacy-development-rules.md:
- Mandatory PR Information Impact Table: Any PR changing user fields, permissions, sharing flows, SDKs, or retention must complete all six impact items (feature & entry, data & purpose, flow & storage, consent & refusal, lifecycle/retention, platform & verification) in
.github/pull_request_template.md. If a PR has no privacy impact, contributors must explicitly state the checked scope rather than leaving a bare "none". - Credential, rate-limit, and moderation standards (Beta expansion):
- Passwords are hashed server-side using
scryptwith an independent random salt; recovery codes and session tokens are stored only as cryptographic digests. - Auth failure rate-limiting (15-minute window) uses a server-side HMAC digest of the normalized username and caller identity; digests never enter business records, client responses, or exports.
- User-submitted nicknames are verified server-side via WeChat
security.msgSecCheckbefore saving (fail-closed on rejection, error, or pending review). - Original diary bodies and private tags remain owner-only; share titles, Mini Program routes, QR parameters, error logs, and synthetic test fixtures must never leak diary text, raw
openid, tokens, or secrets.
- Passwords are hashed server-side using
- Strict API & permission boundary: Do not add or invoke undeclared capabilities—GPS/location, phone-number login, system calendar writes, clipboard APIs, photo album/camera selection, or unreviewed third-party tracking SDKs. Friend codes, recovery codes, and card IDs use selectable
<text>elements instead of clipboard APIs.
6. Branches, commits, PRs, and Beta handoff discipline
- Branch naming & single focus: Always branch from up-to-date
mainusingfeature/<topic>,fix/<topic>,docs/<topic>, orintegration/<topic>. Keep one logical concern per PR. - Conventional Commits: Commit and PR titles follow
type(scope): concrete behaviour(e.g.,feat(expansion): support custom nicknames,fix(campus): scope check-ins by taskId). - Linear history & CODEOWNERS:
mainpermits Squash merge only (main-quality-and-historyprotection rule with zero exemptions: PR required,qualityCI required, up-to-date branch required, conversations resolved, no force-push). Member PRs require approval from@HX-Jan(CODEOWNERS);@HX-Janmay use the documented owner-review exemption only afterqualitypasses. - Safe integration over stale branches: Before merging any branch with an older base, check
git merge-base main <head>andgit diff --name-status main..<head>. Never overwrite newer account safeguards, interface fixes, or frozen snapshots from an outdated branch. - Beta handoff rules:
- Name the designated reviewer when opening an Issue.
- Record the submitted commit SHA, build ID, reproduction steps, and expected vs. actual output in the Issue/PR while work is active.
- Use
Refs #<id>for partial work; reserveCloses #<id>strictly for Issues whose acceptance criteria are fully verified.
7. Automated quality gates, testing rules, and evidence layers
Every Pull Request and push to main runs the quality workflow defined in .github/workflows/ci.yml on Ubuntu + Node 24 (timeout-minutes: 10).

Figure 1. Editorial engineering diagram (not a runtime UI capture) summarizing MoodSky's contract-sync boundary, ESLint database restriction, and six-stage automated CI gate on v0.5.6 (787ddc2).
Before opening a PR, contributors run the same checks locally from the repository root:
npm ci
npm run setup
npm ci --prefix cloudfunctions/moodsky
npm run cloud:prepare
npm run check
npm run team:check:production
npm audit --audit-level=high --prefix admin
npm audit --audit-level=high --prefix cloudfunctions/moodsky
npm audit --audit-level=high --prefix tools/h03-probe
node scripts/check-cloud.js
git diff --check
npm run check executes six sequential gates (lint -> format:check -> structure:check -> docs:check -> typecheck -> test). On baseline 787ddc2, npm run check passes 1,791/1,791 tests across 185 test files, and npm run team:check:production passes 8/8 offline production-assembly scenarios.
Three mandatory Beta testing rules:
- Explicit, isolated test configurations: Test loaders must construct explicit fixture environments (
databaseFixture(...).db, explicit release flags) and never read personal developer config files. - Assert real outcomes and negative paths: Never record
PASSbefore asserting the actual response payload or state change. Every new feature or bugfix PR must include negative ("must-fail") cases—invalid permissions, deactivated accounts, disabled places, stale revisions, or rejected moderation. - Separate the five evidence layers: Never report a lower-layer check as proof of a higher layer. Every verification log explicitly separates: (1) local automated tests, (2) offline production-assembly checks, (3) WeChat DevTools simulator walkthroughs, (4) target CloudBase readback, and (5) physical-phone tests + WeChat platform receipts.
8. Pre-PR developer checklist
Before pushing a branch or requesting review in Beta, confirm all eight items:
- Branched from current
main, scoped to one Issue, with a designated reviewer named on the Issue. - Modified
miniprogram/shared/only at the source and regenerated cloud copies vianpm run cloud:prepare. - Zero
.database()calls inminiprogram/**, zero unapproved APIs, and server-side identity/state validation in place. - Unknown outcomes, retry
requestIdreuse, and async stale-response/account-switch guards verified. npm run check,npm run team:check:production, andgit diff --checkpass locally with zero warnings or leftover temp files.- Explicit negative tests added for permission, validation, or failure paths; zero personal data or real credentials in fixtures/screenshots.
- PR description completes the 6-item Information Impact Table and lists exact commit SHA, reproduction steps, and verified evidence layers.
- Any remaining cloud deployment, physical-phone check, or WeChat platform gate is marked honestly as open rather than assumed complete.
相关推荐
战国BC472年世界历史地图矢量文件SHP格式.zip
本资源为《战国BC472年世界历史地图矢量文件SHP格式》压缩包,文件大小约 2.26 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。
地方科技局搭建区域性科技成果转化公共服务平台,哪家机构提供的数智化方案更成熟?.docx
科易网基于行业知识库+行业大数据+科技资源要素+AI模型,以AI,赋能技术转移、成果转化、技术经理人培训、知识产权管理、区域产业分析与布局、地方科技招商、创新创业大赛等场景,推出科技创新领域的AI工具、场景化服务和数智化解决方案,推动科技创新与产业创新智能化发展。
F500A 立式机触摸屏程序
F500A 立式机触摸屏程序
汉语言文学22班 马旭 1243022203 现当代文学读书笔记.pdf
img_to_pdf_1796121273101.pdf
西汉BC106年世界历史地图矢量文件SHP格式.zip
本资源为《西汉BC106年世界历史地图矢量文件SHP格式》压缩包,文件大小约 2.32 MB,便于集中下载、整理和使用。具体内容请结合压缩包内的实际文件与说明查看。 在当前可读取的目录中,可见属性表(.dbf)、投影说明文件(.prj)、Shapefile 主文件(.shp)、Shapefile 索引(.shx)。建议解压后保持原有目录结构,先浏览文件清单与说明,再选择需要的资料进行加载或整理。 应用方面,可根据实际资料用于学习练习、资料检索、研究整理或项目参考。使用时可先确定所需内容,建立清晰的文件分类,再按项目要求进行筛选、转换与汇总。 使用 Shapefile 数据时,请把实际配套的 .shp、.shx、.dbf 等文件保存在同一目录,并保持同名关联;加载后再检查坐标系与中文字段显示。如需叠加其它数据,请先统一坐标与字段口径。 数据来源、时间范围、坐标系、字段定义、精度和使用条件,请以实际文件及原始说明为准。本介绍不对文件名之外尚未核实的信息作额外承诺。


