merge: 合入 Trellis 项目升级(09-05-trellis-upgrade-rule-cleanup)

这个提交包含在:
2026-09-06 11:14:42 +08:00
当前提交 66f25b1fa8
共修改 48 个文件,包含 4588 行新增和 1053 行删除
+3 -10
查看文件
@@ -42,23 +42,16 @@ These guides help you **ask the right questions before coding**.
- [ ] You're writing similar code to something that exists
- [ ] You see the same pattern repeated 3+ times
- [ ] You're adding a new field to multiple places
- [ ] **You're modifying any constant or config**
- [ ] You are changing a shared constant or configuration contract
- [ ] **You're creating a new utility/helper function** ← Search first!
→ Read [Code Reuse Thinking Guide](./code-reuse-thinking-guide.md)
---
## Pre-Modification Rule (CRITICAL)
## Reference Checks By Risk
> **Before changing ANY value, ALWAYS search first!**
```bash
# Search for the value you're about to change
grep -r "value_to_change" .
```
This single habit prevents most "forgot to update X" bugs.
Before changing shared contracts, cross-layer constants or configuration, inspect their consumers. A local literal or wording correction does not require a repository-wide search. Read these guides only when the task matches their triggers; do not repeat an unchanged checklist every turn.
---
+55 -3
查看文件
@@ -16,9 +16,32 @@ tasks after TRELLIS2.
- In sub-agent dispatch mode, curate `implement.jsonl` and `check.jsonl` with
stable spec or research context only. In Codex inline mode they may contain
no real entries because the main session reads specs directly.
- Give a concrete implementation plan before coding and wait for approval.
- Give a concrete plan before non-trivial changes. Recorded approval of the
same scope authorizes implementation and task-scoped validation; clerical
backfill and repeated planning injection do not restart approval.
- Keep edits scoped to the current Trellis task.
- Commit in Chinese and include the Trellis task name or task ID.
- Commit only when explicitly requested, in Chinese with the task name or ID.
## Risk-Scoped Execution
- Pure consultation and small isolated edits do not need a task-creation
question. Non-trivial work uses the task contract; new scope, risk or
acceptance decisions require approval, not every intermediate action.
- Read the current phase and affected-layer contracts on demand. Reuse
unchanged context; do not require every document or thinking guide per turn.
- Prefer an available native plan tool. If unavailable, keep the checklist
in the current task implementation notes rather than stopping or creating
another planning system.
- Select checks from the task diff and its risks, not all unrelated dirty
files. Reuse passing checks with unchanged inputs; report pre-existing
failures without modifying unrelated code.
- Preserve privacy, permission/payment controls and separately approved
production operations. Rules-only work does not require public deployment.
- Report local validation, independent review and public availability
separately. If independent review is unavailable, leave that gate pending
rather than claiming main-session tests fulfilled it.
- A finished stage may leave its parent task active. Never auto-commit,
auto-archive, clean unrelated tasks or create duplicate retrospectives.
## Solo Developer Operating Mode
@@ -327,12 +350,35 @@ preview platform scope -> conservative update/migrate -> merge overlays
- Sub-agent mode requires at least one real entry in each manifest.
- Switching dispatch mode changes the validation policy, not historical task
evidence and not the requirement to read specs before implementation.
- Trellis 0.6.16 start and validate share get_codex_dispatch_mode. Inline
tolerates old seed-only rows; real entries require non-empty file/reason
and resolved paths contained within the project. Sub-agent mode retains
the curated-entry gate. The start override alone does not change validate.
- The inline seed exception applies only to an object whose sole key is
`_example`. Any additional key, including a falsey file/path, reason, type
or an unknown key, makes it a mixed placeholder that validate must reject
with ``Placeholder `_example` row left by an older task.py create``.
Field absence is not equivalent to an explicitly empty or invalid value.
- Update task.py and task_context.py as a coherent set: the newer start
imports curated_entry_count. Keeping the old conflict file breaks imports.
- The fixed 0.6.16 upstream hooks do not enforce this marker contract:
session-start counts truthy file fields; inject-subagent-context accepts
truthy file/path fields. They can count or inject mixed marker rows that
validate rejects. Hook readiness/injection is not manifest validation.
Preserve the reviewed upstream hooks; do not treat their success as a
substitute for the validator gate.
### 4. Validation & Error Matrix
- Inline + zero real entries -> pass with `*_inline_optional`.
- Inline + malformed real entry -> fail.
- Sub-agent + zero real entries -> fail with `*_empty`.
- Either mode + `_example` with any additional key -> fail at that row;
a valid file/reason pair does not make a mixed placeholder acceptable.
- Sub-agent + empty manifest -> fail: governance reports `*_empty`;
`task.py validate` reports `0 curated entries`.
- Sub-agent + seed-only manifest -> fail: `task.py validate` reports
``Placeholder `_example` row left by an older task.py create`` before the
empty-manifest gate; governance reports `*_seed` and `*_empty`.
- Either mode + non-spec/non-research context -> warning for review.
### 5. Good/Base/Bad Cases
@@ -346,7 +392,13 @@ preview platform scope -> conservative update/migrate -> merge overlays
- Fixture test for inline seed-only pass.
- Fixture test for sub-agent seed-only failure.
- Negative fixtures for `_example` plus empty/false/null file or path,
reason/type/unknown keys and valid file/reason, in inline/sub-agent/auto.
Assert exit 1 and exact placeholder diagnostics for both manifests.
- Assert pure inline seeds count as zero entries and cannot hide a malformed
following row; run new cases against the old condition to prove they fail.
- Run both Trellis governance and `task.py validate` for the active task.
- Run `cd server && npm test -- tests/unit/scripts/trellis-runtime-contract.test.js tests/unit/scripts/check-trellis-governance.test.js` for mode gates, real hook routing, path containment and explicit closeout boundaries.
### 7. Wrong vs Correct