Skip to content

feat(project): intake bootstrap + cross-field semantic inference - #2

Closed
joyshmitz wants to merge 50 commits into
mainfrom
research/methodology-foundation-clean
Closed

joyshmitz wants to merge 50 commits into
mainfrom
research/methodology-foundation-clean

Conversation

@joyshmitz

Copy link
Copy Markdown
Owner

Summary

  • Workspace bootstrap (cd97cfdb3): adds project/intake init command, shared workspace validation layer (IntakeCommandError / WorkspaceValidationError), clean role_assignments.yaml scaffold without demo assignees, and actionable hints across all intake commands (generate, compile, preview, review, evidence).
  • Cross-field semantic inference (01e7d21ac): adds YAML-driven inference rule catalog (specs/inference/cross_field_rules.yaml), bounded fixpoint engine with provenance tracking, dedicated validate_semantic_consistency validator, and split assumption reporting (archetype defaults vs inferences) across pipeline, preview, and review layers.

Key design decisions:

  • Inference never overwrites explicit human answers; only fills missing/tbd fields.
  • Semantic contradictions are reported only when at least one implicated field is explicit human input (spec-internal contradictions are validated separately at the spec level).
  • Archetype defaults and inference assumptions carry distinct kind markers and are counted separately in all reporting surfaces.
  • workspace.manifest.yaml intentionally excluded from checked-in examples — its contract still carries absolute local paths (tracked as separate manifest-layer defect).

Test plan

  • project/intake verify -> 307 passed in 9.61s
  • Bootstrap flow: init, generate, compile smoke test, all rejection cases, file-path and empty-assignments guards
  • Inference: explicit-value preservation, archetype-blocks-inference, two-step cascade, conflicting-rules fail-fast, rule_id uniqueness enforcement
  • Semantic consistency: explicit-vs-assumed gating, all four conflict rules, spec-level archetype/inference consistency check
  • E2E: sample_object_01 (happy) and sample_object_02 (stress) through full pipeline, preview, review, snapshot, and evidence
  • Checked-in example outputs for sample_object_02 updated to match new behavior (2 errors / 8 warnings / 6 assumptions / 6 tbd)

joyshmitz and others added 30 commits April 2, 2026 16:15
Object-first methodology and tooling layer for "Мережа" volume.
NetworkX as analysis engine, YAML specs as source of truth.

Foundation (pre-session):
- 9 methodology docs (questionnaire, roles, workflow, handoff, mapping)
- v2 canonical model: questionnaire, field dictionary, value dictionary
- v2 schema, implementation mapping, 4 annexes (cctv, iiot, time, ha)
- 3 station archetypes + equipment catalog + compatibility matrix
- Pipeline: questionnaire → requirements → graphs → validation → reports
- Role views, role assignments template
- sample_object_01 (happy path, all fields filled)

Corrective pass (this session):
- Assumed fields tracking in build_requirements_model
- TBD preservation: compiler no longer replaces tbd with archetype defaults
- Stage-confidence validator (confidence_level: indicative/provisional/binding)
- Criticality-tension cross-checks in resilience + segmentation validators
- New archetype: resilient_telemetry_site (high-crit non-video/non-iiot)
- Schema updated: tbd is valid for all enum fields
- Malformed section rejection (hard error, not silent coercion)
- Missing vs null distinction in assumption tracking
- sample_object_02 (stress test: TBDs, conflicts, 2 errors 7 warnings)
- 13 pytest tests covering review findings
- Legacy merge_missing_values helper removed

Reviews:
- ARCHITECTURE_REVIEW_2026-04-01.md (first review, 10 findings)
- ARCHITECTURE_REVIEW_WAVE1_FOLLOWUP_2026-04-01.md (follow-up, 4 critical)
- Codex review: 4 findings, all addressed and confirmed closed
… pipeline

90 tests covering:
- Physical/logical/service/failure-domain/interface graph compilation
- All 6 validators (connectivity, segmentation, resilience, power, time, stage_confidence)
- TBD handling across validators (tbd preserved, no false errors)
- End-to-end pipeline for both sample objects
- Schema validation with tbd values
…l, sparse v2 detection

Fixes:
- WAN seed nodes and enrichment WAN nodes skipped when wan_required != yes
- security_zone_model=tbd treated as unresolved (OT only, no edges), not DMZ fallback
- Service graph uses OT as source zone when zone_model is tbd or flat
- Sparse v2 questionnaires detected by version prefix or any v2 marker section
- 11 new tests covering all 3 findings

101 tests passing.
compile_failure_domain_graph() now skips carrier_a/carrier_b when
wan_required != yes, consistent with physical graph WAN gating.

Adds 2 tests: failure-domain no-carrier when WAN disabled, and
validate_resilience flags missing carrier domains for dual_carrier_required.

103 tests passing.
…ators

Annex activation (#3):
- Reads annex specs, checks applies_when conditions against requirements
- Warns when annex should be active but data absent
- Supports both simple {field_id, equals} and {any_of} activation rules
- sample_01 now shows 3 annex warnings (cctv, ha, time)

Cross-graph consistency (#4):
- Service graph zone nodes must exist in logical graph
- Interface graph consumers must match enabled services
- LOCAL_ARCHIVE and askoe exempted from zone/service checks

120 tests passing.
- Reads role_assignments.yaml (auto-discovered next to questionnaire or via --role-assignments)
- Warns when owner_role not assigned to any person
- Errors when S4 field owner and all reviewers resolve to the same person
- sample_01 now shows 4 unassigned role warnings (process_engineer, iiot_engineer)
- 9 new tests covering mappings, S4 conflicts, partial overlap, full coverage

129 tests passing. Wave 2 items #2-#4 complete.
…, role dedup

- Logical graph: tbd zone_model suppresses VIDEO/IIOT/EXTERNAL zones (OT-only)
- Service graph: _service_transport_zone returns None for tbd (no EXTERNAL edges)
- Role assignments: duplicate person_id entries union roles instead of overwriting

131 tests passing.
…thority, sparse schema

- Segmentation validator skips VIDEO/IIOT/MGMT zone checks when zone_model=tbd
- Archetype resolution uses is_yes() to handle PyYAML boolean True/False
- Local archiving decoupled from video: own block in enrich_physical_graph,
  seed nvr_local gated on local_archiving_required, removed if not required
- All 4 archetypes now include growth_horizon_months and wan_required defaults
  so sparse v2 questionnaires survive schema validation end-to-end

138 tests passing.
Plan for per-person questionnaire intake: guide cards, structured
response YAML, two-stage compile, owner/reviewer separation,
object-scoped workspaces, manifest versioning.

Reviewed by GPT Pro (10 revisions integrated) and Codex CLI (5 findings fixed):
- tbd/not_applicable normalization rules for pipeline compatibility
- archetype resolution depends on phase 2, not phase 1 gate
- compile modes complement stage-confidence, don't replace it
- object_owner added to phase 3 ownership
- 0-owner fields warn instead of fail-fast (sample compatibility)
Excel with dropdowns as primary human interface instead of raw YAML.
Compile derives YAML for git diff. Based on research: Excel is
the lingua franca of industrial engineering (60-70% adoption).

Key changes:
- Per-person .xlsx with data validation dropdowns for controlled values
- Conditional formatting for strictness levels (S4=red, S1=grey)
- Reference sheet with full value dictionary
- Reviewer .review.xlsx separate from owner .xlsx
- Compile parses Excel → derived .response.yaml → questionnaire.yaml
- openpyxl dependency required
Major integrations:
- v0/v1 split: minimum viable first, add features after real feedback
- Boundary principles: questionnaire = requirements, not design
- Excel with 3-level value descriptions: dropdown labels, cell comments, reference sheet
- Auto-derive status from value presence (no double-entry)
- Field type handling: enum (dropdown), string (free text), integer (number validation)
- Workspace layout consistent with existing examples/
- CLI usage documented
- Reviewer xlsx deferred to v1
- intake_compiled.yaml deferred to v1
- Excel-specific risks addressed

Reviews: GPT Pro (10), Codex CLI (5), self-review (7), discussion (4)
6 review rounds integrated (GPT Pro + Codex CLI + 4x self-review).

v0 scope: per-person Excel with descriptive dropdowns (3-level value
descriptions), cell comments, strictness colors, auto-derive status,
unassigned fields to _unassigned.xlsx, compile with section reconstruction
and value validation. Guide.md as reference.

Deferred to v1: manifest hashing, reviewer xlsx, intake_compiled
intermediate, evidence enforcement, compile modes, auto feedback mapping.
…ge 0-1)

Stage 0: lock execution contract — canonical interpreter, PYTHONPATH,
bootstrap, verify command, and CLI invocation documented in README.

Stage 1: stabilize generation and compile — add --date YYYY-MM-DD to
both intake CLIs, route all date fields through injected value,
stabilize XLSX workbook metadata timestamps for byte-stable
regeneration, add compiled_at to intake_status.md for parity with YAML.

Tests: fixed-date propagation, byte-stability via SHA-256 comparison
across all generated files, sample_object_02 field distribution.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…Stage 2)

Full intake tree generated and compiled with fixed date 2026-04-02:
intake sheets (xlsx), guides (md), response yamls, questionnaire
roundtrip, intake status reports. 41/41 fields answered, all phases
complete, pipeline end-to-end green (video_heavy_site, 0 errors).

Pipeline improvements: manifest now writes machine-independent relative
paths via _manifest_path(); e2e tests autoload role_assignments.yaml
when present. sample_object_02 role_assignments tracked as Stage 4 prep.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
joyshmitz and others added 20 commits April 3, 2026 09:13
Add project/intake init with clean role assignment scaffolding and explicit object_id validation.
Unify user-facing workspace validation across intake commands, improve command errors, and cover the new flow with regression tests.
Sync operator-facing documentation and archive the superseded triangulation plans behind a merged final plan.
The workspace field in workspace.manifest.yaml stored the resolved
absolute local path, making the manifest non-portable and unsuitable
for check-in. No production code reads this field after write — it
exists only for human orientation. Using workspace.name gives enough
context without leaking machine-specific paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…alidator checks

Add 10 new rules to cross_field_rules.yaml (4 inference + 6 conflict):
- video/iiot → local_archiving_required
- control → timing_accuracy_class=sub_ms (chains to sync_protocol=ntp)
- high criticality → operations_handoff_required
- high criticality conflicts: single_path, best_effort, same_day, shared_ok, flat zones
- poe_required conflicts with poe_budget_class=none

Migrate 6 cross-field semantic checks from domain validators to the
rule catalog + semantic_consistency validator, following the pattern
established in the previous slice (resilience/time migration):
- 3 checks from validate_resilience (carrier diversity, degraded mode, MTTR)
- 2 checks from validate_segmentation (transport separation, zone model)
- 1 check from validate_power_ports (PoE budget)

Domain validators retain graph-based structural checks and the OOB-tbd
fallback. Migrated checks gain the semantic_consistency gate: conflicts
between two assumption-sourced fields are suppressed (covered by the
spec-level archetype consistency test).

Rule catalog grows from 12 to 22 rules. 321 passed.
@joyshmitz

Copy link
Copy Markdown
Owner Author

Closing as superseded. This fork now treats the intake application under project/ as the product, and app-main is the new product trunk. This PR targeted main and no longer reflects the repository strategy.

@joyshmitz joyshmitz closed this Apr 4, 2026
Sign up for free to 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