-
Notifications
You must be signed in to change notification settings - Fork 0
idx=14: freeze (381 records) — Aralez Designation of Agent Agreement (tri-party gov contract with embedded SF-1449) #87
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
base: redo/idx-13
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -586,6 +586,27 @@ def _apply_scope_rule(rows: list[dict[str, Any]]) -> list[dict[str, Any]]: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| first_child_title = children[0]["title"] if children else None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if _is_real_subdoc_title(r.get("title"), r.get("cls"), r.get("is_envelope", False), first_child_title): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| real_subdoc_ids.add(r["node_id"]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Secondary-agreement carrier: a node whose own subdoc_penalty | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # is 0 but whose direct children carry subdoc_penalty>=1. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # The depth-walker sets this when a non-subdoc-class section has | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # a title matching the AGREEMENT|PLAN structural-level-0 pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # and the primary L0 has already been emitted (see walk_sections' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # is_secondary_agreement branch). Structurally this IS an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # attached subdocument (it has its own subtree with its own | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # depth penalty) even though doc2dict didn't tag its cls as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # exhibit/schedule/appendix/annex. Treat it as a real subdoc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # for scope purposes so the post-sig walk-up doesn't strand it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # in trailer (and bring genuine attached subdoc content with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # it). The check is purely structural: subdoc_penalty arithmetic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # comes from the tree walk, not phrase matching. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| not r.get("is_envelope") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| and (r.get("subdoc_penalty", 0) or 0) == 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| and children | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| and any((c.get("subdoc_penalty", 0) or 0) > 0 for c in children) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| real_subdoc_ids.add(r["node_id"]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+589
to
+609
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial | 💤 Low value Consider using The static analysis tool correctly identifies that the ♻️ Suggested refactor- else:
- # Secondary-agreement carrier: a node whose own subdoc_penalty
- # is 0 but whose direct children carry subdoc_penalty>=1.
- # The depth-walker sets this when a non-subdoc-class section has
- # a title matching the AGREEMENT|PLAN structural-level-0 pattern
- # and the primary L0 has already been emitted (see walk_sections'
- # is_secondary_agreement branch). Structurally this IS an
- # attached subdocument (it has its own subtree with its own
- # depth penalty) even though doc2dict didn't tag its cls as
- # exhibit/schedule/appendix/annex. Treat it as a real subdoc
- # for scope purposes so the post-sig walk-up doesn't strand it
- # in trailer (and bring genuine attached subdoc content with
- # it). The check is purely structural: subdoc_penalty arithmetic
- # comes from the tree walk, not phrase matching.
- if (
- not r.get("is_envelope")
- and (r.get("subdoc_penalty", 0) or 0) == 0
- and children
- and any((c.get("subdoc_penalty", 0) or 0) > 0 for c in children)
- ):
- real_subdoc_ids.add(r["node_id"])
+ # Secondary-agreement carrier: a node whose own subdoc_penalty
+ # is 0 but whose direct children carry subdoc_penalty>=1.
+ # The depth-walker sets this when a non-subdoc-class section has
+ # a title matching the AGREEMENT|PLAN structural-level-0 pattern
+ # and the primary L0 has already been emitted (see walk_sections'
+ # is_secondary_agreement branch). Structurally this IS an
+ # attached subdocument (it has its own subtree with its own
+ # depth penalty) even though doc2dict didn't tag its cls as
+ # exhibit/schedule/appendix/annex. Treat it as a real subdoc
+ # for scope purposes so the post-sig walk-up doesn't strand it
+ # in trailer (and bring genuine attached subdoc content with
+ # it). The check is purely structural: subdoc_penalty arithmetic
+ # comes from the tree walk, not phrase matching.
+ elif (
+ not r.get("is_envelope")
+ and (r.get("subdoc_penalty", 0) or 0) == 0
+ and children
+ and any((c.get("subdoc_penalty", 0) or 0) > 0 for c in children)
+ ):
+ real_subdoc_ids.add(r["node_id"])📝 Committable suggestion
Suggested change
🧰 Tools🪛 Ruff (0.15.12)[warning] 589-603: Use Convert to (PLR5501) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _is_descendant_of_subdoc(row: dict[str, Any]) -> bool: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| current_id = row.get("parent_node_id") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current logic for identifying secondary-agreement carriers is too broad and contradicts the documented scope rule in
task_rules/scope_rule.md.According to the scope rule, bare identifiers (e.g., "EXHIBIT A" with no descriptive text) are NOT real subdocuments and should be excluded from the JSONL if they appear after the signature block. However, because
walk_sectionsincrements thesubdoc_penaltyfor any node with a subdoc class (line 954), a bare exhibit will satisfy the condition(penalty == 0 and children penalty > 0). This causes bare exhibits to be added toreal_subdoc_ids, protecting them and their descendants from being marked astrailerscope.To align with the intent of recovering only secondary agreements (as noted in your comment on lines 590-602), you should ensure the node does not belong to a subdoc class.
References