Skip to content

feat(projects): project unified guide compilation outputs - #357

Open
durutheguru wants to merge 24 commits into
mainfrom
agent/ws-pol-003-04a3-hidden-projections
Open

feat(projects): project unified guide compilation outputs#357
durutheguru wants to merge 24 commits into
mainfrom
agent/ws-pol-003-04a3-hidden-projections

Conversation

@durutheguru

@duruthegurudurutheguru commented Aug 22, 2026

Copy link
Copy Markdown
Member

Summary

  • add hidden, route-unreachable projection commands for guide sufficiency and submission-artifact-policy drafts
  • bind each projection to the exact persisted compilation, setup generation, source material, authorization receipt, canonical output digest, and immutable custody record
  • seal review-found custody edges: recompute business digests in PostgreSQL, reject late or reassigned source provenance, and reject non-canonical artifact paths
  • keep production authorization deny-default; add no model call, worker, queue, setup mutation, approval, effective policy, or live cutover

Verification

  • 345 focused tests passed against isolated PostgreSQL and MinIO
  • all 7 canonical semantic lanes passed: 4,265/4,265 nodes, zero skips/retries/deselection/duplication
  • repository branch coverage: 91.34%; dedicated 04A3 production files: 95.59%-100%; legacy repository non-regression floor: 78.47%
  • Ruff, docstring coverage, authorization boundary, behavior ownership, Linux dependency, stale-contract, Markdown-link, and atomic chunk-state gates passed
  • exact-head code-review evidence validated with no findings; human review remains required

Boundaries

This PR creates hidden projections only. AUTH-12J must activate their exact service authority, and POL-04A2 must add hidden setup-ledger finalization before any live cutover. Human merge is required.

Description: Documents changes across .agent-loop; notable files: .agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/chunks/WS-POL-003-04A3-hidden-compilation-projections.md. clarify the latest workflow and implementation details.
Stats: files=1 +7/-1 A=0 M=1 D=0 R=0
Driver: docs
Areas:
- .agent-loop: files=1 +7/-1 churn=8
Top files:
- [M] .agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/chunks/WS-POL-003-04A3-hidden-compilation-projections.md (+7/-1)
Reason: capture the current local repository changes on the selected branch.
Description: Fixes changes across backend and .agent-loop; notable files: .agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/chunks/WS-POL-003-04A3-hidden-compilation-projections.md, backend/tests/projects/guide_compilation/test_request_operation_postgresql.py. capture the latest implementation updates.
Stats: files=2 +11/-3 A=0 M=2 D=0 R=0
Driver: code
Areas:
- backend: files=1 +7/-1 churn=8
- .agent-loop: files=1 +4/-2 churn=6
Top files:
- [M] backend/tests/projects/guide_compilation/test_request_operation_postgresql.py (+7/-1)
- [M] .agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/chunks/WS-POL-003-04A3-hidden-compilation-projections.md (+4/-2)
Reason: capture the current local repository changes on the selected branch.
Description: Updates changes across backend and .agent-loop; notable files: .agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/chunks/WS-POL-003-04A3-hidden-compilation-projections.md, .github/workflows/backend.yml. keep automation aligned with repository changes.
Stats: files=5 +105/-28 A=0 M=5 D=0 R=0
Driver: ci
Areas:
- backend: files=3 +90/-20 churn=110
- .agent-loop: files=1 +12/-6 churn=18
- ci: files=1 +3/-2 churn=5
Top files:
- [M] backend/tests/projects/guide_compilation/test_projection_postgresql.py (+66/-0)
- [M] backend/tests/projects/guide_compilation/test_projection_migration.py (+24/-4)
- [M] .agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/chunks/WS-POL-003-04A3-hidden-compilation-projections.md (+12/-6)
- [M] backend/app/modules/projects/repository.py (+0/-16)
- [M] .github/workflows/backend.yml (+3/-2)
Reason: capture the current local repository changes on the selected branch.
Description: Covers changes across backend; notable files: backend/tests/projects/guide_compilation/test_projection_postgresql.py. capture the latest expected behavior.
Stats: files=1 +0/-67 A=0 M=1 D=0 R=0
Driver: test
Areas:
- backend: files=1 +0/-67 churn=67
Top files:
- [M] backend/tests/projects/guide_compilation/test_projection_postgresql.py (+0/-67)
Reason: capture the current local repository changes on the selected branch.
Description: Documents changes across .agent-loop; notable files: .agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/reviews/WS-POL-003-04A3-implementation-review-evidence.md. clarify the latest workflow and implementation details.
Stats: files=1 +111/-0 A=1 M=0 D=0 R=0
Driver: docs
Areas:
- .agent-loop: files=1 +111/-0 churn=111
Top files:
- [A] .agent-loop/initiatives/WS-POL-003-unified-project-guide-compilation/reviews/WS-POL-003-04A3-implementation-review-evidence.md (+111/-0)
Reason: capture the current local repository changes on the selected branch.
@coderabbitai

coderabbitaiBot commented Aug 22, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8b2948b8-d8ca-4f80-8bb8-bb793d4c4e5c


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Avoid stale human-worker terminology while preserving the hidden projection cutover boundary.

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:0484b7b314

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +310 to +313
if new.facts_digest is distinct from
project_guide_projection_facts_digest(new)
or new.authority_resource_digest is distinct from
project_guide_projection_authority_digest(new) then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bind projection custody to the referenced product row

When projection custody is inserted through direct SQL, these checks only prove that the operation and audit event agree with the operation's self-declared digests; they never recompute output_digest from the referenced sufficiency report or submission policy. A writer can therefore insert arbitrary business content first, attach an internally consistent operation, and have the later immutability triggers permanently seal a false custody receipt. Validate the referenced row's canonical content and identity before accepting the operation.

Useful? React with 👍 / 👎.

"create trigger projected_policy_update_guard before update on submission_artifact_policies for each row execute function guard_compilation_projection_business_change()",
"create trigger projected_report_delete_guard before delete on guide_sufficiency_reports for each row execute function reject_compilation_projection_business_delete()",
"create trigger projected_policy_delete_guard before delete on submission_artifact_policies for each row execute function reject_compilation_projection_business_delete()",
"create trigger projected_usage_delete_guard before update or delete on guide_sufficiency_report_source_usages for each row execute function reject_compilation_projection_business_delete()",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject provenance inserts after projection custody exists

For a report already referenced by a projection operation, this trigger protects existing source usages from update/delete but still permits inserting another valid usage at a new item order. That changes the supposedly immutable provenance set after its receipt was committed, and downstream _verified_report_usages will reject the report when the usage count/order no longer matches the snapshot, potentially blocking later activation. Add an insert guard that rejects new usages once the report has projection custody.

Useful? React with 👍 / 👎.

"create trigger projected_policy_update_guard before update on submission_artifact_policies for each row execute function guard_compilation_projection_business_change()",
"create trigger projected_report_delete_guard before delete on guide_sufficiency_reports for each row execute function reject_compilation_projection_business_delete()",
"create trigger projected_policy_delete_guard before delete on submission_artifact_policies for each row execute function reject_compilation_projection_business_delete()",
"create trigger projected_usage_delete_guard before update or delete on guide_sufficiency_report_source_usages for each row execute function reject_compilation_projection_business_delete()",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve updates to unprojected source usages

For any legacy or otherwise unprojected source-usage row, this BEFORE UPDATE OR DELETE trigger reaches return old; on an UPDATE, PostgreSQL consequently reports success while replacing NEW with the unchanged old tuple. The migration is intended to make only usages referenced by a projection immutable, so use separate update/delete trigger functions or return NEW for an unprotected update.

Useful? React with 👍 / 👎.

Comment on lines +115 to +117
"key": f"required-artifact-{index:03d}",
"path": value,
"hash_required": True,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate required artifacts as canonical relative paths

When a compilation proposes a value such as " README.md ", the existing safe-text check and ArtifactRuleInput length constraint both accept it, and this transform persists it unchanged as the policy path. Such noncanonical paths will not match the actual submission artifact even though the projection contract requires canonical relative paths. Apply canonical relative-path validation before constructing these rules, rejecting rather than trimming or repairing invalid values.

Useful? React with 👍 / 👎.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@durutheguru