Skip to content

refactor(writes): simplify cli writes pipeline#71

Merged
thomaschristory merged 3 commits into
mainfrom
refactor/writes-simplify
May 13, 2026
Merged

refactor(writes): simplify cli writes pipeline#71
thomaschristory merged 3 commits into
mainfrom
refactor/writes-simplify

Conversation

@thomaschristory
Copy link
Copy Markdown
Owner

Closes #53

Simplify pass on nsc/cli/writes/. No behaviour changes. All tests pass.

  • preflight.py: drop redundant expected=None keyword arg (field default is already None)
  • bulk.py: replace continue at end of except-block with try/except/else — the continue was dead (end of loop body) but semantically load-bearing; else makes the intent explicit
  • apply.py: eliminate _OTHER_SENSITIVE_HEADERS module constant by inlining into _redact; compute k.lower() once per iteration instead of twice
  • input.py: remove what-comments from _classify_brace_start and _parse_text (comments described code behaviour, not intent)

608 tests pass, mypy --strict clean, ruff clean.

Thomas Christory and others added 2 commits May 13, 2026 00:19
- Collapse `is_collection` two-step logic to `not remainder`
- Drop unused `is_collection_path` param from `_attach`; drop unused `schema_op`/`resource_name` params from `_classify`
- Fold `synthesized` intermediate var into single `operation_id =` expression
- Extract `is_object_like` to eliminate duplicate `top_level in (...)` test
- Replace double `model_extra or {}` double-access with a single `extras` var in `_classify_top_level`, `_object_branch`, and `_collect_sensitive_paths`
- Simplify `_collect_sensitive_paths` ref-cycle guard: track `schema.ref` only (the ref we entered with)
- Replace `getattr(schema, "format", None)` with direct `schema.format` (typed field)

No behaviour changes. All tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- preflight: drop redundant `expected=None` (field default)
- bulk: use try/except/else to eliminate dead `continue` at loop-body end
- apply: fold _OTHER_SENSITIVE_HEADERS into _redact, lowering k once per iteration
- input: remove what-comments from _classify_brace_start and _parse_text

No behaviour changes. 608 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@thomaschristory thomaschristory merged commit 952570f into main May 13, 2026
8 of 9 checks passed
thomaschristory added a commit that referenced this pull request May 16, 2026
Maintenance release: codebase-wide simplification pass (#61-#71),
documentation parity audit (#73), urllib3 2.6.3->2.7.0 (#46).
No CLI/config/output-contract changes vs v1.0.3.

Co-authored-by: Thomas Christory <tchristory@partner.auchan.fr>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

refactor: review & simplify nsc/cli/writes/ pipeline

1 participant