Skip to content

fix: change const to let for policy reassignment in applyPreset - #133

Closed
WuKongAI-CMU wants to merge 1 commit into
NVIDIA:mainfrom
WuKongAI-CMU:fix/policies-const-reassignment
Closed

fix: change const to let for policy reassignment in applyPreset#133
WuKongAI-CMU wants to merge 1 commit into
NVIDIA:mainfrom
WuKongAI-CMU:fix/policies-const-reassignment

Conversation

@WuKongAI-CMU

Copy link
Copy Markdown
Contributor

Summary

  • Fix TypeError: Assignment to constant variable crash in applyPreset() when a sandbox has a policy without a network_policies section
  • Export extractPresetEntries and parseCurrentPolicy for testability
  • Add 9 unit tests for the three pure policy helper functions

Problem

bin/lib/policies.js:94 declares currentPolicy as const, but line 136 reassigns it to prepend version: 1. This code path is reached when a sandbox has a policy YAML that doesn't contain a network_policies: key — the const assignment throws at runtime.

Fix

Change const currentPolicy to let currentPolicy on line 94.

Test plan

  • node --test test/policies-helpers.test.js — 9/9 pass
  • node --test test/*.test.js — full suite 61/61 pass

🤖 Generated with Claude Code

applyPreset() crashes with "Assignment to constant variable" when a
sandbox has a policy without a network_policies section. Change the
declaration from const to let so the fallback path can prepend the
version field.

Also export extractPresetEntries and parseCurrentPolicy for testing
and add 9 unit tests covering all three pure helpers.

Signed-off-by: Peter Tam <nickthetam@gmail.com>
Signed-off-by: peteryuqin <peter.yuqin@gmail.com>
@WuKongAI-CMU

Copy link
Copy Markdown
Contributor Author

Closing to reduce my open PR count below the repo policy limit and refocus on a smaller set of higher-signal changes. I can revive this branch later if it becomes the right path again.

mafueee pushed a commit to mafueee/NemoClaw that referenced this pull request Mar 28, 2026
…tion (NVIDIA#145)

* fix(server): add field-level size limits to sandbox and provider creation

Closes NVIDIA#24

Add validate_sandbox_spec and provider field validation with named
constants. Configure explicit 1MB tonic max_decoding_message_size.
Inference routes excluded per NVIDIA#133 rearchitecture.

* chore: remove issue number references from code comments

---------

Co-authored-by: John Myers <johntmyers@users.noreply.github.com>
mafueee pushed a commit to mafueee/NemoClaw that referenced this pull request Mar 28, 2026
…move implicit catch-all (NVIDIA#146)

Remove multi-route CRUD system and replace with single managed cluster
route (inference.local). Key changes:

- Remove inference route CRUD RPCs and CLI commands
- Remove InspectForInference OPA action; policy is binary allow/deny
- Introduce AuthHeader enum and InferenceProviderProfile in navigator-core
- Router is now provider-agnostic: auth style carried on ResolvedRoute
- Replace InferenceRouteSpec with ClusterInferenceConfig (2 fields vs 8)
- Rename proto: routing_hint->name, SandboxResolvedRoute->ResolvedRoute,
  GetSandboxInferenceBundle->GetInferenceBundle, drop sandbox_id param
- Rename RouteConfig.route -> RouteConfig.name; use inference.local
- Add 'nemoclaw cluster inference update' for partial config changes
- Delete stale navigator.inference.v1.rs checked-in proto file
- Update architecture docs, agent skills, and CLI reference

Closes NVIDIA#133
@wscurran wscurran added the bug-fix PR fixes a bug or regression label Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants