Repository navigation
feat(contribution): persist policy economic truth #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d7eb844
feat(contribution): persist policy economic truth
Abiorh001 b7d6641
fix(contribution): decouple project mapper import
Abiorh001 35bc317
fix(contribution): address external review
Abiorh001 b774f70
merge main and linearize contribution migration
Abiorh001 c69f1aa
Merge remote-tracking branch 'origin/main' into codex/ws-con-001-03b-…
Abiorh001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...bution-compensation-boundary/reviews/WS-CON-001-03B-external-review-response.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # External Review Response: WS-CON-001-03B | ||
|
|
||
| ## Comments addressed | ||
|
|
||
| - GitHub `project_lifecycle` lane failed because the `Project` mapper named | ||
| `ContributionPolicy` in a reverse ORM relationship even when a project-only | ||
| process had not imported the contributions module. The resulting mapper | ||
| initialization failure cascaded into actor-registry 503 responses. | ||
| - Removed the unnecessary bidirectional ORM relationship. Database foreign | ||
| keys and composite same-project lineage remain authoritative and unchanged. | ||
| - CodeRabbit's four actionable findings were accepted: the chunk-map stop | ||
| boundary and contract doc scope are current, migration check-constraint names | ||
| now follow metadata conventions, and the contribution migration round trip no | ||
| longer runs from the shared lane. The canonical partitioned Alembic test | ||
| already proves the same 0055 head downgrade/upgrade path. | ||
| - Removed the redundant configured-unit unique index; its composite primary key | ||
| remains the award-definition FK target. | ||
|
|
||
| ## Comments deferred | ||
|
|
||
| - CodeRabbit's whole-history graph-scan performance suggestion is deferred to | ||
| the later command/service chunk. PostgreSQL deferred constraint triggers are | ||
| necessarily row-level, and 03B intentionally favors a complete fail-closed | ||
| validation before scale behavior exists. | ||
| - The ISO snapshot remains duplicated deliberately because migrations must be | ||
| immutable and self-contained; a parity test prevents application precheck | ||
| drift. Defensive Decimal post-regex checks remain explicit and harmless. | ||
| - Additional policy-input unit cases are optional; the closed validators are | ||
| covered by the 95% subsystem gate and current negative tests. | ||
|
|
||
| ## Human decisions needed | ||
|
|
||
| - None beyond normal PR review and merge approval. | ||
|
|
||
| ## Commands rerun | ||
|
|
||
| ```text | ||
| project-only configure_mappers probe: passed | ||
| isolated test_projects.py::test_active_guide_lookup_surfaces_duplicate_rows: passed | ||
| semantic-lane integrity: 33 passed | ||
| focused isolated contribution PostgreSQL suite: 44 passed | ||
| canonical Alembic head upgrade/downgrade: 1 passed | ||
| contribution subsystem coverage: 94.89% | ||
| Ruff: passed | ||
| git diff --check: passed | ||
| ``` | ||
|
|
||
| ## Remaining risks | ||
|
|
||
| GitHub CI and CodeRabbit must complete on the repaired commit. |
51 changes: 51 additions & 0 deletions
51
...bution-compensation-boundary/reviews/WS-CON-001-03B-internal-review-evidence.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Internal Review Evidence: WS-CON-001-03B | ||
|
|
||
| ## Scope | ||
|
|
||
| 03B adds schema-only contribution-policy persistence: policy/version/rule/ | ||
| award-definition lineage, project-configured compensation units, an immutable | ||
| migration-owned ISO 4217 registry, exact quantity validation, and PostgreSQL | ||
| guards. It adds no service, route, claim, award result, adapter execution, | ||
| AUTH/ART behavior, or public API. | ||
|
|
||
| Reconciled main baseline: `9550b3cdb8ac12dea72931277cf46ac1b8ffda7f`. | ||
| The user-owned archival PDF deletion is excluded from this chunk. | ||
|
|
||
| ## Deterministic Evidence | ||
|
|
||
| ```text | ||
| 44 focused isolated PostgreSQL tests passed | ||
| 1 canonical Alembic head upgrade/downgrade test passed | ||
| 33 semantic-lane integrity tests passed | ||
| contributions module coverage: 94.89% (required at least 90%) | ||
| Ruff: passed | ||
| git diff --check: passed | ||
| Markdown links: passed | ||
| stale Workstream/review/authorization/artifact scans: passed | ||
| Alembic head: 0055_contribution_policy | ||
| ``` | ||
|
|
||
| The PostgreSQL proof covers complete and incomplete policy graphs, configured | ||
| unit provenance, exact decimal boundaries without typemod rounding, whole | ||
| project points, published/retired immutability, reparent rejection, truncate | ||
| rejection, active-selector uniqueness, and publish/child-mutation races. | ||
|
|
||
| ## Review Results | ||
|
|
||
| | Track | Result | Resolution | | ||
| |---|---|---| | ||
| | Senior engineering | PASS | Null ISO bypass closed; reparent and migration concerns resolved. | | ||
| | QA/test | PASS | Independent graph, numeric, immutability, unit, and race proof added. | | ||
| | Security | PASS | Truncate bypass closed across every economic/provenance table. | | ||
| | Product/ops | PASS | Project-configured ISO/points semantics align with the canonical contract. | | ||
| | Architecture | PASS | Schema-only boundary and future REV FK remain stable. | | ||
| | Docs | PASS | Canonical spec, data model detail, and entity overview align. | | ||
| | Reuse/dedup | PASS | Shared compensation instrument enum reused. | | ||
| | Test delta | PASS | No removed, skipped, weakened, or masked coverage remains. | | ||
| | CI integrity | PASS | Fixed 90% hosted coverage gate and exact shared-foundations lane assignment added. | | ||
|
|
||
| ## Deferred Boundary | ||
|
|
||
| Authorized policy mutation belongs to 04B. Contribution records and awards | ||
| remain in 03C after REV supplies stable Review, ReviewLease, and | ||
| FinalAcceptance targets. No next chunk starts automatically. |
51 changes: 51 additions & 0 deletions
51
...01-contribution-compensation-boundary/reviews/WS-CON-001-03B-pr-trust-bundle.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # PR Trust Bundle: WS-CON-001-03B | ||
|
|
||
| ## Outcome | ||
|
|
||
| Adds migration `0055_contribution_policy` and the SQLAlchemy/Pydantic | ||
| foundation for project-scoped contribution policies and immutable published | ||
| economic rules. | ||
|
|
||
| ## Design And Boundaries | ||
|
|
||
| - One active policy per project selects one same-policy published version. | ||
| - Deferred PostgreSQL validation requires exactly the submission and review | ||
| rules and the correct unpaid/compensated definition graph. | ||
| - Composite keys preserve same-project lineage through policy, version, rule, | ||
| configured unit, award definition, and the 03A adapter binding. | ||
| - Money uses project-enabled current ISO 4217 codes; project points use a | ||
| project-scoped unit and whole-number quantities. | ||
| - Exact numeric input is stored without PostgreSQL typemod rounding and checked | ||
| against the 20-integer/18-fractional-digit envelope. | ||
| - Published/retired content, ISO registry rows, unit rows, and table contents | ||
| reject unauthorized mutation, deletion, reparenting, and truncation. | ||
| - No command/service/API/AUTH/ART/REV behavior is introduced. | ||
|
|
||
| ## Verification | ||
|
|
||
| - 44 focused isolated PostgreSQL tests passed, including the active-selector | ||
| negative regression. | ||
| - Canonical head upgrade/downgrade passed. | ||
| - Contribution subsystem coverage is 94.89%. | ||
| - Hosted CI enforces at least 90% contribution-subsystem coverage. | ||
| - The contribution test module is assigned exactly once to the | ||
| `shared_foundations` semantic lane; lane-integrity tests pass. | ||
| - Ruff, diff hygiene, Markdown links, and all applicable stale scans pass. | ||
| - Required internal reviewers pass after their valid findings were repaired. | ||
|
|
||
| ## Human Review Focus | ||
|
|
||
| 1. Confirm 0055 remains a linear child of AUTH 0054 on the reconciled main head. | ||
| 2. Confirm deferred graph validation and child locking prevent mixed published | ||
| economic truth. | ||
| 3. Confirm money/points unit provenance and exact numeric constraints match the | ||
| canonical specification. | ||
| 4. Confirm 03B remains schema-only and does not claim AUTH, ART, or REV behavior. | ||
|
|
||
| ## Remaining External Gate | ||
|
|
||
| The first hosted project-lifecycle run exposed an import-order failure from an | ||
| unnecessary reverse ORM relationship. That relationship was removed without | ||
| changing database lineage, and the exact formerly failing project test passes | ||
| in isolation. GitHub CI and CodeRabbit must pass on the repaired exact head. | ||
| Human merge is required, and no subsequent chunk begins automatically. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.