Prettier formatting (via bazel run format) is not idempotent

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • DevProd Test Infrastructure
    • Fully Compatible
    • ALL
    • DevProd Test Infra 2026-06-16, DevProd Test Infra 2026-06-30
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      This can be very frustrating to see terse failures in CI yet passing locally.

      Repro:

      foo(() => {
          bar(() => {
              baz(() => {
                  assert.eq(
                      getEngine(
                          localNoIdx
                              .explain()
                              .aggregate([
                                  { $lookup: { from: "foreignNoIdx", localField: "a", foreignField: "b", as: "r" } },
                              ]),
                      ),
                  );
              });
          });
      });
      

      Running `bazel run //:format – --file jstests/myfile.js` transforms it to:

      foo(() => {
          bar(() => {
              baz(() => {
                  assert.eq(
                      getEngine(
                          localNoIdx
                              .explain()
                              .aggregate([
                                  {
                                      $lookup: {
                                          from: "foreignNoIdx",
                                          localField: "a",
                                          foreignField: "b",
                                          as: "r",
                                      },
                                  },
                              ]),
                      ),
                  );
              });
          });
      });
      

      Running `bazel run //:format – --file jstests/myfile.js` makes no further changes (and --check will pass), but CI will still fail this. Touching the file (dirtying it) and rerunning `bazel run //:format – --file jstests/myfile.js` forces another iterative reformat:

      foo(() => {
          bar(() => {
              baz(() => {
                  assert.eq(
                      getEngine(
                          localNoIdx.explain().aggregate([
                              {
                                  $lookup: {
                                      from: "foreignNoIdx",
                                      localField: "a",
                                      foreignField: "b",
                                      as: "r",
                                  },
                              },
                          ]),
                      ),
                  );
              });
          });
      });
      

            Assignee:
            Steve McClure
            Reporter:
            Steve McClure
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: