Repository navigation
fix(sdl): report invalid import declarations, provenance and directory imports as sdl diagnostics - #1484
fix(sdl): report invalid import declarations, provenance and directory imports as sdl diagnostics#1484doublewhy wants to merge 10 commits into
Conversation
c2028d0 to
67f9550
Compare
67f9550 to
942e5e4
Compare
942e5e4 to
4f59cef
Compare
4f59cef to
a7a4ca9
Compare
|
Recommendation: do not merge as is. Reviewed head
Required action:
Coverage and outstanding work: #1580's existing SDLParseError renderer reuse, import-list parity and cycle handling are appropriate. The old-base implementation must be reconciled with landed security hardening before it can be considered complete. Verification limits: Green head checks validate the old-base tree; resulting current-base code remains unverified. |
Resolve the conflicts with the hardening that #1446 landed on dev: - module_registry/models.py: keep dev's bounded workspace-configuration reader, YAML token and graph validation and value-free sdl.workspace-config.invalid errors; drop this branch's unbounded read_text and yaml.safe_load loaders. - module_registry/resolution.py: keep dev's locked-import loop with its cycle check, composition-depth budget and value-free invalid-record error; drop this branch's unbounded loop and value-rendering record error. Keep the directory and unreadable local-import checks and the imported-unit removed-scoring check. - composition/_expand.py: keep dev's admit_import_source and declaration-source tracking; keep typed import-list validation before the first import resolves. The imported-unit removed-scoring check moves into composition/_import_admission.py, where dev now loads the unit.
…ardening - Tests expect dev's value-free lockfile and workspace-configuration errors: the lockfile or policy file is the error path, and the message and diagnostics never render a value. They also prove that an oversized or alias-cyclic policy file and an over-budget locked chain are still refused, including through resolve_lock_records, and that a chain at the budget still resolves like its local target. - resolve_lock_records lives in the public module_registry.lock_records module, beside models, publishing and resolution. - docs/explain/sdl/parser.md describes the merged error behavior.
|
Updated to
|
|
This branch conflicts with dev again after the Quality refactor merges, in |
Summary
Raw exceptions and
raes sdl resolvetracebacks from import resolution become value-freeSDLParseErrors naming the file or import. Valid lockfiles are byte-identical; dev's #1446 hardening is kept.Requirement UIDs
Related Issues
Closes #1580
Not stacked (base
cf8b4308): onlyorigin/devmerged; #1480's headebe04761merges in cleanly. #1552 keepsverify-imports.ADR Impact
Changes
6cc482c2keeps dev'smodels.py,locked:loop andadmit_import_source, adding directory/unreadable-import checks, typed import validation and the ADR-073 check in_import_admission.py.bb919701: publiclock_records.py, tests on dev's messages, docs.241b9b9a: dead parameter dropped.resolve_lock_recordsandraes sdl resolvereport invalid root import declarations with the same code, pointer and range asparse_sdl_file, and reject the import sources and versions thatparse_sdl_filecannot record as provenance. A valid root still gives a byte-identical lockfile.resolve_lock_records,_import_declarations,_provenance_recordtest_resolve_reports_*,test_unrecordable_*,test_valid_root_*locked:record, or alocked:chain that revisits a record, raisesSDLParseErrornamingraes.lock.json. It does not raiseValidationErrororRecursionError. Acyclic chains resolve as before.test_invalid_lock_record_*,test_locked_import_cycles_*,test_acyclic_*raes.lock.jsonorraes-trust.yamlraisesSDLParseErrorwith the file aspathand its name in the message, and never renders its values.test_invalid_policy_files_*SDLParseErrornaming the import, and an imported unit with a removed scoring section gets the root's ADR-073 message._local_import_source,admit_import_sourcetest_directory_import_*,test_unreadable_*,test_*_removed_scoring_*expand_sdl_modulescalled directly reports an invalid declaration as a field diagnostic.expand_sdl_modulestest_direct_expansion_*raes sdl resolveexits non-zero and prints no traceback for each of these, naming the failing file.raes_cli/sdl.py:resolvetest_raes_sdl_resolve_*capture-861dc862,capture-c2c3a4d66cc482c2*-oversized,trust-alias-cycle,chain-over-budget6cc482c2,84a9adcdtest_valid_root_*verify_importsuntouchedTest Plan
test_issue_1580_*: 45 passed; on dev's packages 25 fail and 20 (dev's defenses, controls) pass. Removing dev's chain budget or size bound failschain-over-budgetorlockfile-oversized. 32 related modules: 1218 passed, 1 skipped;-m integration: 5 passed, 6 skipped. With #1480 merged: 334 passed. Fast-feedback, lint, policy, docs-local, contracts, checkers: passed. Full completion suite required in CI before merge.Evidence:
collect_research_evidence.pyon241b9b9a(38/42 stages, 4 preregistered; 20/20 formal), thenresearch_capture record;a7a4ca90captures kept.Ground Control Checks
Self-reviewed only.
Traceability
raes/module_registry/,raes/composition/,raes/_model_diagnostics.py,raes/_composition_provenance.py,raes_cli/sdl.pytests/test_issue_1580_import_boundary_diagnostics.pyChecklist
CHANGELOG.mdfrom it)FM0: error reporting only, no schema change; no executable or runtime adoption is claimed.