desloppify/core/dimensions.py or similar files about dimensions
Any files that mention "stale" or "subjective" dimensions
Be very thorough - read complete files where needed. I need to understand:
What makes a dimension "subjective" vs "objective"
How staleness is determined
The plan schema (what fields an item has)
How reconciliation currently works
What happens when the plan is empty
Assistant
I'll conduct a thorough exploration of the desloppify codebase focusing on the plan system, subjective dimensions, and work queue interactions. Let me start by examining the key files.
Assistant
Now let me read the key files. I'll start with the plan schema and core files:
Assistant
Now let me read the reconciliation and operations files:
Assistant
Now let me read the work queue files:
Assistant
Now let me examine the scan workflow and dimension-related files:
Assistant
Let me read the subjective dimensions and analysis files:
Assistant
Now let me look for where subjective dimensions are defined and how stale is tracked:
Assistant
Let me examine the key files that mention stale and subjective:
Assistant
Now let me search for where needs_review_refresh is set:
Assistant
Excellent! Now let me look at the work queue init file and check for imports:
Assistant
Let me look at more state schema details:
Assistant
Now let me check how items get added to the plan:
Assistant
Let me check how the queue is initially constructed by looking at the test files to understand the interactions better:
Assistant
Let me read one of these test files to understand the interactions:
Assistant
Perfect! Now I have a comprehensive understanding. Let me create a final summary document by examining a few more key details about how items initially enter the plan:
Assistant
Excellent! Now let me verify the analysis with one more look at how finding items flow through the system:
Assistant
User
Search the desloppify codebase for logic that blocks or gates subjective dimension reviews when there are items in the plan queue. Look for:
Any logic that checks if the plan queue has items before allowing subjective reviews
Any "blocker" or "gate" that prevents reviewing subjective dimensions when mechanical findings exist in the queue
Logic in review-related commands that checks plan state
Any file mentioning "blocker" or "preflight" or "gate" in context of subjective/review
Be very thorough - read complete files where relevant.
Assistant
I'll search the codebase thoroughly for logic that blocks or gates subjective dimension reviews based on plan queue state. Let me start with several parallel searches to cover all the key areas.
Assistant
Now let me read the key files to understand the gating logic:
Assistant
Perfect! Now let me search for more context around how this gate is triggered and any narrative-level logic:
Assistant
Now let me search for where the stale markers are actually set:
Assistant
Excellent! Now let me look at resolution.py to see if there are other places where stale markers are set:
Assistant
Perfect! Now let me search for any narrative-level messaging about the gate:
Assistant
Now let me check the narrative reminders file to see if there are any messages about the review gate:
Assistant
Perfect! Now let me search for any tests around blocking/gating and verify the complete flow:
Assistant
Perfect! Now let me get one final search to look for any documentation or comments about the gating logic:
Assistant
Excellent! Let me create a comprehensive summary document. Let me also look at one more thing - how the stale markers are set up during the resolve flow:
Assistant
Perfect! I have all the information I need. Let me compile the comprehensive analysis:
Comprehensive Desloppify Plan System, Subjective Dimensions, and Work Queue Analysis
1. THE PLAN SYSTEM
1.1 Plan Schema (PlanModel) - /Users/user_c042661f/Documents/desloppify/desloppify/engine/_plan/schema.py
The plan is a JSON file stored at .desloppify/plan.json with the following structure:
python
class PlanModel(TypedDict):
version: int # PLAN_VERSION = 2
created: str # ISO timestamp
updated: str # ISO timestamp
queue_order: list[str] # Finding IDs in user-specified order
deferred: list[str] # Legacy list (kept for v1→v2 migration, always empty)
skipped: dict # Finding ID → SkipEntry
active_cluster: str | None # Currently focused cluster name
overrides: dict # Finding ID → ItemOverride (descriptions/notes)
clusters: dict # Cluster name → Cluster metadata
superseded: dict # Finding ID → SupersededEntry
Key SkipEntry fields:
finding_id, kind (required) - "temporary", "permanent", or "false_positive"
reason, note, attestation - optional metadata
review_after - number of scans before re-surfacing (temporary only)
skipped_at_scan - scan count when skipped (for review_after calculation)
created_at - ISO timestamp
Key ItemOverride fields:
finding_id (required)
description - augmented description
note - user annotation
cluster - cluster membership reference
created_at, updated_at
Key Cluster fields:
name (required), description
finding_ids - list of member IDs
created_at, updated_at
Key SupersededEntry fields:
original_id, original_detector, original_file, original_summary - original finding metadata
status - "superseded", "remapped", or "dismissed"
superseded_at - ISO timestamp
remapped_to - optional remap target
candidates - list of potential remaps (up to 5)
note - preserved from override if exists
1.2 How Items Initially Enter the Plan
Items do NOT automatically enter queue_order on scan. The plan is purely user-driven:
Initial state: When a plan.json is first created, queue_order is empty
Adding items: Users must manually call plan operations (via CLI subcommands or API):
move_items() - explicitly reorder/add items to queue
unskip_items() - bring items back from skipped → appended to queue_order
resurface_stale_skips() - automatic resurfacing of temporary skips past their review_after threshold
Removing items:
skip_items() - move to skipped dict
defer_items() (deprecated) - delegates to skip_items with kind="temporary"
purge_ids() - remove entirely from all plan structures (except overrides)
Lifecycle example:
code
[No plan] → scan generates findings A, B, C (not in queue yet)
→ user runs: desloppify plan move "finding_a::" top
→ finding_a added to queue_order [0]
→ user skips finding_b: skip_items(plan, ["b"], kind="temporary", review_after=3, scan_count=5)
→ finding_b moves to skipped, not in queue_order
→ after 3+ scans (scan_count >= 8): resurface_stale_skips() moves b back to queue_order
1.3 Persistence and Atomic Writes
Load: load_plan(path) returns empty plan on missing/corrupted file
Now let me compile the findings into a comprehensive report:
Summary: Subjective Dimension Review Gating Logic
I've conducted a thorough search of the desloppify codebase and found a well-designed system for blocking/gating subjective dimension reviews when objective findings exist in the queue. Here are the key components:
1. Main Gate Implementation (desloppify/app/commands/review/preflight.py)
Entry Point:review_rerun_preflight() function
The gate logic prevents re-review of subjective dimensions when:
The dimension already has a nonzero score (indicating a prior review)
Open objective findings still exist in the work queue
The user has NOT provided --force-review-rerun flag
How it works:
Checks if targeted dimensions are "scored" (have nonzero subjective scores)
Only gates dimensions that are actually targeted (via --dimensions flag or all scored dims)
First review runs (all zero scores) bypass the gate entirely
Builds the work queue with QueueBuildOptions(status="open", include_subjective=False, count=None)
Counts total objective findings and blocks if > 0 with exit code 1
Lines 59-129 in preflight.py:
python
def review_rerun_preflight(state, args, *, state_file=None, save_fn=save_state) -> None:
"""Single entry point: gate check -> clear stale -> save."""
# Get targeted dimensions
dimensions = parse_dimensions(args)
# --force-review-rerun bypasses entirely
if getattr(args, "force_review_rerun", False):
print(colorize("--force-review-rerun: bypassing objective-plan-drained check.", "yellow"))
else:
scored_dims = _scored_dimensions(state) # Find dims with nonzero scores
blocking_dims = sorted(d for d in scored_dims if d in dimensions)
if blocking_dims:
result = build_work_queue(state, options=QueueBuildOptions(
status="open", include_subjective=False, count=None))
total = result["total"]
if total > 0: # Block if open objectives exist
print(f"Blocked: {total} open objective finding(s)", file=sys.stderr)
print(f"Scored dimensions: {', '.join(blocking_dims)}", file=sys.stderr)
sys.exit(1)
# Gate passed: clear stale markers and save
cleared = clear_stale_subjective_entries(state, dimensions=dimensions)
2. Integration into Review Command (desloppify/app/commands/review/entrypoint.py)
The preflight gate is invoked before the following review modes:
Default (prepare) - line 160
--run-batches - line 101
--external-start - line 112
NOT invoked for:
--import - direct import of findings bypasses gate
--validate-import - validation only
--external-submit - submission only
--merge - merge mode
3. Stale Marker Management
Two triggering mechanisms:
A. Mechanical Finding Changes (merge.py, lines 55-90)
Marks subjective assessments stale when mechanical detectors change:
B. Review Finding Resolution (resolution.py, lines 40-81)
Marks stale when review findings are fixed/wontfixed/marked false_positive:
python
def _mark_stale_assessments_on_review_resolve(state, *, status, resolved_findings, now):
# When review findings change status, mark affected dimension assessments stale
payload["refresh_reason"] = f"review_finding_{status}" # e.g., "review_finding_fixed"
payload["stale_since"] = now
payload["needs_review_refresh"] = True
4. Stale Marker Clearing (preflight.py, lines 19-43)
After the gate passes, clear_stale_subjective_entries() removes refresh markers:
python
def clear_stale_subjective_entries(state, *, dimensions=None):
"""Clear needs_review_refresh markers from subjective assessments."""
for dim_key, assessment in assessments.items():
if assessment.get("needs_review_refresh"):
assessment.pop("needs_review_refresh", None)
assessment.pop("stale_since", None)
assessment.pop("refresh_reason", None)
5. Command-Line Interface
Key flags:
--force-review-rerun - Bypass the objective-drained check entirely
--dimensions <dim1,dim2,...> - Target specific dimensions (can suggest unscored ones to avoid gate)
User Messaging:
When blocked:
code
Blocked: N open objective finding(s) — this is a review rerun.
Scored dimensions: dimension1, dimension2
Tip: target only unscored dimensions with --dimensions logic_clarity
Resolve open items first, or override with --force-review-rerun