Skip to content

policy-validation:force-rewrite runs the same command as policy-validation, so --force-rewrite is never passed #547

Description

@marekl11

Describe the bug

The two policy-validation npm scripts in package.json are identical:

"policy-validation": "npx tsx scripts/policy-validation.ts",
"policy-validation:force-rewrite": "npx tsx scripts/policy-validation.ts"

scripts/policy-validation.ts reads its force flag with
process.argv.includes('--force-rewrite'), but neither script ever passes
it, so npm run policy-validation:force-rewrite <platform> behaves exactly
like npm run policy-validation <platform>: it loads the existing platform
policy instead of starting from an empty policyDocuments list.

To Reproduce

  1. Run npm run policy-validation:force-rewrite instagram.
  2. The run takes the getPlatformPolicy(platform) branch, not the
    force-rewrite branch, so the existing policy documents are reused.

Expected behavior

policy-validation:force-rewrite should pass --force-rewrite so the
script takes the force-rewrite path.

Additional context

Once the flag is actually passed, the platform argument also needs
attention: it is read as process.argv[2], which is whichever argument
comes first, so a leading flag would be picked up as the platform name.
Reading the platform as the first non-flag argument fixes both together.

I have a small patch ready for this and can open a PR against it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions